Page 1 of 1

How to check service three times a day

Posted: Tue Jul 12, 2022 7:20 am
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 https://assets.nagios.com/downloads/nag ... riods.html it says "When Nagios Core attempts to reschedule a host or service check, it will make omegle.2yu.co 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.

Re: How to check service three times a day

Posted: Wed Jul 13, 2022 5:49 am
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.

Re: How to check service three times a day

Posted: Wed Jul 13, 2022 3:57 pm
by alkalk1
Maybe try: check_interval 15