Example for Configuring an Assistant for Automatic Health Check (Using Commands)

This section provides an example for configuring an assistant for automatic health check using commands.

Networking Requirements

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.

Figure 1 Automatic health check using commands

Configuration Roadmap

The configuration roadmap is as follows:
  1. Create a command assistant and set a timer as the trigger condition for the assistant, so that the assistant performs health check periodically.

  2. Specify the commands that the command assistant runs to collect health information and send it to the TFTP server.

Procedure

  1. Configure a command assistant.

    # 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
    

  2. Verify the configuration.

    # 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     : --
    

Configuration Files

  • 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 * * * *
    #
    
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
Next topic >