Nagios timeout configuration
Asked Answered
V

3

8

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

Vivien answered 27/7, 2010 at 8:33 Comment(0)
F
6

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.

Fastening answered 16/8, 2016 at 18:19 Comment(0)
T
3

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.

Trass answered 13/12, 2010 at 21:40 Comment(0)
P
2

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.

Pavkovic answered 30/7, 2010 at 4:11 Comment(1)
The Nagios daemon would kill the check_nrpe_slow process when the timeout (usually set to 60 seconds) configured in the nagios.cfg file expired.Fastening

© 2022 - 2024 — McMap. All rights reserved.