Disable notifications after a restore

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
paulconca
Posts: 31
Joined: Tue Jan 16, 2018 7:05 am

Disable notifications after a restore

Post by paulconca »

Hi All,

We do a weekly back up from our primary and restore it on our Secondary using a script

To disable the notifications we edit the configs as below, it seems to be the only way to guarantee no emails are sent.
sed -i 's/ host_notifications_enabled 1/ host_notifications_enabled 0/g' /usr/local/nagios/etc/contacts.cfg
sed -i 's/ service_notifications_enabled 1/ service_notifications_enabled 0/g' /usr/local/nagios/etc/nagios.cfg

This works fine until the configuration is applied on the UI, as the above options are still all enabled in the UI.
We use the Secondary for testing so we need to apply the configuration.

Is there a way to disable the notifications and individual user notifications in the UI via command line, as we are using scripts to do the restores?

Thank you
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Disable notifications after a restore

Post by benjaminsmith »

Hi,

Good question. The Nagios External Commands would be best in this situation. There are a few options, but running the following bash script will disable all 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   
For more command options and examples, take a look at the following reference.
Nagios Core External Commands

Let me know if that will work for you.
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!
Locked