Page 1 of 1

check_by_ssh invalid option -- 'w'

Posted: Wed Dec 01, 2021 5:44 am
by arnoldw
From the nagios user on the nagios xi console check_by_ssh complains about:
invalid option -- 'w'
or
unrecognized option '--warning'

system built from nagiosxi ova file
current version of nagios xi is 5.7.2

If I remove '-w' and '-c' options command runs fine.
Usage statement does not include -w and -c but the webUI and cli help for check_by_ssh include the description of the options.

Is there something simple I am missing?

Code: Select all

/usr/local/nagios/libexec/check_by_ssh -q -l remoteuser -i .ssh/id_rsa.remoteuser -H remotehost -w 1.0 -c 5.0 -C 'uptime|cut -f4 -d\ ' -w 180 
/usr/local/nagios/libexec/check_by_ssh: invalid option -- 'w'
without -w/--warning

Code: Select all

/usr/local/nagios/libexec/check_by_ssh -q -l remoteuser -i .ssh/id_rsa.remoteuser -H remotehost -w 1.0 -c 5.0 -C 'uptime|cut -f4 -d\ ' 
6

Re: check_by_ssh invalid option -- 'w'

Posted: Wed Dec 01, 2021 4:14 pm
by pbroste
Hello @arnoldw

Thanks for reaching out, the command uptime 'check_by_ssh' that you are executing is actually the Linux 'uptime' command built-in to the os.

You will want to place the check_uptime into a directory (example: ' "/usr/local/ncpa/plugins/check_uptime" ') on the device that you want to check.

Here is the example that I tested with:

Code: Select all

/usr/local/nagios/libexec/check_by_ssh -l nagios --identity=mykey -H 192.168.xxx.xxx -C "/usr/local/ncpa/plugins/check_uptime -v -u days -w 2 -c 3"
Copy the 'check_uptime' over and set permissions:
scp /usr/local/nagios/libexec/check_uptime username@hosttomoveitto:/your/directory
Thanks,
Perry

Re: check_by_ssh invalid option -- 'w'

Posted: Thu Dec 02, 2021 10:08 am
by arnoldw
The system I am working on is out of band so I can't copy paste from it and I made an error in transcription. The second line should have been missing the "-w 1.0 -c 5.0 ".

without -w/--warning

Code: Select all

/usr/local/nagios/libexec/check_by_ssh -q -l remoteuser -i .ssh/id_rsa.remoteuser -H remotehost -C 'uptime|cut -f4 -d\ ' 
6
The results or the command suppose to be targeting the remote check_command is not what I focusing but that the check_by_ssh command itself is not taking the -w and -c options.

Re: check_by_ssh invalid option -- 'w'

Posted: Fri Dec 03, 2021 10:38 am
by pbroste
Hello @arnoldw

Thanks for steering me onto the path, we tested the switch options for 'critical' and 'warning' timeout connect fail, and found both are not working on the 'check_by_ssh' plugin. I have put in a bug report request to dev for this and expect an update on the status later.

Thanks,
Perry