Page 1 of 1

difference between check_xi_by_ssh and check_by_ssh?

Posted: Mon Aug 28, 2017 2:58 pm
by ikekim
what is the difference between "check_xi_by_ssh" and "check_ssh"?

I see the command view for "check_xi_by_ssh":
$USER1$/check_by_ssh -H $HOSTADDRESS$ $ARG1$ $ARG2$

VERSUS

I see the command view for "check_by_ssh":
$USER1$/check_ssh $ARG1$ $HOSTADDRESS$


thanks,
ik

Re: difference between check_xi_by_ssh and check_by_ssh?

Posted: Mon Aug 28, 2017 3:15 pm
by dwhitfield
Well, one calls the check_by_ssh plugin and one calls the check_ssh plugin. Other than https://exchange.nagios.org//directory/ ... ns/details I was not able to find any reference to check_ssh. Can you attach that plugin so that we can see how it operates?

Re: difference between check_xi_by_ssh and check_by_ssh?

Posted: Mon Aug 28, 2017 3:22 pm
by tacolover101
check_by_ssh and check_ssh are both part of the plugins package by Nagios - https://www.nagios.org/downloads/nagios-plugins/

check_ssh is used for checking the version of SSH - https://nagios-plugins.org/doc/man/check_ssh.html

check_by_ssh is used for checking over the SSH protocol - https://nagios-plugins.org/doc/man/check_by_ssh.html

Re: difference between check_xi_by_ssh and check_by_ssh?

Posted: Mon Aug 28, 2017 3:31 pm
by dwhitfield
Thanks @tacolover101!
tacolover101 wrote: check_ssh is used for checking the version of SSH - https://nagios-plugins.org/doc/man/check_ssh.html
Looks like the stats info garbles that link. Just remove everything after the html and it should work. It's interesting that check_ssh doesn't show up on nagios.com, but only nagios-plugins.org, but is of little import.

For now, the relevant info is as follows:

Code: Select all

   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:<timeout state>
        Seconds before connection times out (default: 10)
        Optional ":<timeout state>" can be a state integer (0,1,2,3) or a state STRING
     -r, --remote-version=STRING
        Alert if string doesn't match expected server version (ex: OpenSSH_3.9p1)
     -P, --remote-protocol=STRING
        Alert if protocol doesn't match expected protocol version (ex: 2.0)
     -v, --verbose
        Show details for command-line debugging (Nagios may truncate output)
As you can see from the following, it is very different to check_by_ssh

Code: Select all

Usage:
 check_by_ssh -H <host> -C <command> [-fqv] [-1|-2] [-4|-6]
       [-S [lines]] [-E [lines]] [-t timeout] [-i identity]
       [-l user] [-n name] [-s servicelist] [-O outputfile]
       [-p port] [-o ssh-option] [-F configfile]

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: none)
 -4, --use-ipv4
    Use IPv4 connection
 -6, --use-ipv6
    Use IPv6 connection
 -1, --proto1
    tell ssh to use Protocol 1 [optional]
 -2, --proto2
    tell ssh to use Protocol 2 [optional]
 -S, --skip-stdout[=n]
    Ignore all or (if specified) first n lines on STDOUT [optional]
 -E, --skip-stderr[=n]
    Ignore all or (if specified) first n lines on STDERR [optional]
 -f
    tells ssh to fork rather than create a tty [optional]. This will always return OK if ssh is executed
 -C, --command='COMMAND STRING'
    command to execute on the remote machine
 -l, --logname=USERNAME
    SSH user name on remote host [optional]
 -i, --identity=KEYFILE
    identity of an authorized key [optional]
 -O, --output=FILE
    external command file for nagios [optional]
 -s, --services=LIST
    list of nagios service names, separated by ':' [optional]
 -n, --name=NAME
    short name of host in nagios configuration [optional]
 -o, --ssh-option=OPTION
    Call ssh with '-o OPTION' (may be used multiple times) [optional]
 -F, --configfile
    Tell ssh to use this configfile [optional]
 -q, --quiet
    Tell ssh to suppress warning and diagnostic messages [optional]
 -w, --warning=DOUBLE
    Response time to result in warning status (seconds)
 -c, --critical=DOUBLE
    Response time to result in critical status (seconds)
 -t, --timeout=INTEGER
    Seconds before connection times out (default: 10)
 -v, --verbose
    Show details for command-line debugging (Nagios may truncate output)

 The most common mode of use is to refer to a local identity file with
 the '-i' option. In this mode, the identity pair should have a null
 passphrase and the public key should be listed in the authorized_keys
 file of the remote host. Usually the key will be restricted to running
 only one command on the remote server. If the remote SSH server tracks
 invocation arguments, the one remote program may be an agent that can
 execute additional commands as proxy

 To use passive mode, provide multiple '-C' options, and provide
 all of -O, -s, and -n options (servicelist order must match '-C'options)

Examples:
 $ check_by_ssh -H localhost -n lh -s c1:c2:c3 -C uptime -C uptime -C uptime -O /tmp/foo
 $ cat /tmp/foo
 [1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c1;0; up 2 days
 [1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c2;0; up 2 days
 [1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c3;0; up 2 days

The check_by_ssh command is not default in XI, but being default or not doesn't matter.

Re: difference between check_xi_by_ssh and check_by_ssh?

Posted: Mon Aug 28, 2017 3:45 pm
by ikekim
Thanks for the explanation.

Now I understand the difference.

ik

Re: difference between check_xi_by_ssh and check_by_ssh?

Posted: Mon Aug 28, 2017 3:50 pm
by dwhitfield
OP, did you have any other questions, or are we ready to lock this up?