华为设备使用python写脚本并加上注释输入display cpu
导入华为设备的相关库
from netmiko import ConnectHandler
定义华为设备的相关参数
huawei_device = { "device_type": "huawei", "ip": "192.168.1.1", "username": "admin", "password": "password" }
连接华为设备
connection = ConnectHandler(**huawei_device)
输入display cpu命令并获取结果
output = connection.send_command("display cpu")
打印结果
print(output)
关闭连接
connection.disconnect()
原文地址: https://www.cveoy.top/t/topic/fbo8 著作权归作者所有。请勿转载和采集!