No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search

Reminder

To have a better experience, please upgrade your IE browser.

upgrade

Configuration Guide - Device Management

CloudEngine 8800, 7800, 6800, and 5800 V200R002C50

This document describes the configurations of Device Management, including device status query, hardware management, Information Center Configuration, NTP, Synchronous Ethernet Configuration, Fault Management Configuration, Energy-Saving Management Configuration, Performance Management Configuration, Maintenance Assistant Configuration, and OPS Configuration.
Rate and give feedback:
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
Example for Configuring an Assistant for Automatic Health Check (Using a Python Script)

Example for Configuring an Assistant for Automatic Health Check (Using a Python Script)

Networking Requirements

As shown in Figure 9-3, the remote server is a TFTP server. SwitchA and the TFTP server have reachable routes to each other. To reduce maintenance workload, configure SwitchA to automatically collect health information and send it to the TFTP server for analysis.

Figure 9-3 Networking for automatic health check
NOTE:

The TFTP protocol will bring risk to device security. The SFTP mode is recommended.

Configuration Roadmap

The configuration roadmap is as follows:
  1. Make a Python script, upload, and install it on SwitchA.

  2. Create a script assistant.

Procedure

  1. Make a Python script.

    # Make a Python script named health.py.

    In the Python script, set the trigger condition as timer and the task as executing commands to collect device information, including hardware status, route status, and interface link status, and to send the information to the TFTP server. The Python script is as follows:
    # Define the function of the trigger condition.
    def ops_condition(_ops):
    	_ops.timer.cron("con1","0 1 * * * *")      # Set the timer event.
    	_ops.correlate("con1")
    
    # Define the functions of tasks.
    def ops_execute(_ops):
    	handle, err_desp  = _ops.cli.open()      # Open the CLI channel.
    	_ops.cli.execute(handle,"display device > health.txt")      # Execute CLIs.
    	_ops.cli.execute(handle,"display health >> health.txt")
    	_ops.cli.execute(handle,"display ip routing-table >> health.txt")
    	_ops.cli.execute(handle,"display lldp neighbor brief >> health.txt")
    	_ops.cli.execute(handle,"tftp 10.2.1.1 put health.txt")
    	ret = _ops.cli.close(handle)      # Close the CLI channel.
    	return 0
    

  2. Upload and install the Python script.

    # Configure SwitchA functioning as a TFTP client to download the Python script file health.py from the TFTP server. The Python script is stored on the TFTP server.

    <HUAWEI> system-view
    [~HUAWEI] sysname SwitchA
    [*HUAWEI] commit
    [~SwitchA] quit
    <SwitchA> tftp 10.2.1.1 get health.py
    Info: Transfer file in binary mode.
    Please wait for a while...
    /    635 bytes transferred
    Info: Downloaded the file successfully.
    

    # Install the Python script on SwitchA.

    <SwitchA> ops install file health.py
    

  3. Configure a script assistant.

    <SwitchA> system-view
    [~SwitchA] ops
    [~SwitchA-ops] script-assistant python health.py
    [*SwitchA-ops] commit
    [~SwitchA-ops] return
    

  4. Verify the configuration.

    # Verify the assistant configuration.

    <SwitchA> display ops assistant verbose name health.py
    Assistant information
      Name                 : health.py
      State                : ready
      Type                 : script
      Default assistant    : no
     Running statistics
      Running times        : 0
      Queue size/(free)    : 10/(10)
      Skip for queue full  : 0
      Skip for delay       : 0
      Skip for suppression : 0
      Skip for error       : 0
     Execute information
      Task abstract        : health.py : ops_execute()
     Trigger control
      Occurs threshold     : 1
      Period (s)           : 0
      Delay (s)            : 0
      Suppress max         : 0
      Hits in period       : 0
     Condition information
      Correlate expression : con1
      Condition tag        : con1
        Condition type     : timer
        Subscribe result   : success
        Occurs threshold   : 0
        Period (s)         : 0
        Hits in period     : 0
    

Configuration Files

  • Configuration file of SwitchA

    #
    sysname SwitchA
    #
    ops
     script-assistant python health.py
    #
    
Translation
Download
Updated: 2019-03-21

Document ID: EDOC1000166632

Views: 85261

Downloads: 312

Average rating:
This Document Applies to these Products
Related Documents
Related Version
Share
Previous Next