Monday, April 04, 2016

Nagios - Disable Service Notification from Command Line

Sometimes when you doing some routine maintenance you want to just disable a service notification globally. From Nagios webUI I did not find a way of disabling a single service notification globally. So I dig a bit and came up with the following commands. It is handy with the bash "for" loop if you have hundreds of servers, or you can do it through fabric python script to use "Roles".

To disable a service notifcation:
curl -d "cmd_typ=23&cmd_mod=2&host=[HOST]&service=[SERVICE]&btnSubmit=Commit" "http://[SERVER]/nagios/cgi-bin/cmd.cgi" -u "USERNAME:PASSWORD"

To re-enable the service notification:
curl -d "cmd_typ=22&cmd_mod=2&host=[HOST]&service=[SERVICE]&btnSubmit=Commit" "http://[SERVER]/nagios/cgi-bin/cmd.cgi" -u "USERNAME:PASSWORD"

1 comment:

kalalharshal said...

is it work?