[Nagios-users] checking service once a day

2011-08-12 Thread Silver Salonen
Hello.

I want to check a service only once a day. So I tried this configuration:

define timeperiod {
 timeperiod_name once-a-day
 alias   On mornings
 monday  08:00-08:30
 tuesday 08:00-08:30
 wednesday   08:00-08:30
 thursday08:00-08:30
 friday  08:00-08:30
 saturday08:00-08:30
 sunday  08:00-08:30
}

define service {
 use generic-service
 check_periodonce-a-day
 normal_check_interval  1440; 24 hours
 ...
}

Now when I check the service's next schedule time, Nagios is still 
showing that the next check is scheduled to 24h after the previous check 
and at 22:53 (pm). Restarting Nagios does not change that. Any tips for 
what's wrong in the configuration?

--
Silver


--
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. 
http://p.sf.net/sfu/wandisco-dev2dev
___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null


Re: [Nagios-users] checking service once a day

2011-08-12 Thread Silver Salonen

On 12.08.2011 11:25, Jim Avery wrote:

On 12 August 2011 08:36, Silver Salonensil...@serverock.ee  wrote:

Hello.

I want to check a service only once a day. So I tried this configuration:

define timeperiod {
 timeperiod_name once-a-day
 alias   On mornings
 monday  08:00-08:30
 tuesday 08:00-08:30
 wednesday   08:00-08:30
 thursday08:00-08:30
 friday  08:00-08:30
 saturday08:00-08:30
 sunday  08:00-08:30
}

define service {
 use generic-service
 check_periodonce-a-day
 normal_check_interval  1440; 24 hours
 ...
}

Now when I check the service's next schedule time, Nagios is still
showing that the next check is scheduled to 24h after the previous check
and at 22:53 (pm). Restarting Nagios does not change that. Any tips for
what's wrong in the configuration?


If Nagios wants to schedule a check at a certain time, but it's not in
the timeperiod then it won't run it.


That's interesting. Documentation says:

Specifying a timeperiod in the/check_period/directive allows you to 
restrict the time that Nagios perform regularly scheduled, active checks 
of the host or service. When Nagios attempts to reschedule a host or 
service check, it will make sure that the next check falls within a 
valid time range within the defined timeperiod. If it doesn't, Nagios 
will adjust the next check time to coincide with the next valid time 
in the specified timeperiod.


So I guess documentation is wrong then?


If you don't mind what time of day your check is run, then use the
standard 24x7 timeperiod.

If you want a check to run at a specific time of day, you need to run
it from cron so it submits the check result to Nagios as a passive
check.

http://nagios.sourceforge.net/docs/nagioscore/3/en/passivechecks.html

Alternatively, if you don't mind your check being run a couple of
times each day, I would think you could leave your config as it is,
but set the normal_check_interval to 12 (minutes) or so to give it a
good chance of being scheduled within your 30-minute window.
Personally I would use cron, but it can be a bit fiddly to set up the
first time you try it.


OK, I guess I'd have to go with the passive checks through crontab then 
(because I do mind what time the checks are run).


--
Silver
--
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. 
http://p.sf.net/sfu/wandisco-dev2dev___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Re: [Nagios-users] checking service once a day

2011-08-12 Thread Silver Salonen

On 12.08.2011 12:37, Silver Salonen wrote:

On 12.08.2011 11:25, Jim Avery wrote:

On 12 August 2011 08:36, Silver Salonensil...@serverock.ee  wrote:

Hello.

I want to check a service only once a day. So I tried this configuration:

define timeperiod {
 timeperiod_name once-a-day
 alias   On mornings
 monday  08:00-08:30
 tuesday 08:00-08:30
 wednesday   08:00-08:30
 thursday08:00-08:30
 friday  08:00-08:30
 saturday08:00-08:30
 sunday  08:00-08:30
}

define service {
 use generic-service
 check_periodonce-a-day
 normal_check_interval  1440; 24 hours
 ...
}

Now when I check the service's next schedule time, Nagios is still
showing that the next check is scheduled to 24h after the previous check
and at 22:53 (pm). Restarting Nagios does not change that. Any tips for
what's wrong in the configuration?

