nagios4/contrib/eventhandlers/enable_notifications

28 lines
760 B
Plaintext
Raw Permalink Normal View History

2017-05-19 22:22:40 +02:00
#!/bin/sh
# Write a command to the Nagios command file to cause
# it to enable host and service notifications
# Notes:
# 1) This script is not intended to be used as an
# event handler by itself. Instead, it is used by other
# event handler scripts (like the redundancy examples).
# 2) In order for Nagios to process any commands that
# are written to the command file, you must enable
# the check_external_commands option in the main
# configuration file.
printfcmd="/usr/bin/printf"
CommandFile="/usr/local/nagios/var/rw/nagios.cmd"
# get the current date/time in seconds since UNIX epoch
datetime=`date +%s`
# pipe the command to the command file
`$printfcmd "[%i] ENABLE_NOTIFICATIONS;%i\n" $datetime $datetime >> $CommandFile`