[Check_mk (english)] sftp check not working ->Fixed

Avalon IT | Sander Brouwer support at avalon-it.nl
Sat Feb 9 09:18:59 CET 2019

Hi Marcel

answering yes did not help, but the --verbose confirmed what i expected; 
it is still listening to 22, not 8022:

Traceback (most recent call last):
   File "/omd/sites/monitor/lib/nagios/plugins/check_sftp", line 248, in <module>
   File "/omd/sites/monitor/lib/nagios/plugins/check_sftp", line 188, in main
     client = connection()
   File "/omd/sites/monitor/lib/nagios/plugins/check_sftp", line 116, in connection
     client.connect(opt_host, username=opt_user, password=opt_pass, timeout=opt_timeout)
   File "/omd/sites/monitor/lib/python/paramiko/client.py", line 324, in connect
     raise NoValidConnectionsError(errors)
*paramiko.ssh_exception.NoValidConnectionsError: [Errno None] Unable to 
connect to port 22 on*

now if i open this file check_sftp i notice in this part:

def connection():
     client = paramiko.SSHClient()
     if opt_key == None:
         client.connect(opt_host, username=opt_user, password=opt_pass, port=opt_port, timeout=opt_timeout)
	client.connect(opt_host, username=opt_user, pkey=opt_key, port=opt_port, timeout=opt_timeout)
     return client

In the connect strings the 'port=opt_port' part was missing, so i added it.
Only now it complained that it was getting a string instead of a number so i tried in the part where the variables where assigned to change
this part:
  elif opt in [ '--port' ]:   opt_port = arg
to :  elif opt in [ '--port' ]:      opt_port = int(arg)

saved and tried and to my surprise it worked :)

So thank you kindly for your help :)
I suppose this bug should be reported so it can be fixed in the next version?


> Hi Sander,
> now that you have entered 'yes' to the question of the right key, does
> thois command work as siteuser?
> ~/lib/nagios/plugins/check_sftp --host=  --user=[user
> --secret=[secret] --port=8022
> If not, what is the output of the command, if you extend it by '--verbose'?
> BR,
> Marcel
> Am Fr., 8. Feb. 2019 um 23:30 Uhr schrieb Avalon IT | Sander Brouwer
> <support at avalon-it.nl>:
>> ok i figured out how to do the check manually, wasn't reading Marcel's
>> instruction right :(
>> so i run als site owner: ~/lib/nagios/plugins/check_sftp
>> --host=  --user=[user --secret=[secret] --port=8022
>> response: CRIT - Connection failed! (the same my check_mk told me)
>> then i run:
>> OMD[monitor]:~$ sftp -oPort=8022 [user]@
>> The authenticity of host '[]:8022 ([]:8022)' can't
>> be established.
>> ECDSA key fingerprint is SHA256:haPMAIdiScdB/WW....
>> ECDSA key fingerprint is MD5:6b:de:39:a3:6c:b3:43:4b:......
>> Are you sure you want to continue connecting (yes/no)?
>> I type yes, the the passwd and i'm in
>> What else can we try to solve this / see if Check_mk really uses the
>> right port?
>> Txs
>> Sander
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mathias-kettner.de/pipermail/checkmk-en/attachments/20190209/012ed741/attachment.html>

More information about the checkmk-en mailing list