Linux – Nagios Host Downtime Scheduling

linuxnagiosscheduled-taskUbuntu

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.

Best Answer

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.

Related Topic