| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# Write a command to the Nagios command file to cause |
| 4 |
# it to disable host and service notifications |
| 5 |
|
| 6 |
# Notes: |
| 7 |
# 1) This script is not intended to be used as an |
| 8 |
# event handler by itself. Instead, it is used by other |
| 9 |
# event handler scripts (like the redundancy examples). |
| 10 |
# 2) In order for Nagios to process any commands that |
| 11 |
# are written to the command file, you must enable |
| 12 |
# the check_external_commands option in the main |
| 13 |
# configuration file. |
| 14 |
|
| 15 |
printfcmd="/usr/bin/printf" |
| 16 |
|
| 17 |
CommandFile="/usr/local/nagios/var/rw/nagios.cmd" |
| 18 |
|
| 19 |
# get the current date/time in seconds since UNIX epoch |
| 20 |
datetime=`date +%s` |
| 21 |
|
| 22 |
# pipe the command to the command file |
| 23 |
`$printfcmd "[%i] DISABLE_NOTIFICATIONS;%i\n" $datetime $datetime >> $CommandFile` |
| 24 |
|