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.

Ok, so I've spent a bunch of time on this and I can not seem to get it working in my environment.

I have a Nagios 3.3.1 server with NConf 1.3. All works well and I'm pretty happy.

However, I have a need to schedule host downtime, for various reasons, daily or weekly and wanted to create and cron to handle this.

Easy enough right? I found the following script (customized slightly) and I have been unable to get it to successfully schedule downtime for a host.

http://pastebin.com/MLdebCfR

I'll show an example of the command line to run this script:

./nagios_host_downtime.sh hostname '20120417 06:30:00' '20120417 08:30:00' 120 nagiosadmin test

In the log file - /usr/local/nagios/var/nagios.log - I see:

[1334609909] EXTERNAL COMMAND: SCHEDULE_HOST_DOWNTIME;hostname;1334665800;1334553600;0;0;nagiosadmin;test;

However, in the Downtime section of the web console I never see an entry and will still receive alerts during the downtime.

Any one have any thoughts? I might just be screwing up something simple, but I've waste a good amount of time with no joy and just need this to work.

share|improve this question
    
FYI, there are some serious perfdata-related bugs in 3.3.1. You should consider using 3.2.3 instead. (You tagged this 'ubuntu'... Why aren't you using the packaged nagios?) –  Keith Apr 17 '12 at 15:07

1 Answer 1

up vote 1 down vote accepted

SCHEDULE_HOST_DOWNTIME;hostname;1334665800;1334553600;0;0;nagiosadmin;test;

SCHEDULE_HOST_DOWNTIME;host_name;start_time;end_time;fixed;trigger_id;duration;author;comment

You´re missing duration

--

I just tested

SCHEDULE_HOST_DOWNTIME;host;1334699660;1334699720;1;0;;icingaadmin;comment

SCHEDULE_HOST_DOWNTIME;host;1334699760;1334699920;0;0;120;icingaadmin;comment

What works as expected.

This host has been scheduled for fixed downtime from 17-04-2012 23:54:20 to 17-04-2012 23:55:20. Notifications for the host will not be sent out during that time period.

This host has been scheduled for flexible downtime starting between 17-04-2012 23:56:00 and 17-04-2012 23:58:40 and lasting for a period of 0 hours and 2 minutes. Notifications for the host will not be sent out during that time period.

share|improve this answer
    
> Ugh, I have been fiddling with the script too much. I have completed a few fixes and I am still unable to see the downtime in the web console. > The following is the command line: > ./nagios_host_downtime.sh idsprodsql02 '20120417 06:30:00' '20120417 08:30:00' nagiosadmin test > The following is in the log: > [1334637260] EXTERNAL COMMAND: SCHEDULE_HOST_DOWNTIME;idsprodsql02;1334658600;1334665800;1;0;;nagiosadmin;test > Yet I still do not have an entry in the log file. > Thanks for helping me through this. –  imthefirestartr Apr 17 '12 at 4:54
1  
Then it should work... Make sure external commands are allowed check_external_commands=1 (but when they are in the log i assume they've been read), bypass the ./nagios_host_downtime.sh with a direct echo "[1234] HOST.." >> PATH/nagios.cmd, try submitting a passive check/restart and see what happens, and check debug_level && debug_file –  Tabakhase Apr 17 '12 at 10:08

Your Answer

 
discard

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.