Page 1 of 2
Force checks to run sequentially
Posted: Mon May 30, 2016 6:41 am
by amprantino
Hello all,
I would like to poll a device that has very very very slow SNMP response.
Is there a way to force two (or more checks) run sequentially?
Or otherwise, is there a way to force two checks run different time?
Thank you
Re: Force checks to run sequentially
Posted: Mon May 30, 2016 11:27 pm
by Box293
From the check_snmp help:
- Multiple OIDs (and labels) may be indicated by a comma or space-delimited
list (lists with internal spaces must be quoted).
- See:
https://www.nagios-plugins.org/doc/guid ... HOLDFORMAT
for THRESHOLD format and examples.
- When checking multiple OIDs, separate ranges by commas like '-w 1:10,1:,:20'
- Note that only one string and one regex may be checked at present
Otherwise you might want to look at check_multi:
https://exchange.nagios.org/directory/P ... ti/details
Re: Force checks to run sequentially
Posted: Tue May 31, 2016 1:31 am
by amprantino
Not exactly.
Host1 --> Check1
|--> Check2
|--> Check3
Each check runs independently, checking a host that needs about 90 seconds to return the required snmp values.
I would like check1 , check2 and check3 to run sequentially.
Also, I don't want to merge all these into one check using check_multi.
Re: Force checks to run sequentially
Posted: Tue May 31, 2016 1:58 am
by Box293
Sorry I now understand what you mean.
There isn't that kind of support built into the box with Nagios.
The easiest way I could think of doing this is to create a bash script that:
- receives the check command with all the arguments
checks a temp file to see if one of the others is running, if they are not, update the temp file to say they are running otherwise exit with a state saying they are running
execute the check
update the temp file so it's recorded it's no longer running
It's complicated, but the only other way I though was:
Create a very complicated timeperiod definition that defined check1 could only execute on minutes 00:01-00:02,00:11-00:12, etc for every hour for every day.
Repeat for the other checks.
That would only ensure they wouldn't be scheduled at the same time, but does not prevent them from overlapping.
Re: Force checks to run sequentially
Posted: Tue May 31, 2016 2:36 am
by amprantino
Box293 wrote:
It's complicated, but the only other way I though was:
Create a very complicated timeperiod definition that defined check1 could only execute on minutes 00:01-00:02,00:11-00:12, etc for every hour for every day.
Repeat for the other checks.
That would only ensure they wouldn't be scheduled at the same time, but does not prevent them from overlapping.
This is the only solution I have thought too, but this cant expand to many services.
I want the service checks to run only twice a day (early in morning and late at night).
By assuming that every check does less than 2 minutes to run, I define the following
check_period:
check1: 8.00-8.05
check2: 8.15-8.20
check3: 8.30-8.35
I think this is enough to prevent services from running the same time, including a small retry check_interval
Probably in a future versions, nagios could have a group with services that cant run in parallel.

Re: Force checks to run sequentially
Posted: Tue May 31, 2016 5:05 pm
by rkennedy
If you're looking to scale this, you could always do so using a template that references the timeperiod's.
It's a bit difficult to make sure checks run in parallel, but I can bring it up for discussion. Is there a specific reason for the slow response from the server over SNMP?
Re: Force checks to run sequentially
Posted: Wed Jun 01, 2016 1:45 am
by amprantino
Actually it isn't a server but an Avaya telephone center. It's extremely slow...
I want to verify that all PRI lines are functional.
rkennedy wrote:......
It's a bit difficult to make sure checks run in parallel, ..........
Not in parallel, so delays don't go beyond 90 secs
Re: Force checks to run sequentially
Posted: Wed Jun 01, 2016 9:47 am
by rkennedy
Ah, I misunderstood at first. Before I file the feature request, just want to make sure I understand properly.
This would be an option, where only one type of this check could be executed on a certain host at a time, to prevent multiple requests going at it.
Is that right now?
Re: Force checks to run sequentially
Posted: Wed Jun 01, 2016 11:33 am
by amprantino
For example, I have configured:
Host1 --> Check1
|--> Check2
|--> Check3
I would like these to be executed (time-sequence):
Start Check1
Finished Check1
Start Check2
Finished Check2
Start Check3
Finished Check3
Check execution order (of services) is not very important, at least for me.
Feature Request: (just an idea)
Inside a servicegroup definition, we can assign a specific (optional) parameter like sequential 1.
All services that belongs in this group cant be run in parallel, but only sequentially
define servicegroup{
servicegroup_name servers_slow_services
members host1,check1,host1,check2,host1,check3
sequential 1
}
Re: Force checks to run sequentially
Posted: Wed Jun 01, 2016 5:09 pm
by hsmith
I get how your idea is a good one, but I could see where this would have some issues with templates and inheritance. If they approve us submitting a feature request, I'll update this post.
For now, is there an issue with the solution Troy posted?
Box293 wrote:The easiest way I could think of doing this is to create a bash script that:
receives the check command with all the arguments
checks a temp file to see if one of the others is running, if they are not, update the temp file to say they are running otherwise exit with a state saying they are running
execute the check
update the temp file so it's recorded it's no longer running