check_zpools

Last update: March 15, 2023

This plugin was created to monitor the usage and status of ZFS Pools (zpools). The code was based on the plugin "Check Solaris ZFS Pools" but was completely rewritten in order to allow running the plugin on multiple OS.

The plugin supports a warning and a critical threshold for the usage (similar to disk usage) on the ZFS Pool. If one of the disks in the ZFS Pool is set to DEGRADED, the plugin will return a CRITICAL status.

Commercial support

If you are looking for commercial support for this monitoring plugin, need customized modifications or in general customized monitoring plugins, contact us at Infiniroot.com.

Download

Download check_zpools.sh

check_zpools.sh

10831 downloads so far...

Download plugin and save it in your Nagios/Monitoring plugin folder (usually /usr/lib/nagios/plugins, depends on your distribution). Afterwards adjust the permissions (usually chmod 755).

Community contributions welcome on GitHub repo.

Version history / Changelog

# 2006-09-01 Original first version
# 2006-10-04 Updated (no change history known)
# 2013-02-04 Forked and released
# 2013-05-08 Make plugin work on different OS, pepp up plugin
# 2013-05-09 Bugfix in exit code handling
# 2013-05-10 Removed old exit vars (not used anymore)
# 2013-05-21 Added performance data (percentage used)
# 2013-07-11 Bugfix in zpool health check
# 2014-02-10 Bugfix in threshold comparison
# 2014-03-11 Allow plugin to run without enforced thresholds
# 2016-10-12 Fixed incorrect shell quoting and typos
# 2022-03-01 Merge PR #10, manually solve conflicts
# 2022-05-24 Removed need for 'awk', using bash-functions instead
# 2023-02-15 Bugfix in single pool CRITICAL output (issue #13)

Compatibility

The plugin was successfully tested on multiple OS:

  • Solaris 10/11
  • OpenSolaris
  • SmartOS
  • FreeBSD
  • Linux

Requirements

  • The zpool command must be executable by the user running this plugin

Definition of the parameters

Parameter Description
-p Name of the pool to monitor. If set to "ALL", all available zfs pools will be checked.
-w* Warning threshold for usage in percent
-c* Cricital threshold for usage in percent
--help* Show help/usage.

* optional parameter

Usage / running the plugin on the command line

Usage:

./check_zpools.sh -p (poolname|ALL) [-w int] [-c int]

Examples:

./check_zpools.sh -p ALL -w 80 -c 90

Command definition (NRPE)

command[check_zpools]=/usr/lib/nagios/plugins/check_zpools.sh -p $ARG1$ -w $ARG2$ -c $ARG3$

Service definition

Service definition in Nagios, Icinga 1.x, Shinken, Naemon

# Check all zpools
define service{
  use generic-service
  host_name myfreebsdserver
  service_description ZFS Pools ALL
  check_command check_nrpe!check_zpools!-a "ALL" "80" "90"
}

# Check single zpool
define service{
  use generic-service
  host_name myfreebsdserver
  service_description ZFS Pool MyPool1
  check_command check_nrpe!check_zpools!-a "MyPool1" "80" "90"
}

Service object definition Icinga 2.x

# Check all zpools
object Service "ZFS Pools" {
  import "generic-service"
  host_name = "myfreebsdserver"
  check_command = "nrpe"
  vars.nrpe_command = "check_zpools"
  vars.nrpe_arguments = ["ALL", "80", "90"]
}

Screenshots

check_zpools.sh multiple operating systems
check_zpools.sh warning usage
check_zpools.sh usage graph
check_zpools.sh pnp4nagios usage graph