导入华为设备的相关库

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()

使用 Python 脚本获取华为设备 CPU 信息

原文地址: https://www.cveoy.top/t/topic/n36D 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录