Nagios/checks/solaris zpools

Add Service
this will add a new service check to all hosts in the "zpool" 'hostgroup'

add this to the local services folder on the Nagios server '/opt/nagios/etc/local/services'

define service { service_description    zfs_zpool display_name           ZFS pool Health check_command          check_nrpe!check_zpools use                    generic-service hostgroup_name         zfs_disk }
 * 1) cat zfs_zpool.cfg

Define the zfs hostgroup
this goes on the server in the local host groups folder '/opt/nagios/etc/global/hostgroups' define hostgroup { hostgroup_name zfs_disk alias          ZFS Disks }
 * 1) cat zfs_disk.cfg

Define a host-template
cat zfs.cfg define host{ name           zfs hostgroups     +zfs_disk register       0 }

Add check to host
define host { use            zfs,solaris,telehouse host_name      server01 address        192.168.100.100 parents }

Check config
/opt/nagios/bin/nagios -v /opt/nagios/etc/nagios.cfg '

NRPE Command defanition
Add this to the client in the commands folder '/opt/nagios/nrpe/nrpe-commands"

command[check_zpools]=/opt/nagios/plugins/libexec/check_zpools
 * 1) cat zfs.cfg

add the check script to plugins folder

'/opt/nagios/plugins/libexec/'

then make it exacutable

chmod u+x /opt/nagios/plugins/libexec/check_zpools

and a quick `chown -R nagios:nagios /opt/nagios` never did any harm

then restart nrpe '/etc/init.d/nrpe restart'

Check script [check_zpools]
# # # exit_code=0 exit_text="" POOLS=`/usr/sbin/zpool list -Ho name` if [ $1 ] then THRESHOLD=$1 else THRESHOLD=90 fi errors_checker{ if [ ${exit_text} ] then if [ $2 -gt ${THRESHOLD} -o $3 != "ONLINE" ] then exit_code=2 exit_text=${exit_text}" NOK:$1:$2%:$3" else exit_text=${exit_text}" OK:$1:$2%:$3" fi else if [ $2 -gt ${THRESHOLD} -o $3 != "ONLINE" ] then exit_code=2 exit_text="NOK:$1:$2%:$3" else exit_text="OK:$1:$2%:$3" fi fi } for POOL in `echo ${POOLS}` do 	CAPACITY=`/usr/sbin/zpool list -Ho capacity ${POOL}|cut -d"%" -f1` HEALTH=`/usr/sbin/zpool list -Ho health ${POOL}` errors_checker ${POOL} ${CAPACITY} ${HEALTH} done echo ${exit_text} exit ${exit_code}
 * 1) !/bin/sh
 * 1) By Aldo Fabi 01-09-2006
 * 2) LTP: 04-10-2006
 * 1) Nagios solaris 10 zpools Checker
 * 1) Begin vars
 * 1) End vars

Catorgery:Nagios