Monitor zfs pools - which Nagios plugin should be used?

Written by - 4 comments

Published on - Listed in Nagios BSD Hardware Unix Monitoring ZFS


At my work there are several machines running with zfs file systems. Some of them also use zfs pools, which can define a raid out of a system without raid controller (a bit like mdraid simply explained - please don't hit me Solaris guys!). To be able to monitor the status of such zfs pools, there are many Nagios plugins around. Alone on exchange.nagios.org  I found seven plugins which check zfs file systems and/or pools. But which one should I take, given that we run different operating systems with zfs?

To answer this question I compared all seven plugins if they work, how they're working and what they can do on the following operating systems on physical machines:
- Solaris 10
- OpenSolaris 11
- SmartOS 2012Q2
- FreeBSD 8.3

The following plugins were compared:

  1. Check ZFS file systems and data pools (check_zfs.pl)
    Author: Michael Simoni
    http://exchange.nagios.org/directory/Plugins/Operating-Systems/Solaris/Check-ZFS-file-systems-and-data-pools/details

  2. check_zfs
    Author: Nathan Butcher
    http://exchange.nagios.org/directory/Plugins/Operating-Systems/Solaris/check_zfs/details

  3. Check Solaris ZFS Pools (check_zpools)
    Author: vitaliy@gmail.com
    http://exchange.nagios.org/directory/Plugins/Operating-Systems/Solaris/Check-Solaris-ZFS-Pools/details

  4. Solaris Zpools checker (check_zpools)
    Author: Aldo Fabi
    http://exchange.nagios.org/directory/Plugins/Operating-Systems/Solaris/Solaris-Zpools-checker/details

  5. check_zpool_fs
    Author: Suraj K Abraham
    http://exchange.nagios.org/directory/Plugins/Operating-Systems/Solaris/check_zpool_fs/details

  6. check_zpool.pl
    Author: ?
    http://exchange.nagios.org/directory/Plugins/Operating-Systems/Solaris/check_zpool-2Epl/details

  7. check_zpool (check_zpool.sh)
    Author: Søren Klintrup
    http://exchange.nagios.org/directory/Plugins/Operating-Systems/Solaris/check_zpool/detaills

 

Plugins output (examples):

1. check_zfs.pl on a Solaris 10:

# Check all pools
./check_zfs.pl -p
OK: ZFS on solaris-server - No zfs failures detected

# Check single pool:
./check_zfs.pl -p -z rpool
OK: ZFS on solaris-server - No zfs failures detected

2. check_zfs on an OpenSolaris 11:

# Check with verbose level 2
./check_zfs.pl datapool1 2
OK ZPOOL datapool1 : ONLINE {Size:13.6T Used:13.2T Avail:449G Cap:96%}

# Check with verbose level 3 (shows all disks)
./check_zfs.pl datapool1 3
OK ZPOOL datapool1 : ONLINE {Size:13.6T Used:13.2T Avail:449G Cap:96%} c9t2d0:ONLINE c10t1d0:ONLINE c9t3d0:ONLINE c10t2d0:ONLINE c9t4d0:ONLINE c10t3d0:ONLINE c9t5d0:ONLINE c10t4d0:ONLINE c9t6d0:ONLINE c10t5d0:ONLINE c9t7d0:ONLINE c10t6d0:ONLINE c9t1d0:ONLINE c10t7d0:ONLINE c9t8d0:ONLINE c10t8d0:ONLINE c9t9d0:ONLINE c10t9d0:ONLINE c9t10d0:ONLINE c10t10d0:ONLINE c9t11d0:ONLINE c10t11d0:ONLINE c9t12d0:ONLINE c10t12d0:ONLINE c9t13d0:ONLINE c10t13d0:ONLINE c9t14d0:ONLINE c10t14d0:ONLINE c9t15d0:ONLINE c10t15d0:ONLINE [SPARES]:-

3. check_zpools on FreeBSD 8.3 and on OpenSolaris 11:

# FreeBSD 8.3:
./check_zpools
OK:datapool:23%:ONLINE OK:dbpool:4%:ONLINE

# OpenSolaris 11:
./check_zpools  
WARNING:datapool1:96%:ONLINE OK:rpool:25%:ONLINE

4. check_zpools on Solaris 10:

./check_zpools   
OK:rpool:5%:ONLINE

5. check_zpool_fs on Solaris 10 and OpenSolaris 11:

# Solaris 10
./check_zpool_fs rpool 90 95
/rpool: 5%used - (Used: 8.12G/Total: 136G) (90%): OK

# OpenSolaris 11
./check_zpool_fs datapool1 90 95
/datapool1: 96%used - (Used: 13.2T/Total: 13.6T) (95%): CRITICAL

6. check_zpool.pl on FreeBSD 8.3:

./check_zpool.pl
Can't locate Nagios/Plugin.pm in @INC (@INC contains: ....

7. check_zpool.sh on FreeBSD 8.3, SmartOS and Solaris 10:

#FREEBSD
./check_zpool.sh    
  / datapool: online / dbpool: online

# SMARTOS
./check_zpool.sh
  / zones: online

# SOLARIS 10
./check_zpool.sh
sed: illegal option -- E
Bad string
 / rpool: unknown state

 

Comparison table:

 Plugin  Help  Verbose  Solaris10
 OpenSolaris11  SmartOS
 FreeBSD 8.3
 Active?
 1  y  y  y  y  n (*4)  n (*6)
 n
 2  y (*1)
 y  y  y  n (*4)  y (*7)
 n
 3  n  n  y  y  y  y (*8)
 ?
 4  n  n  y  y  y  y (*8)  n
 5  y (*1)  n  y  y  n (*5)
 n (*5)  ?
 6  y  y  n (*2)
 n (*2)  n (*4)  n (*2)  ?
 7  n  n  n (*3)
 n (*3)  y  y  ?
 8+
 y
 n
 y
 y
 y
 y
 y

Legend:
Plugin: The plugin number tested (see above for list)
Help: Is there a help function of the plugin available? (--help, or -h, etc)
Verbose: Is there a verbose function for additional information?
Solaris10: Does the plugin work on Solaris 10?
OpenSolaris11: Does the plugin work on Open Solaris 11?
SmartOS: Does the plugin work on SmartOS (2012Q2)?
FreeBSD 8.3: Does the plugin work on FreeBSD 8.3?
Active: Is this plugin in active development?

*1: No real help available but shows usage as help
*2: Additional perl modules are required
*3: sed -E is used, which is not recognized by the sed installed on the OS
*4: Perl is required
*5: Invalid option error
*6: Plugin outputs that it only works on Solaris 10 when launched on FreeBSD
*7: Works, but always returns CRITICAL output
*8: Works after paths of commands were adapted to FreeBSD

8+: As requested in the comments, I added my own check_zpools plugin.

 

Additional comments:

Plugin 2) I really like the output of this plugin! A real bummer that it doesn't work on SmartOS due to perl usage :-(
Plugin 3+4) This is actually very much the same plugin, 3) is a fork of 4) with some minor changes
Plguin 6) requires additional perl modules to work (Nagios::Plugin and Switch at least)

