Nagios Core 4.1 Down Time

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.
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Nagios Core 4.1 Down Time

Post by kwhogster »

I run Nagios Core 4.1.1 on my Raspberry Pi Works great.
All my Computers and workstations report back with no problems

I have two servers that run a process every Monday at 2:00 PM and it takes about 30 to 60 minutes to run
This process causes a service that I monitor to stop and the cpu spikes a bit.

During my testing I scheduled down time manually with Nagios.

How can I schedule these two server not to be monitored starting at 1:30 PM to 2:30 PM only on a Monday?


Thank you

Tom
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Nagios Core 4.1 Down Time

Post by mcapra »

Does this documentation offer any assistance?

https://assets.nagios.com/downloads/nag ... ntime.html
Former Nagios employee
https://www.mcapra.com/
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: Nagios Core 4.1 Down Time

Post by kwhogster »

no not really

I understand how to schedule a host and or service down time

My question is I do I set a schedule on a regular basis for down time.

My example above was clear on what I wanted.

Maybe not that clear

I want to schedule down time for two servers EVERY Monday at 1:45 PM to 2:45 PM

I am not just trying to schedule for one time I need a method to schedule a recurring downtime

I know I loose down time stats but I could just not monitor the one service during that time period also

Thoughts
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Nagios Core 4.1 Down Time

Post by mcapra »

Ah, apologies for misunderstanding.

One way to achieve this is to set a specific time period for your host that excludes Monday from 1:30pm to 2:30pm:
https://assets.nagios.com/downloads/nag ... riods.html

So your time period definition might look something like this:

Code: Select all

define timeperiod {
  timeperiod_name foo
  sunday 00:00-24:00
  monday 00:00-13:30,14:30-24:00
  tuesday 00:00-24:00
  wednesday 00:00-24:00
  thursday 00:00-24:00
  friday 00:00-24:00
  saturday 00:00-24:00
}
Alternatively you could define a new time period based on the default 24x7 definition and use the exclude directive:

Code: Select all

define timeperiod {
  name reboots
  timeperiod_name reboots
  monday 13:30-14:30
}

define timeperiod {
  timeperiod_name monday_reboots
  use 24x7
  exclude reboots
}
In which case, you would use the monday_reboots as the check_period directive for your host. If you wanted the checks to run but simply didn't want to get notifications, you would use the notification_period directive instead.
Former Nagios employee
https://www.mcapra.com/
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Nagios Core 4.1 Down Time

Post by rkennedy »

EDIT: Looks like @mcapra beat me to it, but both answers illustrate the same thing here.

Ah, your best bet may be to use the time periods built into Core. For example, create a new time period called 'skip1451hrm' -

Code: Select all

define timeperiod {
  timeperiod_name skip1451hrm
  sunday 00:00-24:00
  monday 00:00-13:45,14:45-24:00
  tuesday 00:00-24:00
  wednesday 00:00-24:00
  thursday 00:00-24:00
  friday 00:00-24:00
  saturday 00:00-24:00
}
Now, update those checks you do not want to execute during those times. Change the check_period for them. For example -

Code: Select all

        check_period    skip1451hrm
The checks will stop running on monday at 1:45 until 2:45.
Former Nagios Employee
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: Nagios Core 4.1 Down Time

Post by kwhogster »

Where do I do this?

Commands.cfg? for the define timeperiod

then where do I place the notification_period skip1451hrm does this go in the hosts definition file? or on the define service code?

I have a windows.cfg file that defines all my servers hosts and services

Thanks
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Nagios Core 4.1 Down Time

Post by mcapra »

With Core, you can put the definitions in whatever configuration file you like as long as that file (or it's parent directory) is recognized in nagios.cfg.

Generally, time periods are defined in /usr/local/nagios/etc/timeperiods.cfg

If your windows.cfg file contains the host definition, the check_period directive would go under the host definition in that file.
Former Nagios employee
https://www.mcapra.com/
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: Nagios Core 4.1 Down Time

Post by kwhogster »

Thanks

I do not have a timeperiods.cfg file in /usr/local/Nagios/etc

should I create one?

If I do will I need to check any place else ?


Found it

was here /usr/local/Nagios/etc/objects
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: Nagios Core 4.1 Down Time

Post by kwhogster »

Seem not able to create the timeperiod in the timeperiods.cfg file

root@raspberrypi:~# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.1.1
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-19-2015
License: GPL

Website: https://www.nagios.org
Reading configuration data...
Read main config file okay...
Error: Name or alias for timeperiod is NULL
Error: Could not register timeperiod (config file '/usr/local/nagios/etc/objects/timeperiods.cfg', starting on line 95)
Error processing object config files!


***> One or more problems was encountered while processing the config files...

Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.

my entries

# Exclude Time when WSUS does Cleanup Process on Mondays at 1:45 PM to 2:45 PM
define timeperiod{
timeperiod_name skip1451hrm
sunday 00:00-24:00
monday 00:00-13:45,14:45-24:00
tuesday 00:00-24:00
wednesday 00:00-24:00
thursday 00:00-24:00
friday 00:00-24:00
saturday 00:00-24:00
}


Thoughts?
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Nagios Core 4.1 Down Time

Post by rkennedy »

Ah - looks like I forgot an alias. Add one in here -

Code: Select all

# Exclude Time when WSUS does Cleanup Process on Mondays at 1:45 PM to 2:45 PM
define timeperiod{
timeperiod_name skip1451hrm
alias WSUS Monday Cleanup
sunday 00:00-24:00
monday 00:00-13:45,14:45-24:00
tuesday 00:00-24:00
wednesday 00:00-24:00
thursday 00:00-24:00
friday 00:00-24:00
saturday 00:00-24:00
}
That should work.
Former Nagios Employee
Locked