The meaning is this, I want to write not a big creak that will go to a remote server and ping a large number of devices, it will not ping through normal ping, but through running the script on a remote server, i.e. my creak goes to the server and starts blablabla.sh 192.168.1.1, but this is not important. The bottom line is that when performing ping through a scratch on the server, an error is not returned to me if the device is available the script responds: Looking for OpenVPN client with MAC CCCCCCCCCCC... found! if the device is not available then: Looking for OpenVPN client with MAC CCCCCCCCCCC... not found! So the question is this: is it possible to somehow check print for its output, if found there! or not found! That, respectively, the creak writes is working or not working. Devices will be much more than 100 pcs.

 import paramiko import re import time host = 'IP' user = 'LOGIN' port = PORT ssh = 'PATH' a = 'NAME1' a1 = 'NAME2' a2 = 'NAME3' client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect(hostname=host, username=user, port=port, key_filename=ssh) stdin, stdout, stderr = client.exec_command('sudo ping_sens.sh CCCCCCCCCC') data = stdout.read() + stderr.read() print(data) 

Conclusion: Looking for OpenVPN client with MAC CCCCCCCCCC... found!

  • Yes, the script can read the output of a program launched by it or another script. - Sergey Gornostaev
  • I need to read print - sakhalin
  • If you have print (x) in your program, you don’t even need to read anything. And if this is not in your program, it is already written above that it is possible. - Vladimir Martyanov
  • What specifically causes difficulties? 1- how to run a command on a remote server in Python? (for example, via ssh - fabric / pyinvoke) 2- How to read the output of this command? 3- How to get information out of the lines? 4- how to speed up the work for the survey of 100 devices? - jfs
  • @jfs How to read the print output so that the word will be found in the output: either found or not found and the dependence on the output option works or does not work. - sakhalin

0