评分并提供意见反馈 :
华为采用机器翻译与人工审校相结合的方式将此文档翻译成不同语言,希望能帮助您更容易理解此文档的内容。 请注意:即使是最好的机器翻译,其准确度也不及专业翻译人员的水平。 华为对于翻译的准确性不承担任何责任,并建议您参考英文文档(已提供链接)。
配置自动检查设备健康状态示例(基于命令行维护助手)
通过配置命令行维护助手,可以自动检查设备的健康状态。
组网需求
如图6-1所示,远程服务器提供TFTP Server功能,DeviceA与TFTP Server之间路由可达。用户希望设备能够自动收集每天的健康状态信息,并将信息发送至TFTP Server以供分析,减少手工的维护工作量。
操作步骤
- 配置命令行维护助手
# 创建一个命令行维护助手,并设置维护助手执行的时间为每天的凌晨1点。
<HUAWEI> system-view [~HUAWEI] sysname DeviceA [*HUAWEI] commit [~DeviceA] ops [~DeviceA-ops] assistant collect_health [*DeviceA-ops-assistant-collect_health] condition timer cron 0 1 * * * * [*DeviceA-ops-assistant-collect_health] commit
# 配置命令行维护助手执行的命令行。命令行需要收集设备的硬件状态、路由状态、接口链路状态等信息,将信息保存至文件并发送至TFTP Server。
[~DeviceA-ops-assistant-collect_health] execute 1 command display device > health.txt [*DeviceA-ops-assistant-collect_health] execute 1.5 command display health >> health.txt [*DeviceA-ops-assistant-collect_health] execute 2 command display ip routing-table >> health.txt [*DeviceA-ops-assistant-collect_health] execute 2.5 command display lldp neighbor brief >> health.txt [*DeviceA-ops-assistant-collect_health] execute 3 command tftp 10.2.1.1 put health.txt [*DeviceA-ops-assistant-collect_health] commit [~DeviceA-ops-assistant-collect_health] return
- 检查配置结果
# 查看命令行维护助手配置。
<DeviceA> display ops assistant verbose name collect_health Assistant : collect_health Task abstract : display device > health.txt; display health >> health.txt; display ip routing-table >> health.txt; display lldp neighbor brief >> health.txt; tftp 10.2.1.1 put health.txt; Trigger time : 0000-00-00 00:00:00 State : ready Running times : 0 Trigger type : timer Trigger event : --
配置文件
# DeviceA的配置文件
# sysname DeviceA # ops assistant collect_health execute 1 command display device > health.txt execute 1.5 command display health >> health.txt execute 2 command display ip routing-table >> health.txt execute 2.5 command display lldp neighbor brief >> health.txt execute 3 command tftp 10.2.1.1 put health.txt condition timer cron 0 1 * * * * #