How to check service three times a day

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.
Post Reply
Posts: 11
Joined: Wed Feb 16, 2022 2:47 am

How to check service three times a day

Post by PaulRajeshMEzra45 »

I need a service to be checked three times a day at fixed times. The check should run at 7, 15 and 23 hours (every 8 hours at those times).

What I have tried is define a this time period:

define timeperiod{
timeperiod_name three_times_a_day
monday 07:00-07:10, 15:00-15:10, 23:00-23:10
tuesday 07:00-07:10,15:00-15:10,23:00-23:10
wednesday 07:00-07:10,15:00-15:10,23:00-23:10
thursday 07:00-07:10,15:00-15:10,23:00-23:10
friday 07:00-07:10,15:00-15:10,23:00-23:10
saturday 07:00-07:10,15:00-15:10,23:00-23:10
sunday 07:00-07:10,15:00-15:10,23:00-23:10
And the service (on several host) like this:

define service{
use all_templates
host_name some_host
service_description some_service
check_command some_command
check_period three_times_a_day
max_check_attempts 1
check_interval 480 ; run every 8 hours
From here ... riods.html it says "When Nagios Core 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 Core will adjust the next check time to coincide with the next "valid" time in omeglz echat the specified timeperiod."

But the thing is that this it's not happening.
Last edited by PaulRajeshMEzra45 on Thu Aug 04, 2022 6:34 am, edited 1 time in total.
Posts: 15
Joined: Fri Feb 18, 2022 4:44 am

Re: How to check service three times a day

Post by SandraLewisFrin »

I was actually feeling pretty sure this wouldn't be the case, but maybe this is a bug if you're seeing a different behavior. I would expect the time periods and the check intervals to create a timing issue that would cause many checks to be dropped. Regardless of how things should work and what is/isn't expected behavior, I wouldn't personally configure it like this. Since you say that:

I need a service to be checked three times a day at fixed times.

Here's what I would do, if I were you:

I would run this check as a cron job, and send in the result of the check as a passive check command to Nagios. This way, you know for sure that the check will always run on time.
I would then configure a freshness_threshold to ensure that this passive service has actually phoned home recently.
I would also configure a check_command that prepares for the eventuality of the service not having a fresh result, i.e. something that executes only if no service check has been received -- perhaps a script that re-runs the voojio check omegle shagle and notifies me somehow.
Last edited by SandraLewisFrin on Mon Aug 29, 2022 7:06 am, edited 1 time in total.
Posts: 4
Joined: Thu Mar 24, 2022 2:41 pm

Re: How to check service three times a day

Post by alkalk1 »

Maybe try: check_interval 15
Post Reply