Recently we've been experiencing a lot of spam hitting our servers causing apache
to topple over. To tackle this we've installed nagios
to notify us/run some restart commands if the issue arises. Notifications function fine, but the restart scripts just wont kick in. We've taken the following steps:
- Created our restart script located:
/usr/share/nagios3/plugins/eventhandlers/restart_apache
- Tested and ran via
./restart_apache CRITICAL SOFT 3
- can confirm the script works - Defined the command:
/etc/nagios3/commands.cfg
define command{ command_name restart-apache command_line /usr/local/nagios/libexec/eventhandlers/restart_apache $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ }
- Applied the command to fire when current load notifications run:
/etc/nagios3/conf.d/localhost_nagios2.cfg
define service{ use generic-service ; Name of service template to use host_name localhost service_description Current Load check_command check_load!5.0!4.0!3.0!10.0!6.0!4.0 event_handler restart-apache }
- We've set the script to write to a text file when performing a restart, but nothing is happening (and apache stays down) - so something is not right. Any direction is much appreciated!Thanks