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