Skip to content

Commit

Permalink
Expose zpool status metrics
Browse files Browse the repository at this point in the history
Signed-off-by: Lars Strojny <lars@strojny.net>
  • Loading branch information
lstrojny committed Nov 23, 2023
1 parent fdcc68b commit cdfb7ed
Show file tree
Hide file tree
Showing 11 changed files with 692 additions and 56 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__pycache__
Empty file added tests/__init__.py
Empty file.
26 changes: 26 additions & 0 deletions tests/fixtures/zpool_status_-p
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
pool: pool0
state: ONLINE
scan: scrub repaired 0B in 06:58:02 with 0 errors on Sun Nov 12 07:22:03 2023
config:

NAME STATE READ WRITE CKSUM
pool0 ONLINE 0 0 0
raidz1-0 ONLINE 0 0 0
ata-TOSHIBA_MG09ACA18TE_82X0A0QMFJDH ONLINE 0 0 0
ata-TOSHIBA_MG09ACA18TE_82J0A00FFJDH ONLINE 0 0 0
ata-TOSHIBA_MG09ACA18TE_82X0A0QPFJDH ONLINE 0 0 0

errors: No known data errors

pool: pool1
state: ONLINE
scan: scrub repaired 1M in 00:04:45 with 0 errors on Sun Nov 12 00:28:47 2023
config:

NAME STATE READ WRITE CKSUM
pool1 ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
nvme-Samsung_SSD_980_500GB_S64DNL0T824602E-part1 ONLINE 0 0 0
nvme-Samsung_SSD_980_500GB_S64DNL0T824555Z-part1 ONLINE 0 0 0

errors: No known data errors
16 changes: 16 additions & 0 deletions tests/fixtures/zpool_status_-p_degraded
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
pool: tank
state: DEGRADED
status: One or more devices could not be opened. Sufficient replicas exist for
the pool to continue functioning in a degraded state.
action: Attach the missing device and online it using 'zpool online'.
see: http://www.sun.com/msg/ZFS-8000-2Q
scrub: none requested
config:

NAME STATE READ WRITE CKSUM
tank DEGRADED 0 0 0
mirror-0 DEGRADED 0 0 0
c1t0d0 ONLINE 0 0 0
c1t1d0 UNAVAIL 0 0 0 cannot open

errors: No known data errors
25 changes: 25 additions & 0 deletions tests/fixtures/zpool_status_-p_degraded_sparse
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
pool: test
state: DEGRADED
status: One or more devices could not be used because the label is missing or
invalid. Sufficient replicas exist for the pool to continue
functioning in a degraded state.
action: Replace the device using 'zpool replace'.
see: http://zfsonlinux.org/msg/ZFS-8000-4J
scan: resilvered 25.8M in 0h0m with 0 errors on Fri Aug 22 12:02:46 2014
config:

NAME STATE READ WRITE CKSUM
test DEGRADED 0 0 0
mirror-0 DEGRADED 0 0 0
spare-0 DEGRADED 1 0 0
ata-VBOX_HARDDISK_VBb80f1f56-538e9acf ONLINE 0 0 1
16876260487220383698 FAULTED 0 0 0 was /dev/disk/by-path/pci-0000:00:0d.0-scsi-12:0:0:0-part1
ata-VBOX_HARDDISK_VB875e28a5-4b293298 ONLINE 0 0 0
mirror-1 ONLINE 0 0 0
ata-VBOX_HARDDISK_VB4145ff65-9b1320a3 ONLINE 0 0 0
ata-VBOX_HARDDISK_VBee9d66a1-edf52bff ONLINE 0 0 0
spares
pci-0000:00:0d.0-scsi-10:0:0:0 AVAIL
pci-0000:00:0d.0-scsi-11:0:0:0 AVAIL
pci-0000:00:0d.0-scsi-12:0:0:0 AVAIL
pci-0000:00:0d.0-scsi-13:0:0:0 AVAIL
21 changes: 21 additions & 0 deletions tests/fixtures/zpool_status_-p_logs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
pool: zones
state: DEGRADED
status: One or more devices could not be opened. Sufficient replicas exist for
the pool to continue functioning in a degraded state.
action: Attach the missing device and online it using 'zpool online'.
see: http://illumos.org/msg/ZFS-8000-2Q
scan: scrub repaired 0 in 29h37m with 0 errors on Thu Jul 14 18:42:06 2016
config:

