Notifications and Event Handlers
Posted: Thu Aug 30, 2012 7:06 pm
Hi All,
I just want to confirm I am doing this properly. I am configuring Nagios with the plugins and NRPE on other nodes to do the following:
Monitor services, sent notifications and kick off scripts to repair or process the recovery.
I have the services monitoring set up for 2 (localhost and a remotehost), and notifications work properly for those services (To change the frequency, I change that in the definition of the host template I made for the box or override that in the settings made when actually configuring a host?) but to do some sort of event kick off, I currently have an event handler set up as an email script that I made
define command{
command_name email_me
command_line /usr/bin/printf "%b" " **THIS IS AN EMAIL IN RESPONSE TO A SCRIPT KICKED OFF \n\nNotification Type: $NOTIFICATIONTYPE$ Some script has been kicked off \nHost: $HOSTNAME$ To tell you that a script has been run\nState: $HOSTSTATE$ And I hope this works\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" [email protected]
}
^and that works for only a few services, but I have it in each of the define services I have set up for that box, but only a few come through...my understanding is that anything triggered will set off an event handler for anything returned back?
Also, how do I set it up so it runs some external script I have (some .sh) file or what not instead of one from Nagios?
Thanks
I just want to confirm I am doing this properly. I am configuring Nagios with the plugins and NRPE on other nodes to do the following:
Monitor services, sent notifications and kick off scripts to repair or process the recovery.
I have the services monitoring set up for 2 (localhost and a remotehost), and notifications work properly for those services (To change the frequency, I change that in the definition of the host template I made for the box or override that in the settings made when actually configuring a host?) but to do some sort of event kick off, I currently have an event handler set up as an email script that I made
define command{
command_name email_me
command_line /usr/bin/printf "%b" " **THIS IS AN EMAIL IN RESPONSE TO A SCRIPT KICKED OFF \n\nNotification Type: $NOTIFICATIONTYPE$ Some script has been kicked off \nHost: $HOSTNAME$ To tell you that a script has been run\nState: $HOSTSTATE$ And I hope this works\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" [email protected]
}
^and that works for only a few services, but I have it in each of the define services I have set up for that box, but only a few come through...my understanding is that anything triggered will set off an event handler for anything returned back?
Also, how do I set it up so it runs some external script I have (some .sh) file or what not instead of one from Nagios?
Thanks