Page 1 of 2

Reoccurring scheduled downtime - Core 3.2.3

Posted: Fri Jan 31, 2014 9:08 am
by bud21
Hi there,

I am new to Nagios but need to figure out how to set something up. Basically there is a requirement to restart a particular server every Monday at 05:30 and I’d like to set something up in Nagios to kick in at that time so scheduled downtime is in place and we don’t get alerts for the restarts.

We use Nagios Core 3.2.3 so any help would be gratefully appreciated. I’ve done a bit of digging and I’ve come across scripts and crons that can achieve this but to be honest it is all over my head so a bit of lay-man‘s help and instructions would be very appreciated.

Thanks,

Bud21

Re: Reoccurring scheduled downtime - Core 3.2.3

Posted: Fri Jan 31, 2014 9:19 am
by scottwilkerson
With scripts andcrons would be how you would have to do this in Nagios Core.

We do have Reoccurring scheduled downtime feature in Nagios XI, which was designed to be much easier to work with. No knowledge of scripts and crons really needed to use that product...

Re: Reoccurring scheduled downtime - Core 3.2.3

Posted: Fri Jan 31, 2014 9:52 am
by bud21
Hi Scott,

Thanks for your reply. I've tinkered about with some stuff in Nagios i.e. updated and removing servers etc. so have some experience with the product. If you could please let me know where the crons / scripts are stored on the Nagios server i.e. for example some files I have worked with in the past have been located here: - /etc/Nagios/objects so if you could me to the location where the crons/scripts are that would be great.

I might get lucky and perhaps there may be an old cron or script at that location that I could maybe copy and tweak for this requirement.

Any beginner’s info/advice or examples of crons or scripts for Nagios would be greatly appreciated. Everyone needs to start somewhere!!!

Cheers,

Bud21

Re: Reoccurring scheduled downtime - Core 3.2.3

Posted: Fri Jan 31, 2014 2:35 pm
by sreinhardt
Personally, I would have this cron on the remote server and just use the scheduled downtime on nagios to avoid being alerted for it going down, but still log that it did go down properly. Most crons would be in /etc/cron.d/ although I'm not sure if there will be a restart script for you.

Re: Reoccurring scheduled downtime - Core 3.2.3

Posted: Mon Feb 03, 2014 4:01 am
by bud21
Hi Spencer,

Thanks for your reply.

I'm a little unclear what you are suggesting. The remote server that will be restarted each week by a scheduled Windows so can that cron you mention be but on that remote Windows 2008R2 server?

I would have assumed the cron would need to be on the Nagios server and kick in once the Windows script kicks in and restarts the server. Is there any chance you or anyone could paste in an example of a cron that would do my job of enabling the scheduled downtime in Nagios to take into account of that server being restarted. The restart of the server will be taken care of by the script that will run as a task from Windows task scheduler, I just need someone to please provide a cron that will schedule downtime for that server each Monday morning.

If someone would be so kind to give me the syntax for that cron I could put it in that location where you specify i.e. /etc/cron.d and hopefully that would be my problem sorted.

Cheers,

Bud21

Re: Reoccurring scheduled downtime - Core 3.2.3

Posted: Mon Feb 03, 2014 3:00 pm
by abrist

Re: Reoccurring scheduled downtime - Core 3.2.3

Posted: Tue Feb 04, 2014 6:21 am
by bud21
Thank you very much for those links abrist!

I'll look through them and see what I come up with.

Cheers,

Bud21

Re: Reoccurring scheduled downtime - Core 3.2.3

Posted: Tue Feb 04, 2014 10:46 am
by tmcdonald
We'll keep this thread open for you until you come back.

Re: Reoccurring scheduled downtime - Core 3.2.3

Posted: Mon Feb 17, 2014 10:06 am
by bud21
Hi abrist,

Thanks for providing those links!

Sorry I’m just getting back to this now – I’ve been setting the scheduled downtime manually via the console this last couple of weeks as I have been busy with other things.

URL 1 was very useful and gave me a lot of details and background info on crons in general so cheers for that.

URL 2 is very interesting, all be it very scary! It is probably something like what I need so any guidance as to what the syntax would be to stop Nagios alerting on a particular host from 05:30 and 09:30 am each Monday morning would be very much appreciated.

If someone could also please let me know where I need to save that new cron to so it kicks in at the right time every week that would be great. I notice there is a folder under etc/cron.weekly so I would assume it should probably be saved there, is that correct?

Thanks,

Bud21

Re: Reoccurring scheduled downtime - Core 3.2.3

Posted: Mon Feb 17, 2014 12:42 pm
by slansing
Yes cron.weekly would be the spot, unless you already have a crontab which has some cron's scheduled that you want to place it in with, in which case just make sure the get the time syntax correct.