====== Send result to nagios nsca acceptor ====== It is not done yet there is lot to improve next weekend .... :-P #!/bin/bash # Configuration file for send_nsca # Please update location accordingly. CFG="/etc/nagios/send_nsca.cfg" #First Service Check PRG_cl="-w 5.0,4.0,3.0 -c 10.0,6.0,4.0" Result_cl=`/usr/lib/nagios/plugins/check_load $PRG_cl` if `echo ${Result_cl} | grep "OK" 1>/dev/null 2>&1` then STA_cl=0 elif `echo ${Result_cl} | grep "WARNING" 1>/dev/null 2>&1` then STA_cl=1 else STA_cl=2 fi CMD_cl="desk;Current Load;$STA_cl;$Result_cl" #Second Service Check PRG_cu="-w 5 -c 10" Result_cu=`/usr/lib/nagios/plugins/check_users $PRG_cu` if `echo ${Result_cu} | grep "OK" 1>/dev/null 2>&1` then STA_cu=0 elif `echo ${Result_cu} | grep "WARNING" 1>/dev/null 2>&1` then STA_cu=1 else STA_cu=2 fi CMD_cu="desk;Current Users;$STA_cu;$Result_cu" #Third Service Check PRG_du="-w 20% -c 10% -p /home" Result_du=`/usr/lib/nagios/plugins/check_disk $PRG_du` if `echo ${Result_du} | grep "OK" 1>/dev/null 2>&1` then STA_du=0 elif `echo ${Result_du} | grep "WARNING" 1>/dev/null 2>&1` then STA_du=1 else STA_du=2 fi CMD_du="desk;Home Partition;$STA_du;$Result_du" /bin/echo $CMD_cl | send_nsca -H 192.168.1.4 -d ';' -c $CFG /bin/echo $CMD_cu | send_nsca -H 192.168.1.4 -d ';' -c $CFG /bin/echo $CMD_du | send_nsca -H 192.168.1.4 -d ';' -c $CFG