| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# REDUNDANCY EVENT HANDLER SCRIPT |
| 4 |
# Written By: Ethan Galstad ([email protected]) |
| 5 |
# Last Modified: 05-30-2006 |
| 6 |
# |
| 7 |
# This is an example script for implementing redundancy. |
| 8 |
# Read the HTML documentation on redundant monitoring for more |
| 9 |
# information on what this does. |
| 10 |
|
| 11 |
# Location of the echo and mail commands |
| 12 |
echocmd="/bin/echo" |
| 13 |
mailcmd="/bin/mail" |
| 14 |
|
| 15 |
# Location of the event handlers |
| 16 |
eventhandlerdir="/usr/local/nagios/libexec/eventhandlers" |
| 17 |
|
| 18 |
|
| 19 |
# Only take action on hard service states... |
| 20 |
case "$2" in |
| 21 |
HARD) |
| 22 |
|
| 23 |
case "$1" in |
| 24 |
CRITICAL) |
| 25 |
|
| 26 |
# The master Nagios process is not running! |
| 27 |
# We should now become the master host and |
| 28 |
# take over the responsibility of monitoring |
| 29 |
# the network, so enable active checks... |
| 30 |
|
| 31 |
`$eventhandlerdir/enable_active_service_checks` |
| 32 |
;; |
| 33 |
|
| 34 |
WARNING|UNKNOWN) |
| 35 |
|
| 36 |
# The master Nagios process may or may not |
| 37 |
# be running.. We won't do anything here, but |
| 38 |
# to be on the safe side you may decide you |
| 39 |
# want the slave host to become the master in |
| 40 |
# these situations... |
| 41 |
;; |
| 42 |
|
| 43 |
OK) |
| 44 |
|
| 45 |
# The master Nagios process running again! |
| 46 |
# We should go back to being the slave host, |
| 47 |
# so disable active checks |
| 48 |
|
| 49 |
`eventhandlerdir/disable_active_service_checks` |
| 50 |
;; |
| 51 |
|
| 52 |
esac |
| 53 |
;; |
| 54 |
|
| 55 |
esac |
| 56 |
exit 0 |
| 57 |
|
| 58 |
|