This section provides an example for configuring an assistant for automatic health check using commands.
As shown in Figure 1, the remote server is a TFTP server. Device A and the TFTP server have reachable routes to each other. To reduce maintenance workload, configure DeviceA to automatically collect health information and send it to the TFTP server for analysis.
Create a command assistant and set a timer as the trigger condition for the assistant, so that the assistant performs health check periodically.
Specify the commands that the command assistant runs to collect health information and send it to the TFTP server.
# Create a command assistant and configure it to run at 1:00 a.m. every day.
<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
# Specify the commands that the command assistant runs to collect information, such as the hardware status, route status, and interface link status, save the collected information in a file, and send the file to the 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
# Check the configuration of the command assistant.
<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 : --
Device A configuration file
# 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 * * * * #