NAME
Monitoring::Sneck::Checks::zfs - checks ZFS pools, health, capacity, scrubs, and device errors
VERSION
Version 0.0.1
SYNOPSIS
zfs|perl:zfs
zfs_tank|perl:zfs -p tank -w 70 -c 85
zfs_scrubs|perl:zfs --scrub-warning 35 --scrub-critical 60
zfs_frag|perl:zfs --frag-warning 50
DESCRIPTION
Checks pools through zpool list and zpool status.
- CRITICAL :: A pool not ONLINE, such as DEGRADED or FAULTED. Data errors. A pool given with --pool not being there. Capacity, fragmentation, or scrub age over their critical.
- WARNING :: A resilver running. A device not ONLINE, such as a FAULTED disk or UNAVAIL spare. A device with read, write, or checksum errors. Capacity, fragmentation, or scrub age over their warning.
- UNKNOWN :: zpool not being there, or failing.
- OK :: Everything else, including a scrub running and having no pools.
Scrub age is the days since the last scrub or resilver finished, as zpool status only says the last. A pool with neither finished, such as a new one or one whose scrub was canceled, is over any scrub range.
Device error counts stay until zpool clear is run.
A line for each pool follows the status line.
OPTIONS
- -p, --pool :: A pool to check, instead of all of them. May be given more than once.
- -w, --warning :: Range for capacity, in percent. Default :: 80
- -c, --critical :: Range for capacity, in percent. Default :: 90
- --frag-warning :: Range for fragmentation, in percent.
- --frag-critical :: Range for fragmentation, in percent.
- --scrub-warning :: Range for scrub age, in days. Default :: 40
- --scrub-critical :: Range for scrub age, in days.
METHODS
check
Does the check.
pool_status
Works out how a pool is.
- name :: The pool's name.
- listed :: Hash ref from zpool list, of health, capacity, and fragmentation, which is - if the pool has none.
- status :: Hash ref of what zpool status said about it, as from _parse_status, or undef if it said nothing.
Returns the code, what to say about the pool in the status line, undef if it is fine, and the line about it for after the status line.
my ( $code, $says, $detail )
= $check->pool_status( 'tank', { health => 'ONLINE', capacity => 85, fragmentation => 10 }, $status );
# ( 1, 'tank 85% full', 'tank ONLINE, 85% full, 10% fragmented, scrubbed 3 days ago' )