check-linux-by-ssh
check-linux-by-ssh copied to clipboard
Return code from remote check not prorperly handled
When using check_ssh_proxy_check.py to lookup at another check on a remote machine, the actual return code from the check is not properly handle.
Let's say I want to execute 'check_something', the return code (OK, WARNING, CRITICAL,UNKNOWN) is never handled by check_ssh_proxy_ssh.py resulting in a permanent OK state for the service, even though the remote check is CRITICAL.
When looking to the pyton code, it finishes by : print result sys.exit(0)
The latest line explains the 'permanent OK' state.
Totally newbie in Python language, so cannot figure out a way to do this... :(
Jose L.
Ok found a way to fix it.
here's the diff (I will try to pull a request) :
linux$ diff my_check_ssh_proxy_check.py check_ssh_proxy_check.py
64,65d63
< return_code = stdout.channel.recv_exit_status()
<
69c67
< return return_code,lines[0].strip()
---
> return lines[0].strip()
111c109,112
< nagios_status,nagios_text= execute_check(client, check_path)
---
> result = execute_check(client, check_path)
>
> print result
> sys.exit(0)
113,114d113
< print nagios_text
< sys.exit(nagios_status)
@marcosjl did you submit the PR and if so can you reference it in this issue so i can merge and close both. Thx a lot