Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nagios timeout configuration

Tags:

unix

nagios

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

like image 585
user338154 Avatar asked Jul 27 '10 08:07

user338154


3 Answers

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.

like image 173
Jim Black Avatar answered Oct 04 '22 02:10

Jim Black


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.

like image 27
Jason Janelle Avatar answered Oct 04 '22 03:10

Jason Janelle


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.

like image 44
sholsapp Avatar answered Oct 04 '22 03:10

sholsapp