Build precise queries to find exactly what you need
Press ESC to close
Your review has been submitted and is pending approval.
Monitor ZFS pools on Linux.
Current Version
0.9.3
Last Release Date
2013-08-21
Owner
chuck
Compatible With
This plugin was adopted from check_zfs for Solaris (http://exchange.nagios.org/directory/Plugins/Operating-Systems/Solaris/check_zfs/details) to run on Linux with ZFS-on-Linux (http://zfsonlinux.org) installed.
It has been tested on CentOS 6.4 so far.
I like this little script because it does not 'use' things I don't already have installed. In fact, it only 'use strict'. The script is a few years old, so I've updated it for the latest 'zpool list' output from Ubuntu 16.04 0.6.5.6-0ubuntu10 / ZFS on Linux zfs-0.6.5.6 . The diff is below: $ diff -Nurp check_zfs.2 check_zfs.0 --- check_zfs.2 2016-07-11 17:10:43.981148057 -0400 +++ check_zfs.0 2016-07-11 16:11:33.460956749 -0400 @@ -61,14 +61,12 @@ if ($#ARGV+1 != 2) { my $pool=$ARGV[0]; my $verbose=$ARGV[1]; -my $size=""; # SIZE -my $used=""; # ALLOC -my $avail=""; # FREE -my $sizex=""; # EXPANDSZ -my $frag=""; # FRAG -my $cap=""; # CAP -my $dedup=""; # DEDUP -my $health=""; # HEALTH +my $size=""; +my $used=""; +my $avail=""; +my $cap=""; +my $dedup=""; +my $health=""; my $dmge=""; if ($verbose 3) { @@ -77,30 +75,19 @@ if ($verbose 3) { } my $statcommand="zpool list $pool"; -# my $statcommand="zpool list -o 'name,size,alloc,free,cap,dedup,health,altroot'"; if (! open STAT, "$statcommand|") { print ("$state '$statcommand' command returns no result! NOTE: This plugin needs OS support for ZFS, and execution with root privileges.n"); exit $ERRORS{$state}; } -# NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT -# rpool 9.94G 718M 9.24G - 6% 7% 1.00x ONLINE - - while() { chomp; - NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT - next if (/^NAMEs+SIZEs+ALLOCs+FREEs+EXPANDSZs+FRAGs+CAPs+DEDUPs+HEALTHs+ALTROOT/); + NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT + next if (/^NAMEs+SIZEs+ALLOCs+FREEs+CAPs+DEDUPs+HEALTHs+ALTROOT/); if (/^${pool}s+/) { - ($size, $used, $avail, $sizex, $frag, $cap, $dedup, $health) = - /^${pool}s+(S+)s+(S+)s+(S+)s+(S+)s+(S+)s+(S+)s+(S+)s+(S+)/; + ($size, $used, $avail, $cap, $dedup, $health) = /^${pool}s+(S+)s+(S+)s+(S+)s+(S+)s+(S+)s+(S+)/; } - -# NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT -# next if (/^NAMEs+SIZEs+ALLOCs+FREEs+CAPs+DEDUPs+HEALTHs+ALTROOT/); -# if (/^${pool}s+/) { -# ($size, $used, $avail, $cap, $dedup, $health) = /^${pool}s+(S+)s+(S+)s+(S+)s+(S+)s+(S+)s+(S+)/; -# } } close(STAT); @@ -218,6 +205,6 @@ while() { ## calling all goats! -$msg = sprintf "ZPOOL %s : %s {Size:%s Used:%s Avail:%s Expand:%s Frag:%s Cap:%s Dedup:%s} %sn", $pool, $health, $size, $used, $avail, $sizex, $frag, $cap, $dedup, $dmge; +$msg = sprintf "ZPOOL %s : %s {Size:%s Used:%s Avail:%s Cap:%s} %sn", $pool, $health, $size, $used, $avail, $cap, $dmge; print $state, " ", $msg; exit ($ERRORS{$state});
You must be logged in to submit a review.
To:
From: