Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

check_zpools.sh

Rating
2 votes
Favoured:
0
Current Version
20230215
Last Release Date
2023-02-15
Compatible With
  • Nagios 1.x
  • Nagios 2.x
  • Nagios 3.x
  • Nagios 4.x
Owner
License
GPL
Hits
46370
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
check_zpools.sh
Monitoring plugin to monitor status and usage of zfs pools. Runs on multiple OS (tested on Solaris, FreeBSD, Linux, smartOS).
***Description***
Up to date description and full documentation: https://www.claudiokuenzler.com/monitoring-plugins/check_zpools.php

This plugin is a fork of previously existing plugins from Aldo Fabi and Vitaliy Gladkevitch.

Based on a comparison of existing Nagios plugins to check zfs pools (see http://www.claudiokuenzler.com/blog/345/monitor-zfs-disk-pools-nagios-plugin-comparison), the original plugin was completely rewritten for the purpose on using it independantly of the OS -> tested on Solaris, SmartOS and FreeBSD. It also offers performance data for graphing the usage.

The plugin supports a warning and a critical threshold for the usage (like 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.

Performance data are integrated for usage.


***History***
# 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)

***Tested on OS...***
- Solaris 10/11
- OpenSolaris
- SmartOS
- FreeBSD
- Linux


***Usage***
./check_zpools.sh -p (poolname|ALL) [-w warnpercent] [-c critpercent]


***Example Output***
./check_zpools.sh -p ALL -w 80 -c 90
ALL ZFS POOLS OK (datapool logpool rpool)|datapool=47% logpool=38% rpool=78%

Reviews (2)
Good script, it's just I believe that free space should be monitored using something like "zfs list" because "zpool list" always shows more that actually available.
Right now zpool list says following on my system:
NAME SIZE ALLOC FREE
pool0 5.33T 4.27T 1.06T
But "zfs list" shows less:
NAME USED AVAIL
pool0 4.76T 494G
byxrated, January 4, 2014
The script itself works, there was only an exception on FreeBSD where no which cmd is available in bash. I completely rewrote the script to add warning/critical with free space in G. Nagios Exit Parameters were not defined, added also some additional checks for arguments. When warn/crit was not specified it will just look if the pool is ONLINE.

http://pastebin.com/j6AvtKPk
Owner's reply

Hello, the "which" command does exist in FreeBSD, too. However you're right about the fixed thresholds, I should remove them.