Globally Disable/Enable Notifications From The Command Line

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
EnvBroker1
Posts: 65
Joined: Thu Oct 31, 2013 11:50 am

Globally Disable/Enable Notifications From The Command Line

Post by EnvBroker1 »

Looking for two things specifically, through the command line and not the GUI.

1) Is there a command we can run from the command line to "Globally" turn on and off all the notifications? This would be the equivalent of going to the "Monitoring Engine Status" page and clicking "Disable" next to the "Notifications" line.

2) Does anyone know what file and where it is, that contains the variable for having the notifications enabled or disabled?

Our assumption is, there is a variable somewhere that when it's set to 0 notifications are off and when it's set to 1 notifications are on. So that's what we're looking for.

Thanks

We are using Nagios XI 5.2.5 on CentOS 6.7
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Globally Disable/Enable Notifications From The Command L

Post by tgriep »

Replace xxx.xxx.xxx.xxx and the username and password with your server's IP and a administrator user account below.
Enable Notifications run this.

Code: Select all

curl -d "cmd_mod=2&cmd_typ=11" "http://xxx.xxx.xxx.xxx/nagios/cgi-bin/cmd.cgi" -u "username:password"
Disable Notifications run this.

Code: Select all

curl -d "cmd_mod=2&cmd_typ=12" "http://xxx.xxx.xxx.xxx/nagios/cgi-bin/cmd.cgi" -u "username:password"
Be sure to check out our Knowledgebase for helpful articles and solutions!
EnvBroker1
Posts: 65
Joined: Thu Oct 31, 2013 11:50 am

Re: Globally Disable/Enable Notifications From The Command L

Post by EnvBroker1 »

Ran the command and it gave every indication that it was working, but it didn't change the notifications between the on and off states. This is what we saw on our machine. We even did a reboot afterwards, just in case that was needed. What did we miss?

Code: Select all

# curl -d "cmd_mod=2&cmd_typ=11" "http://Server IP/nagios/cgi-bin/cmd.cgi" -u "Username:password"
<html>
<head>
<link rel="shortcut icon" href="/nagios/images/favicon.ico" type="image/ico">
<title>
External Command Interface
</title>
<LINK REL='stylesheet' TYPE='text/css' HREF='/nagios/stylesheets/common.css'>
<LINK REL='stylesheet' TYPE='text/css' HREF='/nagios/stylesheets/cmd.css'>
</head>
<body CLASS='cmd'>

<!-- Produced by Nagios (https://www.nagios.org).  Copyright (c) 1999-2007 Ethan Galstad. -->
<table border=0 width=100%>
<tr>
<td align=left valign=top width=33%>
<TABLE CLASS='infoBox' BORDER=1 CELLSPACING=0 CELLPADDING=0>
<TR><TD CLASS='infoBox'>
<DIV CLASS='infoBoxTitle'>External Command Interface</DIV>
Last Updated: Tue Apr 12 09:11:02 PDT 2016<BR>
Nagios® Core™ 4.1.1 - <A HREF='https://www.nagios.org' TARGET='_new' CLASS='homepageURL'>www.nagios.org</A><BR>
Logged in as <i>nagiosadmin</i><BR>
<DIV CLASS='infoBoxBadProcStatus'>- Notifications are disabled</DIV><DIV CLASS='infoBoxBadProcStatus'>- Service checks are disabled</DIV></TD></TR>
</TABLE>
</td>
<td align=center valign=top width=33%>
</td>
<td align=right valign=bottom width=33%>
</td>
</tr>
</table>
<P><DIV CLASS='infoMessage'>Your command request was successfully submitted to Nagios for processing.<BR><BR>
Note: It may take a while before the command is actually processed.<BR><BR>
<A HREF='javascript:window.history.go(-2)'>Done</A></DIV></P>
<!-- Produced by Nagios (https://www.nagios.org).  Copyright (c) 1999-2007 Ethan Galstad. -->
</body>
</html>
Last edited by tmcdonald on Thu Apr 14, 2016 9:35 am, edited 1 time in total.
Reason: Please use [code][/code] tags around long output
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Globally Disable/Enable Notifications From The Command L

Post by tgriep »

Sorry, I posted them backwards. The cmd_typ=11 disables the notification and cmd_typ=12 enables notifications.
Be sure to check out our Knowledgebase for helpful articles and solutions!
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Globally Disable/Enable Notifications From The Command L

Post by gormank »

Is there a list of cmd_typ value and action pairs?
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Globally Disable/Enable Notifications From The Command L

Post by tgriep »

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked