I would like Nagios to execute a Bash command/script when it detects a host down or up. This would allow me to react to down hosts to some degree which would be very interesting.
How would I do this ?
I would like Nagios to execute a Bash command/script when it detects a host down or up. This would allow me to react to down hosts to some degree which would be very interesting.
How would I do this ?
Event handlers are your friends: http://nagios.sourceforge.net/docs/3_0/eventhandlers.html.
into your commands file add the command you need
into your service defination
}
the arguments that you receive into your script are the ones defined into the command file, you can see them as well by doing echo $@ into your script - is important to know the host address in case that you will call against a remote host and the service state (you take different actions on CRITICAL, OK or WARNING)
i suggest you have some logging into your script at least at the beginning.