check-linux-by-ssh icon indicating copy to clipboard operation
check-linux-by-ssh copied to clipboard

Return code from remote check not prorperly handled

Open marcosjl opened this issue 11 years ago • 2 comments

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.

marcosjl avatar Nov 27 '14 10:11 marcosjl

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 avatar Nov 28 '14 07:11 marcosjl

@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

david-guenault avatar May 03 '16 09:05 david-guenault