How do I set an individual timeout setting per service check. All timeouts default to 60 seconds as per the main configuration but I require that one particular check have a longer timeout due to the execution time.
How can this be done? Please help.
Thanks
The best way of fixing this issue would be to move the check from 'active' to 'passive' execution. Passive checking does not have any time limits from the Nagios system at all. You would have to incorporate any timeouts, as required, into the passive check script/program itself. This would allow you to have complete control over how long a check should run - and even have daemonized checks that constantly run if this was needed.
The main purpose of the global timeouts is to prevent a condition I call 'check-stacking'. With a higher global timeout (especially one that is higher than the smallest possible check interval), you risk firing off a new check before the old one has finished. These can lead to everything from, running out of resources on your Nagios system - to stressing your target machine and or application. So its generally a bad idea to increase those global timeouts. These timeouts, when reached, will kill off the forked check process.
As noted in the documentation this timeout is a last ditch effort to control service checks that are not behaving properly. If you know that you have a check that will take longer for a good reason then I suggest raising this limit in nagios.cfg. There is no setting for service or host checks that will override this.
EDIT: I just realized you weren't talking about JUST remote service checks so, unfortunately, I need to change my answer to "you can't". If you want to change the timeout settings for service checks then you must apply it to all service checks in the main configuration files.
You'll need to define a second command argument, one that uses your special timeout setting.
For example, this may be your original check in commands.cfg:
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
And this would be your identical command with a longer timeout value (also in commands.cfg):
define command{
command_name check_nrpe_slow
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t 120 -c $ARG1$
}
If there is a better way to do this nagios-wizards please let me know! It would save a lot of room in my own configuration files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With