Timeout for custom plugin

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
mejokj
Posts: 353
Joined: Mon Jul 22, 2013 10:31 pm

Timeout for custom plugin

Post 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
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: Timeout for custom plugin

Post 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
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: Timeout for custom plugin

Post 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
mejokj
Posts: 353
Joined: Mon Jul 22, 2013 10:31 pm

Re: Timeout for custom plugin

Post 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
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: Timeout for custom plugin

Post 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
Locked