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
Reoccurring scheduled downtime - Core 3.2.3
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Reoccurring scheduled downtime - Core 3.2.3
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...
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
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
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
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Reoccurring scheduled downtime - Core 3.2.3
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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Re: Reoccurring scheduled downtime - Core 3.2.3
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
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
Let me give you a bit of material to chew on:
http://www.cyberciti.biz/faq/how-do-i-a ... unix-oses/
http://exchange.nagios.org/directory/Ad ... on/details
http://exchange.nagios.org/directory/Ad ... d-Downtime
http://www.cyberciti.biz/faq/how-do-i-a ... unix-oses/
http://exchange.nagios.org/directory/Ad ... on/details
http://exchange.nagios.org/directory/Ad ... d-Downtime
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: Reoccurring scheduled downtime - Core 3.2.3
Thank you very much for those links abrist!
I'll look through them and see what I come up with.
Cheers,
Bud21
I'll look through them and see what I come up with.
Cheers,
Bud21
Re: Reoccurring scheduled downtime - Core 3.2.3
We'll keep this thread open for you until you come back.
Former Nagios employee
Re: Reoccurring scheduled downtime - Core 3.2.3
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
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
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: Reoccurring scheduled downtime - Core 3.2.3
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.