Maintenace Downtime

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
tgfde
Posts: 233
Joined: Thu May 12, 2011 7:55 am

Re: Maintenace Downtime

Post by tgfde »

Doe anyone know how to get this work?

I want to be able to schedule host downtime from an external script when a website goes down via script.

Thanks.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Maintenace Downtime

Post by scottwilkerson »

In the example we gave you, you need to modify the start and end parameters to the unix timestamp you want it to start and end.. The command you ran scheduled downtime in the past...

Here is a different example, showing how to make it start immediately and last 60 minutes

Code: Select all

#!/bin/sh

now=`date +%s`
dtCommand=SCHEDULE_HOST_DOWNTIME
pipe='/usr/local/nagios/var/rw/nagios.cmd'
duration=3600 #60 minutes
start=`date +%s`
end=`expr $start + $duration`
username=tgfde
message="This host is in scheduled downtime"
host=epmqowcs3

/bin/echo "[$now] $dtCommand;$host;$start;$end;1;0;$duration;$username;$message" > $pipe
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
tgfde
Posts: 233
Joined: Thu May 12, 2011 7:55 am

Re: Maintenace Downtime

Post by tgfde »

How about scheduling a service down time? I have the following command but it is now working.

#!/bin/sh

now=`date +%s`
dtCommand=SCHEDULE_SVC_DOWNTIME
pipe='/usr/local/nagios/var/rw/nagios.cmd'
start=1334334038
end=1334336738
duration=3600 #60 minutes
username=tgfde
message="This service is in scheduled downtime"
host=cordmon1
service=Daccs_Q1

/bin/echo "[$now] $dtCommand;$host;$start;$end;1;0;$duration;$username;$message" > $pipe


Thanks.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Maintenace Downtime

Post by scottwilkerson »

you didn't include $service in the main command

/bin/echo "[$now] $dtCommand;$host;$service;$start;$end;1;0;$duration;$username;$message" > $pipe
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
tgfde
Posts: 233
Joined: Thu May 12, 2011 7:55 am

Re: Maintenace Downtime

Post by tgfde »

Hi,

I'm still getting no result after adding service in the main command.

#!/bin/sh

now=`date +%s`
dtCommand=SCHEDULE_SVC_DOWNTIME
pipe='/usr/local/nagios/var/rw/nagios.cmd'
start=1334929500
end=1334934000
duration=3600 #60 minutes
username=tgfde
message="This service is in scheduled downtime"
host=cordmon1
service=Daccs_Q2

/bin/echo "[$now] $dtCommand;$host;$service;$start;$end;1;0;$duration;$username;$message" > $pipe


Thanks.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Maintenace Downtime

Post by scottwilkerson »

These times are is in the past...
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
tgfde
Posts: 233
Joined: Thu May 12, 2011 7:55 am

Re: Maintenace Downtime

Post by tgfde »

I just tried it with the following and still no luck.

start=1335180600
end=1335184200

Thanks.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Maintenace Downtime

Post by scottwilkerson »

Again these times are in the past.... almost 18344 seconds

As of this second the current time is

Code: Select all

# date +%s
1335198944
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked