目的:通过python实现全自动化交换机巡检(每周五下午五点进行自动化巡检)
1、环境:
系统:windows10
工具:python-3.11.2(自行安装)
工具:PyCharm Community Edition 2022.3.3(自行安装)
2、文件
代码参考文件:Automated inspection.txt
自动化代码文件:Automated inspection.py
调用巡检命令文件:command.txt
巡检设备文件:sw.txt
巡检记录文件夹:巡检记录
如图:

3、操作
开始巡检

巡检完成自动保存到"巡检记录"文件夹中
巡检内容部分查看(此交换机为测试交换机)
诊断收集情况 
手动停止代码

4、代码测试
拿到代码后可修改代码中的参数用来测试
首先需要将文件sw.txt中的ip地址修改为实际需要巡检的ip地址,首次测试通过后再批量添加

代码修改
第一次测试可以将93行代码注释掉,然后将96行的代码去掉注释
测试完成后记得改回来