Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

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.

share|improve this answer
Looks great. I'll give it a try before marking this question as answered. Thanks! –  andyhky Aug 26 '09 at 14:52
Those 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. –  unixbhaskar Jul 27 '11 at 9:58
To 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 –  mogsie Aug 8 '12 at 6:58
add comment

For such use, you may edit your nagios services file, and disable checks of all services on this host, like what you did in the web interface, and that require the modification of some options.
Let's take an example If you need to disable checks for DNS service in machine nibiru, disable the active/passive checks like the following.

define service{
    host_name               nibiru
    service_description     DNS
    active_checks_enabled   0  ; set value to 0
    passive_checks_enabled  0  ; set value to 0

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.