Nagios: Disable notifications from command line on Windows/Linux

Our routine maintenance requires services have to be brought down.

The problem is these services have Nagios checks and we either have to go to the web interface and disable the check or get the emails.

Is there a way from command line on a Windows and/or Linux guest to disable the Nagios check (or notifications) and enable it? Ideally this would happen on the machine we are performing the maintenance on, not the Nagios server itself.

I would like to disable notifications/checks pre-maintenance and re-enable them post maintenance.


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.


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