If Nagios wants to schedule a check at a certain time, but it's not in
the timeperiod then it won't run it.


That's interesting. Documentation says:

Specifying a timeperiod in the/check_period/directive allows you to 
restrict the time that Nagios perform regularly scheduled, active 
checks of the host or service. When Nagios attempts to reschedule a 
host or service check, it will make sure that the next check falls 
within a valid time range within the defined timeperiod. If it 
doesn't, Nagios will adjust the next check time to coincide with the 
next valid time in the specified timeperiod.


So I guess documentation is wrong then?


If you don't mind what time of day your check is run, then use the
standard 24x7 timeperiod.

If you want a check to run at a specific time of day, you need to run
it from cron so it submits the check result to Nagios as a passive
check.

http://nagios.sourceforge.net/docs/nagioscore/3/en/passivechecks.html

Alternatively, if you don't mind your check being run a couple of
times each day, I would think you could leave your config as it is,
but set the normal_check_interval to 12 (minutes) or so to give it a
good chance of being scheduled within your 30-minute window.
Personally I would use cron, but it can be a bit fiddly to set up the
first time you try it.


OK, I guess I'd have to go with the passive checks through crontab 
then (because I do mind what time the checks are run).


Ah yes, previously I just restarted Nagios every day (from crontab) so 
that the checks would be re-scheduled, but in the new installation 
Nagios does not re-schedule the checks on startup. Is there an option 
for that? I don't seem to find it...


--
Silver
--
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. 
http://p.sf.net/sfu/wandisco-dev2dev___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Re: [Nagios-users] checking service once a day

2011-08-12 Thread Silver Salonen
On 12.08.2011 17:48, Jim Avery wrote:
 On 12 August 2011 15:03, Silver Salonensil...@serverock.ee  wrote:

 Ah yes, previously I just restarted Nagios every day (from crontab) so that
 the checks would be re-scheduled, but in the new installation Nagios does
 not re-schedule the checks on startup. Is there an option for that? I don't
 seem to find it...

 It's been a while since I've played with any of those options myself.
 I think you'll find it's this directive in nagios.cfg which controls
 whether Nagios re-schedules checks on startup ..

 # USE RETAINED SCHEDULING INFO
 # This setting determines whether or not Nagios will retain
 # the scheduling info (next check time) for hosts and services
 # based on the values saved in the retention file.  If you
 # If you want to use retained scheduling info, set this
 # value to 1.  If not, set this value to 0.

 use_retained_scheduling_info=1


 Cheers,

 Jim
Thank you very much, Jim!

After setting this option to 0, the next check is now scheduled to 
tomorrow 8:00 which is exactly what I want :)
So I guess the smartness of Nagios' scheduling (and whether it follows 
time period restrictions) is dependent on this option.

--
Silver

--
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. 
http://p.sf.net/sfu/wandisco-dev2dev
___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null


Re: [Nagios-users] checking service once a day

2011-08-12 Thread Silver Salonen
On 12.08.2011 17:54, Mike Guthrie wrote:
 Silver Salonen wrote:
 On 12.08.2011 12:37, Silver Salonen wrote:
 On 12.08.2011 11:25, Jim Avery wrote:
 On 12 August 2011 08:36, Silver Salonensil...@serverock.ee  wrote:

 Hello.

 I want to check a service only once a day. So I tried this configuration:

 define timeperiod {
  timeperiod_name once-a-day
  alias   On mornings
  monday  08:00-08:30
  tuesday 08:00-08:30
  wednesday   08:00-08:30
  thursday08:00-08:30
  friday  08:00-08:30
  saturday08:00-08:30
  sunday  08:00-08:30
 }

 define service {
  use generic-service
  check_periodonce-a-day
  normal_check_interval  1440; 24 hours
  ...
 }

 Do you need the check to run between 8-8:30, or just every 24 hours?
 Your check_interval will not exceed the maximum check spread that's in
 the main nagios.cfg file.  I would try either setting the timeperiod for
 the check *or* setting the wide check interval.
Yes, I wanted the checks to be run between 8:00 and 8:30. But as I 
woohooed in the previous e-mail, it seems I got it working :)

--
Silver

--
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. 
http://p.sf.net/sfu/wandisco-dev2dev
___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null