jc icon indicating copy to clipboard operation
jc copied to clipboard

Feature request - zfs syntax

Open kneutron opened this issue 2 years ago • 1 comments

It could be quite helpful to include ZFS syntax for the jc feature set, if you have any questions please feel free to ask. The below output is from ZFS on OSX with 3x single-disk pools but I can provide various output from different configurations by using a VM

$ jc zpool status
jc:  Error - "zpool status" cannot be used with Magic syntax. Use "jc -h" for help.


$ zpool  status -v|awk 'NF>0' # skip blank lines
  pool: zhgstera6
 state: ONLINE
  scan: scrub canceled on Fri Aug 19 15:33:19 2022
config:
        NAME                        STATE     READ WRITE CKSUM
        zhgstera6                   ONLINE       0     0     0
          726060ALE614-K8JAPRGN:10  ONLINE       0     0     0
errors: No known data errors
  pool: zint500
 state: ONLINE
  scan: scrub repaired 0 in 0 days 00:19:47 with 0 errors on Tue Aug 16 00:20:50 2022
config:
        NAME                      STATE     READ WRITE CKSUM
        zint500                   ONLINE       0     0     0
          ST3500418AS-5VMSTSSX:5  ONLINE       0     0     0
errors: No known data errors
  pool: zsam53
 state: ONLINE
  scan: scrub repaired 0 in 0 days 01:25:43 with 0 errors on Mon Aug 15 01:26:46 2022
config:
        NAME                                 STATE     READ WRITE CKSUM
        zsam53                               ONLINE       0     0     0
          Portable_SSD_T5-S49WNP0N120517B:8  ONLINE       0     0     0
errors: No known data errors



 $ zpool  iostat
              capacity     operations     bandwidth
pool        alloc   free   read  write   read  write
----------  -----  -----  -----  -----  -----  -----
zhgstera6   2.89T  2.20T      0      2   349K   448K
zint500      230G  24.0G      0      9   112K   318K
zsam53       211G  24.5G      0      0  14.7K  74.4K
----------  -----  -----  -----  -----  -----  -----

$ zpool  iostat -v
                                       capacity     operations     bandwidth
pool                                 alloc   free   read  write   read  write
-----------------------------------  -----  -----  -----  -----  -----  -----
zhgstera6                            2.89T  2.20T      0      2   349K   448K
  726060ALE614-K8JAPRGN:10           2.89T  2.20T      0      2   349K   448K
-----------------------------------  -----  -----  -----  -----  -----  -----
zint500                               230G  24.0G      0      9   112K   318K
  ST3500418AS-5VMSTSSX:5              230G  24.0G      0      9   112K   318K
-----------------------------------  -----  -----  -----  -----  -----  -----
zsam53                                211G  24.5G      0      0  14.7K  74.4K
  Portable_SSD_T5-S49WNP0N120517B:8   211G  24.5G      0      0  14.7K  74.4K
-----------------------------------  -----  -----  -----  -----  -----  -----



# ( for OSX high Sierra )
$ jc -v
jc version:  1.21.2
python interpreter version:  3.10.6
python path:  /opt/local/Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10

kneutron avatar Aug 31 '22 02:08 kneutron

Thanks for the parser suggestion. This would probably be a good addition to jc.

This does look like a rather complex command with varying output styles, so I'll have to do some more research on the different options. I might even need to split it up into multiple parsers. For instance, the iostat option looks like it might give continuous output, in which case a streaming parser would be ideal.

The more output samples the better.

kellyjonbrazil avatar Aug 31 '22 14:08 kellyjonbrazil

Taking a look at implementing this now. Would it make sense to split this into two parsers?

  • zpool status
  • zpool iostat

Any other subcommands I should take a look at?

kellyjonbrazil avatar Sep 26 '22 21:09 kellyjonbrazil

Not op, but as a zfs user, zpool get all, zfs status, zfs get all

alzabo avatar Nov 04 '22 14:11 alzabo

I have a working version of zpool iostat and zpool status ready for testing: https://github.com/kellyjonbrazil/jc/blob/dev/jc/parsers/zpool_iostat.py https://github.com/kellyjonbrazil/jc/blob/dev/jc/parsers/zpool_status.py

You can copy the files to your plugin directory:

  • Linux/unix: $HOME/.local/share/jc/jcparsers
  • macOS: $HOME/Library/Application Support/jc/jcparsers
  • Windows: $LOCALAPPDATA\jc\jc\jcparsers

Let me know if that works or if you run into any issues. I'm still working on the other zpool commands.

kellyjonbrazil avatar Feb 01 '23 00:02 kellyjonbrazil

@alzabo Could you paste some samples of those commands? I don't really have a functioning setup for zpool output so I'm writing the parser(s) based on the samples. Thanks!

kellyjonbrazil avatar Feb 01 '23 17:02 kellyjonbrazil

Added in v1.23.0

kellyjonbrazil avatar Feb 27 '23 23:02 kellyjonbrazil