Content added Content deleted
imported>DrOwl (New page: ==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' #...) |
imported>mutante |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
Nav: [[Nagios]]/[[Nagios/checks|checks]]/solaris zpools |
|||
==Add Service== |
==Add Service== |
||
Line 114: | Line 114: | ||
errors_checker(){ |
errors_checker(){ |
||
if [ ${exit_text} ] |
if [ "${exit_text}" ] |
||
then |
then |
||
if [ $2 -gt ${THRESHOLD} -o $3 != "ONLINE" ] |
if [ $2 -gt ${THRESHOLD} -o $3 != "ONLINE" ] |
||
Line 145: | Line 145: | ||
[[ |
[[Category:Nagios]] |
Latest revision as of 19:13, 25 May 2009
Nav: Nagios/checks/solaris zpools
Add Service[edit]
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'
#cat zfs_zpool.cfg define service { service_description zfs_zpool display_name ZFS pool Health check_command check_nrpe!check_zpools use generic-service hostgroup_name zfs_disk }
Define the zfs hostgroup[edit]
this goes on the server in the local host groups folder '/opt/nagios/etc/global/hostgroups'
#cat zfs_disk.cfg define hostgroup { hostgroup_name zfs_disk alias ZFS Disks }
Define a host-template[edit]
cat zfs.cfg define host{ name zfs hostgroups +zfs_disk register 0 }
Add check to host[edit]
define host { use zfs,solaris,telehouse host_name server01 address 192.168.100.100 parents }
Check config[edit]
/opt/nagios/bin/nagios -v /opt/nagios/etc/nagios.cfg '
NRPE Command defanition[edit]
Add this to the client in the commands folder '/opt/nagios/nrpe/nrpe-commands"
#cat zfs.cfg command[check_zpools]=/opt/nagios/plugins/libexec/check_zpools
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][edit]
#!/bin/sh # # By Aldo Fabi 01-09-2006 # LTP: 04-10-2006 # # Nagios solaris 10 zpools Checker # ### Begin vars exit_code=0 exit_text="" ### End vars 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}