Page 1 of 1
Timeout for custom plugin
Posted: Wed Aug 11, 2021 7:35 am
by mejokj
Hello,
I need to increase timeout for my custom plugin. My plugin is written in bash.
So kindly help what option in bash i need to set for increase timeout.
Regards,
Dhinil KV
Re: Timeout for custom plugin
Posted: Wed Aug 11, 2021 10:40 am
by gsmith
Hi
You can edit /usr/local/nagios/etc/nagiios.cfg and change the service_check_timeout setting. The default is 60 seconds.
Service Check Timeout
Format: service_check_timeout=<seconds>
Example: service_check_timeout=60
This is the maximum number of seconds that Nagios will allow service checks to run. If checks exceed this limit, they are killed and a CRITICAL state is returned. A timeout error will also be logged.
There is often widespread confusion as to what this option really does. It is meant to be used as a last ditch mechanism to kill off plugins which are misbehaving and not exiting in a timely manner. It should be set to something high (like 60 seconds or more), so that each service check normally finishes executing within this time limit. If a service check runs longer than this limit, Nagios will kill it off thinking it is a runaway processes.
Thanks
Re: Timeout for custom plugin
Posted: Wed Aug 11, 2021 10:40 am
by gsmith
Hi
You can edit /usr/local/nagios/etc/nagiios.cfg and change the service_check_timeout setting. The default is 60 seconds.
Service Check Timeout
Format: service_check_timeout=<seconds>
Example: service_check_timeout=60
This is the maximum number of seconds that Nagios will allow service checks to run. If checks exceed this limit, they are killed and a CRITICAL state is returned. A timeout error will also be logged.
There is often widespread confusion as to what this option really does. It is meant to be used as a last ditch mechanism to kill off plugins which are misbehaving and not exiting in a timely manner. It should be set to something high (like 60 seconds or more), so that each service check normally finishes executing within this time limit. If a service check runs longer than this limit, Nagios will kill it off thinking it is a runaway processes.
Thanks
Re: Timeout for custom plugin
Posted: Fri Aug 13, 2021 3:22 am
by mejokj
Hi Team,
I think it will change the settings for all plugins.
Any way to change timeout only for a single custom plugin
Thanks
Re: Timeout for custom plugin
Posted: Fri Aug 13, 2021 10:52 am
by gsmith
Hi,
No there isn't a way to change timeout only for a single custom plugin.
Some plugins have a -t option to set a timeout for that
individual plugin, but if it is set longer than service_check_timeout,
then the value of service_check_timeout will override the setting on
that plugin.
So this would work:
service_check_timeout = 60
check_myplugin -t 30
but in this case the plugin would still timeout at 60 seconds:
service_check_timeout = 60
check_myplugin -t 120
Thanks