Scheduled job to enable all notifications

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
gmackey
Posts: 35
Joined: Wed Mar 22, 2017 1:13 pm
Location: Edmond, OK
Contact:

Scheduled job to enable all notifications

Post 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!
Last edited by gmackey on Fri Sep 13, 2019 10:17 am, edited 1 time in total.
=================================================
Nagios XI 5.6.5 Enterprise
CentOS 6.10 (64-bit) VMware image
SSL implemented and forced, with exception for localhost
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Scheduled job to enable all notifications

Post 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    
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
gmackey
Posts: 35
Joined: Wed Mar 22, 2017 1:13 pm
Location: Edmond, OK
Contact:

Re: Scheduled job to enable all notifications

Post 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.
=================================================
Nagios XI 5.6.5 Enterprise
CentOS 6.10 (64-bit) VMware image
SSL implemented and forced, with exception for localhost
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Scheduled job to enable all notifications

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked