Good afternoon,
I have a sh script that connects via SSH to a remote machine and runs a robotframework program. When the program ends, I save the output value to check if it finished well. I attach the script:
"#!/bin/bash
sshpass -p 'pass' /usr/bin/ssh -p 22 user@host robot d:/monitor-rfk/robot/company-space-test-plan.robot
valor=$?
if [ $valor -eq 0 ]
then
echo "OK: Passed 1 of 1 tests"
exit 0
else
echo "CRITICAL: Failed 1 of 1 tests"
exit 2
fi"
If I run the script on the server it works fine, but if I pass it to nagios it comes out as critical.
I have looked at the output value that appears in nagios and it is a 6. If I do it on the server it is 0. What could it be due to?
Attached command file and services file
" define command{
command_name my-eventhandler
command_line $USER1$/prueba2.sh
}"
define service {
use local-9min ; Name of service template to use
host_name checkmknodo1
service_description SlaCarpetaEmpresa
check_command my-eventhandler
}
Thanks!
Status Information 6
Re: Status Information 6
I would suggest you give the check_by_ssh plugin a try, and see if you get different results:
https://nagios-plugins.org/doc/man/check_by_ssh.html
That plugin is included with the standard nagios-plugins suite, and may already be sitting on your Nagios Core machine:
https://github.com/nagios-plugins/nagios-plugins
https://support.nagios.com/kb/article/n ... e-569.html
Nagios Core executes everything with popen, which doesn't necessarily bring with it an entire Bash environment like you would have when executing something via a console/SSH session. It's possible Nagios Core isn't able to find the sshpass binary for this reason. You could try changing your script to include the full path to the sshpass binary.
https://nagios-plugins.org/doc/man/check_by_ssh.html
That plugin is included with the standard nagios-plugins suite, and may already be sitting on your Nagios Core machine:
https://github.com/nagios-plugins/nagios-plugins
https://support.nagios.com/kb/article/n ... e-569.html
Nagios Core executes everything with popen, which doesn't necessarily bring with it an entire Bash environment like you would have when executing something via a console/SSH session. It's possible Nagios Core isn't able to find the sshpass binary for this reason. You could try changing your script to include the full path to the sshpass binary.
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/