Nagios: Disable notifications from command line on Windows/Linux
Solution 1
Assuming that the guest can reach the web interface, the following command lines should work:
To disable notifications
curl -d "cmd_typ=23&cmd_mod=2&host=[THE HOST]&service=[THE SERVICE]&btnSubmit=Commit" "http://[[NAGIOS SERVER]/nagios/cgi-bin/cmd.cgi"
To enable notifications
curl -d "cmd_typ=22&cmd_mod=2&host=[THE HOST]&service=[THE SERVICE]&btnSubmit=Commit" "http://[[NAGIOS SERVER]/nagios/cgi-bin/cmd.cgi"
Depending on your setup, you may also need to use the --insecure or --user options of curl.
And IIRC, the cmd_type number is different for service and host groups -- look at what links are being used in your web browser.
Solution 2
Yo can Enable/Disable host notification with nagios.cmd command
e.g:
Disable all notification for my-host
now=`date +%s`
#Check first path nagios.cmd & printf
commandfile='/var/lib/nagios3/rw/nagios.cmd'
/usr/bin/printf "[%lu] DISABLE_HOST_NOTIFICATIONS;my-host\n" $now > $commandfile
Enable all notification for my-host
now=`date +%s`
#Check first path nagios.cmd & printf
commandfile='/var/lib/nagios3/rw/nagios.cmd'
/usr/bin/printf "[%lu] ENABLE_HOST_NOTIFICATIONS;my-host\n" $now > $commandfile
You can also check this url Nagios Notification command
Related videos on Youtube
cssnoob
Updated on September 17, 2022Comments
-
cssnoob almost 2 years
I've been using Joomla 1.6 locally on my computer. Everything's been working fine. I uploaded the web files to the company's server and all of a sudden I'm getting the following error:
Fatal error: Call to undefined function simplexml_load_file() in...
I've checked several online communities and some people are saying that simplexml should be enabled. I checked phpinfo.php and simplexml seems to be enabled on my computer; while it is disabled on the company server.
I don't have the privileges to enable this on the company server, so I was wondering if it will be possible for me to use php.ini to enable simplexml?
-
andyhky almost 15 yearsLooks great. I'll give it a try before marking this question as answered. Thanks!
-
cssnoob about 13 yearsThanks for your reply. I have asked the server admin to enable it; but he takes forever to get something done so that's why I asked if I would be able to enable it through php.ini. I guess I'm just looking for an alternative method rather than having to wait for this guy to act.
-
unixbhaskar almost 13 yearsThose command work well for service/host notification enable/disable purpose. But could you please suggest how could I achieve scheduled host downtime by this kind of script? Because the downtime option takes more argument.Please suggest.
-
mogsie almost 12 yearsTo schedule downtime, again, follow Matt's advice: "Look at what links are being used in your browser" — Look at the HTML form and just emulate that. For "downtime for host and all services" additional parameters are
cmd_typ=86
,cmd_mod=2
,com_data=your comment
,trigger=0
,start_time=2012-01-02 22:33:00
,end_time=2012......
,fixed=1
,hours=0
,minutes=0
-
Ben over 9 yearsThe
cmd_typ
codes can be found here: docs.icinga.org/latest/en/cgiparams.html. Do not use the docs located at old.icinga.org (even though most of the posts will list those ones!) -
Ben over 9 yearsThe link is for the old docs, make sure to use docs.icinga.org/latest/en/cgiparams.html instead.