Set service check time-outs when not using check_nrpe

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
linuser
Posts: 102
Joined: Fri Sep 18, 2015 9:53 am

Set service check time-outs when not using check_nrpe

Post 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?
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

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

Post 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?
Previous Nagios employee
linuser
Posts: 102
Joined: Fri Sep 18, 2015 9:53 am

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

Post 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.
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

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

Post 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>
Previous Nagios employee
linuser
Posts: 102
Joined: Fri Sep 18, 2015 9:53 am

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

Post 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?
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

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

Post 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.
Previous Nagios employee
linuser
Posts: 102
Joined: Fri Sep 18, 2015 9:53 am

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

Post 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?
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

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

Post 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.
Previous Nagios employee
Locked