Page 1 of 1
NXI 5.7.3 disable notifications and active service checks
Posted: Fri Mar 05, 2021 12:05 pm
by gormank
Hi,
As part of redoing of a cheap DR solution I restore the primary backup to the failover host. This enables notifications and checks on the 02 host.
I need to globally disable notifications and active service checks via the shell on the failover. I assume these are in one of the xi_* tables but I haven't found it yet.
Can you give me a pointer to where these are set?
Re: NXI 5.7.3 disable notifications and active service check
Posted: Fri Mar 05, 2021 12:13 pm
by dchurch
Do you mean you want to disable all notifications for all hosts/services in XI? Or just for one host?
If the former, you could just shut down the monitoring engine, otherwise
Nagios XI has an API that can do it:
Code: Select all
curl -XPOST "http://192.168.5.xx/nagiosxi/api/v1/system/corecommand?apikey=API_KEY" -d "cmd=DISABLE_NOTIFICATIONS"
For one host only:
Code: Select all
curl -XPOST "http://192.168.5.xx/nagiosxi/api/v1/system/corecommand?apikey=API_KEY" -d "cmd=DISABLE_HOST_NOTIFICATIONS;<my_host_name>"
Your API key can be found in your profile (click your user name top right corner of screen).
There are
lots of external commands that you might find interesting.
Re: NXI 5.7.3 disable notifications and active service check
Posted: Fri Mar 05, 2021 12:33 pm
by gormank
ALL notifications and ALL service checks.
The solution provided for setting the program URL was
mysql -h 127.0.0.1 -uroot -pnagiosxi nagiosxi -e "update xi_options set value = 'hostname/nagiosxi/' where name = 'url';"
And I'd prefer a similar direct to the DB solution for this rather than using the API.
Re: NXI 5.7.3 disable notifications and active service check
Posted: Fri Mar 05, 2021 6:20 pm
by dchurch
If you're set on using the command line, then command should stop all service and host checks and pause all notifications.
Re: NXI 5.7.3 disable notifications and active service check
Posted: Fri Mar 05, 2021 6:47 pm
by gormank
I'm trying to disable the notifications and active checks much the same as I updated the program URL as shown above by updating the correct rows in a table. Please provide the table and row names the values are stored in. If you don't have the information, please go through your process of escalation or research the issue to provide a meaningful answer. Stopping the nagios service will cause an alert on the primary so it isn't a realistic solution.
Thanks
Re: NXI 5.7.3 disable notifications and active service check
Posted: Fri Mar 05, 2021 7:00 pm
by gormank
Since it does take a few seconds to actually apply the change maybe it isn't as simple as updating a table. If there isn't another way to do it, feel free to disallow my previous reply and close.
Re: NXI 5.7.3 disable notifications and active service check
Posted: Mon Mar 08, 2021 1:31 pm
by dchurch
The program responsible for sending the notifications is that running Nagios Core program, sometimes called the Monitoring Engine. The command to disable notifications has to be sent to the running instance of the program. Anything you do to the database won't affect whether Nagios Core disables notifications.
The curl API call I put above really is the simplest way to do this.
It's possible also to disable notifications using the Host Detail page under Advanced. This also sends the appropriate command to Nagios Core.