#!/bin/bash
SERVICESTATE=$1
SERVICESTATETYPE=$2
if [$SERVICESTATETYPE == 'SOFT']
then exit
fi
case "$SERVICESTATE" in
OK)
exit 0
;;
WARNING)
net rpc service stop SERVICENAME -I IPADDRESS -U USERNAME%PASSWORD
net rpc service start SERVICENAME -I IPADDRESS -U USERNAME%PASSWORD
;;
CRITCAL)
net rpc service stop SERVICENAME -I IPADDRESS -U USERNAME%PASSWORD
net rpc service start SERVICENAME -I IPADDRESS -U USERNAME%PASSWORD
;;
UNKNOWN)
net rpc service stop SERVICENAME -I IPADDRESS -U USERNAME%PASSWORD
net rpc service start SERVICENAME -I IPADDRESS -U USERNAME%PASSWORD
;;
esac
But my problem is that this script is not running when Nagios detect failure service.
Command Management:
Service Management:
Log(How You can see notification is send properly but event is not trigger):
Lets enable event handler logging, if it is not already enabled. Edit /usr/local/nagios/etc/nagios.conf
Add or edit the log_event_handlers line so that it reads:
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
abrist wrote:Lets enable event handler logging, if it is not already enabled. Edit /usr/local/nagios/etc/nagios.conf
Add or edit the log_event_handlers line so that it reads:
abrist wrote:
Are you sure the script is not running? You may want to add an echo-to-file to the top of the script so that you know for sure if it ran or not:
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.