Reschedule check on same time as previous check

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.
Locked
spirtt0
Posts: 2
Joined: Wed Jun 17, 2015 2:15 am

Reschedule check on same time as previous check

Post by spirtt0 »

Hi !

I'm using Nagios Core 3.5.1 and was set next params for schedule

check_period aggregation_check
normal_check_interval 1440
retry_interval 60
max_check_attempts 1

Check period is set on every day from 3 o'clock to 10 o'clock , after check failing and back to OK state - Next schedule check was set to 7 o'clock. How is possible to set that scheduled check will start from timeperiod begin and not from back to OK state ?

Thank you !
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Reschedule check on same time as previous check

Post by tgriep »

Do you want to run the check once a day. If it is up or down, to not check again for 24 hours?
Be sure to check out our Knowledgebase for helpful articles and solutions!
spirtt0
Posts: 2
Joined: Wed Jun 17, 2015 2:15 am

Re: Reschedule check on same time as previous check

Post by spirtt0 »

tgriep wrote:Do you want to run the check once a day. If it is up or down, to not check again for 24 hours?
Yes, i want check once a day. For example if host down in 3 o'clock and up in 6 o'clock, i want that new check anyway start in 3 o'clock , not for 24 hours from last state changing.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Reschedule check on same time as previous check

Post by tmcdonald »

The scheduling in Core is not exact. If you have all of your checks set to 5-minute intervals, it will space them out so as not to bunch up too much. Sometimes a check might be scheduled a little earlier or later. For this reason if you need this kind of precision, I would actually use a cron job to launch the check and then send the result in as a passive:

http://nagios.sourceforge.net/docs/3_0/ ... hecks.html
Former Nagios employee
ajmoorhouse
Posts: 3
Joined: Mon May 18, 2015 4:52 am

Re: Reschedule check on same time as previous check

Post by ajmoorhouse »

tmcdonald wrote:The scheduling in Core is not exact.
Hello, just joining in here, I have a similar requirement - are you implying that the scheduling in Nagio XI is exact?

It seems impossible to do this in Core. I created a check with a check_interval of 1440 minutes and manually scheduled the next check time, but every time Nagios restarts the check runs immediately(-ish) and is then rescheduled for a day later. Which means every time Nagios is restarted I have to manually reschedule the next check.

I'm a bit loathe to implement passive checks using NCSA, as it appears to need a matching password in plain-text on the Nagios server and any remote nodes as well. I can't think our security department would be too happy about that.

Many thanks for any insight.
Andy.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Reschedule check on same time as previous check

Post by tmcdonald »

ajmoorhouse wrote:
tmcdonald wrote:The scheduling in Core is not exact.
Hello, just joining in here, I have a similar requirement - are you implying that the scheduling in Nagio XI is exact?
No. XI runs on top of Core so would have the same behavior, and this question was posted in the Core section of the forum so to save a few keystrokes I just wrote Core.

As for the time it runs, remember that it should be scheduling the check as soon as it can within that time frame. In OP's case, it sounds like it checked and failed, so it would retry every hour until it was OK. If it came back OK at 7PM and has a 1440 check_interval, then it would check again in 24 hours.

In your case, manually scheduling the check at X time is throwing off the normal scheduling. I don't believe manual reschedules are persistent across reboots, but I would need to defer to a developer on this one.

In regards to NSCA for passives, you don't need to use that at all. See the following on submitting check results on localhost using a small bash script:

http://old.nagios.org/developerinfo/ext ... and_id=114
Former Nagios employee
ajmoorhouse
Posts: 3
Joined: Mon May 18, 2015 4:52 am

Re: Reschedule check on same time as previous check

Post by ajmoorhouse »

tmcdonald wrote:
In your case, manually scheduling the check at X time is throwing off the normal scheduling. I don't believe manual reschedules are persistent across reboots, but I would need to defer to a developer on this one.

In regards to NSCA for passives, you don't need to use that at all. See the following on submitting check results on localhost using a small bash script:

http://old.nagios.org/developerinfo/ext ... and_id=114
I am pretty sure that manual reschedules are not persistent, as you say.

I've also tried creating a 10-minute timeperiod to run a check within it, but the "next scheduled" time seemed to "drift" out of the timeperiod, and it stopped being run.

In the example provided for the Passive check, that script is running on the same host as where Nagios is, isn't it? Which is fine, but is it possible to run a similar script on a remote host? Maybe the remote host script could do something like "ssh user@nagios_host -c printf blah > $commandfile", would that work? Is that a reasonable or recommended way to do passive checks remotely? If that was possible then I'd just schedule my check scripts on the remote servers with cron and forget all about the active checks!

Thanks again
Andy
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Reschedule check on same time as previous check

Post by tmcdonald »

In my example, yes it is running local to Core.

Should work, just make certain you A.) Set up passwordless login with your SSH certs and B.) SSH at least once manually as the nagios user on the remote machine into the Core machine, otherwise it will ask if you would like to trust the network and the plugins can't handle that decision. Reasonable, probably. Recommended, I can't say. SSH has a bit of overhead to it that might slow things down a bit, but we have a check_by_ssh plugin for doing this sort of thing actively so I can't imagine why it wouldn't work generally.
Former Nagios employee
ajmoorhouse
Posts: 3
Joined: Mon May 18, 2015 4:52 am

Re: Reschedule check on same time as previous check

Post by ajmoorhouse »

Many thanks tmcdonald, I am going to give it a try! Will post back with results.

Andy
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Reschedule check on same time as previous check

Post by abrist »

great. Keep us posted.
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.
Locked