Schedule downtime for a host from a commandline/script

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
lois54
Posts: 2
Joined: Fri Nov 30, 2012 10:20 am

Schedule downtime for a host from a commandline/script

Post by lois54 »

Hi all
I hope this is not an FAQ or something. I have looked but do not see this anywhere.
I would like to set a host to a "scheduled down time" state from a script. I am working on automating patching and often forget to do this step which can annoy my coworkers. Is there anyway to do this? I am writing my script in bash but I can also do perl or python. We are using Nagios version 3.0.3 currently. Thanks for your help.

Peace,
Lois
--
Lois Bennett, MSEE
Senior System Administrator
Channing Laboratory
Brigham & Women's Hospital
A Teaching Affiliate of
Harvard Medical School and
Harvard School of Public Health
Last edited by lois54 on Mon Dec 03, 2012 2:43 pm, edited 1 time in total.
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: Schedule downtime for a host from a commandline/script

Post by jsmurphy »

You can use whatever language you want, but here is an example in bash: http://old.nagios.org/developerinfo/ext ... and_id=119

Hopefully that helps :)
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Schedule downtime for a host from a commandline/script

Post by slansing »

Jsmurphy has a great answer, and there are also other great examples such as this one:

http://exchange.nagios.org/directory/Ad ... er/details

And here is a link to the Nagios Exchange page on Scheduled Downtime:

http://exchange.nagios.org/directory/Ad ... d-Downtime
lois54
Posts: 2
Joined: Fri Nov 30, 2012 10:20 am

Re: Schedule downtime for a host from a commandline/script

Post by lois54 »

Thanks everyone. I am happy that this was so straight forward.

Peace,
Lois
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Schedule downtime for a host from a commandline/script

Post by slansing »

Glad to see we had a solution for you, thanks for confirming!
Locked