Nagios: Disable notifications from command line

With the commands below, Nagios can be controlled in command line mode. It’s helpful for your automation 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.

The parameter of posted data can be assembled — look at what links are being used in your web browser.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.