Page 1 of 1

Scheduled job to enable all notifications

Posted: Tue Sep 10, 2019 9:48 am
by gmackey
I would like to provide more of our Nagios XI users access to acknowledge alerts, but with that access comes the ability to disable notifications. Rather than implement a custom Javascript to remove that option entirely, I'd like to allow them to use that feature for short-term use with the understanding that all notifications will be enabled again at a specified time each night. What would be the best way to schedule a job to enable all disabled notifications for every host and service every night? Thanks!

Re: Scheduled job to enable all notifications

Posted: Tue Sep 10, 2019 12:50 pm
by benjaminsmith
Hell @gmackey,

This could be accomplished by using the Nagios Core external commands. You would need to schedule these as a cron job running every night at a specified time.

Example: Disable Notifications

Code: Select all

#!/bin/sh
# This is a sample shell script showing how you can submit the DISABLE_NOTIFICATIONS command
# to Nagios. Adjust variables to fit your environment as necessary.

now=`date +%s`
commandfile='/usr/local/nagios/var/rw/nagios.cmd'

/bin/printf "[%lu] DISABLE_NOTIFICATIONS\n" $now > $commandfile  
Example: Enable Notifications

Code: Select all

#!/bin/sh
# This is a sample shell script showing how you can submit the ENABLE_NOTIFICATIONS command
# to Nagios. Adjust variables to fit your environment as necessary.

now=`date +%s`
commandfile='/usr/local/nagios/var/rw/nagios.cmd'

/bin/printf "[%lu] ENABLE_NOTIFICATIONS\n" $now > $commandfile    

Re: Scheduled job to enable all notifications

Posted: Fri Sep 13, 2019 10:16 am
by gmackey
Thank you, Benjamin! I will set this up when I get a chance to work on it. Please feel free to lock the thread.

Re: Scheduled job to enable all notifications

Posted: Fri Sep 13, 2019 11:17 am
by scottwilkerson
gmackey wrote:Thank you, Benjamin! I will set this up when I get a chance to work on it. Please feel free to lock the thread.
Great!

Locking