NagiosEventHandles

From T2B Wiki
Jump to navigation Jump to search

Nagios Event Handlers implementation at IIHE

An example

  • The example described here is to restart the dcap service on maite in case is stops. This is somewhat a complex case since it will trigger the restart of dcap over ssh from a script on egon
  • Make sure event handlers are enabled
enable_event_handlers=1
  • Add this line in the service config file eg. objects/services.cfg in the check_dccp nagios check
event_handler		        handler_restartdcap
  • And define the event handler command
define command{
	command_name	handler_restartdcap
	command_line	/usr/lib64/nagios/plugins/handler_restartdcap $SERVICESTATE$ $SERVICESTATETYPE$ '$SERVICEOUTPUT$'
	}
  • This script on egon will be executed when the check_dccp on m0 goes into critical state
  • Remark: the quotes around serviceoutput are there so that the whole output is sent to the script. When they are not there the output is truncated after the first space


Template:TracNotice