import netmiko from netmiko import ConnectHandler import time import os today = time.strftime("%Y-%m-%d", time.localtime()) switch_with_authentication_issue = [] # 存放认证失败的设备信息 switch_not_reachable = [] # 存放网络不通的设备信息 def ssh_session(devlist): ##定义备份函数 try: list = line.split(",") hostname = list[0] hostname = str(list[0]) devtype = list[1] ip = list[2] admin = list[3] devpasswd = list[4].replace('\n','') #去除换行符 conn = ConnectHandler(device_type=devtype, host=ip, username=admin, password=devpasswd, ) time.sleep(1) print(f'已成功登陆交换机{hostname}') if devtype == 'hp_comware': ##H3C output = conn.send_command_timing('screen-length disable\n d
python多厂商巡检脚本~
最新推荐文章于 2024-06-07 13:01:43 发布