Page 1 of 1

Globally Disable/Enable Notifications From The Command Line

Posted: Mon Apr 11, 2016 2:00 pm
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

Re: Globally Disable/Enable Notifications From The Command L

Posted: Mon Apr 11, 2016 4:07 pm
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"

Re: Globally Disable/Enable Notifications From The Command L

Posted: Thu Apr 14, 2016 9:14 am
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>

Re: Globally Disable/Enable Notifications From The Command L

Posted: Thu Apr 14, 2016 10:17 am
by tgriep
Sorry, I posted them backwards. The cmd_typ=11 disables the notification and cmd_typ=12 enables notifications.

Re: Globally Disable/Enable Notifications From The Command L

Posted: Thu Apr 14, 2016 4:15 pm
by gormank
Is there a list of cmd_typ value and action pairs?

Re: Globally Disable/Enable Notifications From The Command L

Posted: Thu Apr 14, 2016 4:33 pm
by tgriep