Python monitor SSH Telnet SNMP command Material
First, refer https://blog.csdn.net/yannanxiu/article/details/55045108 Scenario: Windows -------- Monitor -------- > Linux via paramiko SSH login with psutil to get informaiton import paramiko import os import psutil import json ##读取当前路径 base_dir=os.getcwd() ##读取在远程主机执行的脚本 cmd_filepath=base_dir+r"\pu.txt" cmd_file=open(cmd_filepath,"r") cmd=cmd_file.read() ##连接远程主机 client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect("192.168.42.62", 22,'root','Abcd1234') ##执行命令 stdin, stdout, stderr = client.exec_command(cmd) ##读取信息 for line in stdout: data