Page 1 of 1

Set service check time-outs when not using check_nrpe

Posted: Tue Nov 08, 2016 3:38 pm
by linuser
Nagios Core 3.5.1.

I am trying to use a blacklist plugin that I got from this link.

https://exchange.nagios.org/directory/P ... pl/details

I am running the plugin from the nagios server. I am not using check_nrpe to run it from the server being checked.

The plugin works fine from command line on the nagios server. However it times out at each scheduled interval. The error from the web page says "(Service check timed out)".

I have only been able to set a timeout when using check_nrpe. How can I set a longer timeout for a service check that does not use check_nrpe?

Re: Set service check time-outs when not using check_nrpe

Posted: Tue Nov 08, 2016 3:51 pm
by avandemore
That is a quite old version of Nagios Core.

Please post the full command and output. What user are you running this as?

Re: Set service check time-outs when not using check_nrpe

Posted: Tue Nov 08, 2016 4:11 pm
by linuser
I have this in commands.cfg

Code: Select all

define command{
        command_name    check_rbl
        command_line    $USER1$/check_rbl <ip address>
        }
From the command line I run this: (works fine)

Code: Select all

./check_rbl <ip address>

From command line I run as root.

Re: Set service check time-outs when not using check_nrpe

Posted: Tue Nov 08, 2016 4:18 pm
by avandemore
I'm asking for the output of the command, not the definition. EG:

Code: Select all

# cd /usr/local/nagios/libexec
# ./check_dummy 0
OK
Also to perform an accurate test, you need to run the command as user nagios EG:

Code: Select all

# su - nagios
$ cd /usr/local/nagios/libexec
$ <Your command here>
<Your command output here>

Re: Set service check time-outs when not using check_nrpe

Posted: Tue Nov 08, 2016 4:31 pm
by linuser

Code: Select all

[root@nagios plugins]# ./check_rbl <ip address>
All OK: SORBS, Distributed Sender, Spamhaus SBL/XBL/PBL, RFC-Ignorant, SpamCop, Mail-abuse.org, NJABL

Code: Select all

[root@nagios plugins]# su - nagios
This account is currently not available.

[root@nagios plugins]# sudo -s -u nagios
bash-4.1$ cd /usr/lib64/nagios/plugins/

bash-4.1$ ./check_rbl <ip address>
All OK: SORBS, Distributed Sender, Spamhaus SBL/XBL/PBL, RFC-Ignorant, SpamCop, Mail-abuse.org, NJABL
bash-4.1$ whoami
nagios
bash-4.1$ 
  
One thing I have done is increase the global service check timeout in nagios.cfg to 120 seconds. This has seemed to resolve the issue but is not an ideal solution .So I took that line and added it to my templates.cfg file but it complained upon verify that it was not a valid object property type or something. Surely I should be able to place that line inside a file to make it a custom property for only the services I want?

Re: Set service check time-outs when not using check_nrpe

Posted: Tue Nov 08, 2016 4:53 pm
by avandemore
Timeouts per commands can be defined(most have it built in) eg:

Code: Select all

# ./check_ssh -h
check_ssh v2.0.3 (nagios-plugins 2.0.3)
Copyright (c) 1999 Remi Paulmier <[email protected]>
Copyright (c) 2000-2014 Nagios Plugin Development Team
        <[email protected]>

Try to connect to an SSH server at specified server and port


Usage:
check_ssh  [-4|-6] [-t <timeout>] [-r <remote version>] [-p <port>] <host>

Options:
 -h, --help
    Print detailed help screen
 -V, --version
    Print version information
 --extra-opts=[section][@file]
    Read options from an ini file. See
    https://www.nagios-plugins.org/doc/extra-opts.html
    for usage and examples.
 -H, --hostname=ADDRESS
    Host name, IP Address, or unix socket (must be an absolute path)
 -p, --port=INTEGER
    Port number (default: 22)
 -4, --use-ipv4
    Use IPv4 connection
 -6, --use-ipv6
    Use IPv6 connection
 -t, --timeout=INTEGER
    Seconds before connection times out (default: 10)
 -r, --remote-version=STRING
    Warn if string doesn't match expected server version (ex: OpenSSH_3.9p1)
 -P, --remote-protocol=STRING
    Warn if protocol doesn't match expected protocol version (ex: 2.0)
 -v, --verbose
    Show details for command-line debugging (Nagios may truncate output)

Send email to [email protected] if you have questions regarding use
of this software. To submit patches or suggest improvements, send email to
[email protected]
From there, you can build services on top of it.

Re: Set service check time-outs when not using check_nrpe

Posted: Tue Nov 08, 2016 6:01 pm
by linuser
This particular plugin does not have a timeout option, even if it did, I'd have to set it to longer than our default global service timeout of 60 seconds. Hypothetically though, which one takes precedence, the global one in nagios.cfg or the plugin?

Re: Set service check time-outs when not using check_nrpe

Posted: Wed Nov 09, 2016 10:24 am
by avandemore
The global setting takes precedence(or it would be useless).

If you have something that is taking an abnormally long time to check, perhaps that's best addressed by a passive check.