NAME STATE READ WRITE CKSUM
zones DEGRADED 0 0 0
mirror-0 DEGRADED 0 0 0
9669136929555758172 UNAVAIL 0 0 0 was /dev/dsk/c0t5000C5006349E003d0s0
c0t5000C500631F81E7d0 ONLINE 0 0 0
mirror-1 ONLINE 0 0 0
c0t5000C500634A297Bd0 ONLINE 0 0 0
c0t5000C500634B4EA3d0 ONLINE 0 0 0
logs
c0t55CD2E404B73663Dd0 ONLINE 0 0 0

errors: No known data errors
33 changes: 33 additions & 0 deletions tests/fixtures/zpool_status_-p_resilvered
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
pool: rpool
state: DEGRADED
status: One or more devices could not be opened. Sufficient replicas exist for
the pool to continue functioning in a degraded state.
action: Attach the missing device and online it using 'zpool online'.
see: http://www.sun.com/msg/ZFS-8000-2Q
scan: resilvered 1.41M in 0h0m with 0 errors on Tue Nov 15 05:31:36 2011
config:

NAME STATE READ WRITE CKSUM
rpool DEGRADED 0 0 0
mirror-0 DEGRADED 0 0 0
c4d1s0 UNAVAIL 0 0 0 cannot open
c2t1d0s0 ONLINE 0 0 0
c3d1s0 UNAVAIL 0 0 0 cannot open

errors: No known data errors

pool: zpool
state: UNAVAIL
status: One or more devices could not be opened. There are insufficient
replicas for the pool to continue functioning.
action: Attach the missing device and online it using 'zpool online'.
see: http://www.sun.com/msg/ZFS-8000-3C
scan: none requested
config:

NAME STATE READ WRITE CKSUM
zpool UNAVAIL 0 0 0 insufficient replicas
raidz1-0 UNAVAIL 0 0 0 insufficient replicas
c2t1d0p2 ONLINE 0 0 0
c4d1p2 UNAVAIL 0 0 0 cannot open
c3d1p2 UNAVAIL 0 0 0 cannot open
24 changes: 24 additions & 0 deletions tests/fixtures/zpool_status_-p_scrub
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
pool: freenas-boot
state: ONLINE
scan: scrub repaired 0 in 0h2m with 0 errors on Wed Jan 25 03:47:27 2017
config:

NAME STATE READ WRITE CKSUM
freenas-boot ONLINE 0 0 0
da0p2 ONLINE 0 0 0

errors: No known data errors

pool: nas_zfs_vol0
state: ONLINE
scan: scrub repaired 0 in 7h7m with 0 errors on Sun Jan 8 07:07:22 2017
config:

NAME STATE READ WRITE CKSUM
nas_zfs_vol0 ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
gptid/a855d0c8-5218-11e3-9e38-10604b926998 ONLINE 0 0 0
gptid/a8c3fe2f-5218-11e3-9e38-10604b926998 ONLINE 0 0 0
mirror-1 ONLINE 0 0 0
gptid/a91ebd06-5218-11e3-9e38-10604b926998 ONLINE 0 0 0
gptid/a96f4d37-5218-11e3-9e38-10604b926998 ONLINE 0 0 0
18 changes: 18 additions & 0 deletions tests/fixtures/zpool_status_-p_unavail
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
pool: tank
state: UNAVAIL
status: One or more devices are faulted in response to IO failures.
action: Make sure the affected devices are connected, then run 'zpool clear'.
see: http://www.sun.com/msg/ZFS-8000-HC
scrub: scrub completed after 0h0m with 0 errors on Tue Feb 2 13:08:42 2010
config:

NAME STATE READ WRITE CKSUM
tank UNAVAIL 0 0 0 insufficient replicas
c1t0d0 ONLINE 0 0 0
c1t1d0 UNAVAIL 4 1 0 cannot open

errors: Permanent errors have been detected in the following files:

/tank/data/aaa
/tank/data/bbb
/tank/data/ccc

0 comments on commit cdfb7ed

Please sign in to comment.