I am aware that the "n" could easily become a "y" when perl is installed, but my requirement for the plugin is that it works out of the box, without having to install anything.
Unfortunately, a physical SmartOS doesn't come with a lot of software, so minimum compatibility is important in my case.

 

And the lovely winner is...:

If I could choose, I'd prefer candidate 2's output mixed with the compatibility of candidate 4 (because its a shell script).
So at the end I decided for plugin 3 (Check Solaris ZFS Pools) but I'll have to adapt the source code anyway so it also works on FreeBSD systems. 

I hope this comparison was helpful to you.

Update May 9th 2013: As mentioned, I decided for check_zpools. But for compatibility reasons (SmartOS, FreeBSD, Solaris) I made a lot of changes. Take a look at the next article "Presenting check_zpools - a Nagios plugin to monitor zfs pools".


Add a comment

Show form to leave a comment

Comments (newest first)

ck from Switzerland wrote on Apr 29th, 2022:

Sparky, yes, I am actually using check_zpools in Icinga - however via NRPE. But there are not many commands, so a Command object definition in Icinga 2 is very easy to do. See check_zpools monitoring plugin for more information.


Sparky from wrote on Apr 29th, 2022:

First of all, thank you very much for the script!
Second, did you happen to use this with Icinga too? If so do you have any example configuration files for it?


ck from St. Gallen, Switzerland wrote on Aug 12th, 2015:

Hi Logan. Good idea. I added my own check_zpools into the comparison table.


Logan M from US wrote on Aug 12th, 2015:

Hey nice plugin you have here, would it be possible to update to get the results of zpool status? I have started using the script outlined here to monitor zpool status which seems to work but would be good to have all ZFS checks in one nice neat package no ? :)

https://www.rootusers.com/nagios-check-zfs-zpool-status-for-read-write-cksum-errors/


RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder