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

S7700 and S9700 V200R013C00

This document describes the configurations of Device Management, including device status query, hardware management, CSS, SVF, PoE, OPS, OIDS, energy-saving management, information center, fault management, NTP, synchronous ethernet, PTP.
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 Detecting Device Overtemperature Through Association Between OIDS and OPS

Example for Detecting Device Overtemperature Through Association Between OIDS and OPS

Networking Requirements

In Figure 7-3, the user remotely manages a switch through a network and wants to detect device overtemperature through association between OIDS and OPS. When the device temperature exceeds the upper threshold of the temperature sensor, an alarm is generated to indicate that the device is not operating in normal conditions.

Figure 7-3  Detecting device overtemperature through association between OIDS and OPS

Configuration Roadmap

  1. Make a Python script temp.py to diagnose device overtemperature.

  2. Log in to the switch remotely, upload the Python script to the switch, and install the script.

  3. Configure a Python script assistant.

Procedure

  1. Make a Python script.

    # Make the Python script temp.py to implement the following functions:
    • The script registers a sensor overtemperature event to ensure that prompt information is displayed when the device temperature is too high.

    • The script writes back OIDS environment variables and event execution result to OIDS. To view the event execution result, run the display oids history-result command and focus on the Record field.

    NOTE:

    If you want to view the information displayed by the print statement in an OPS script, log in to the switch through the console port.

  2. Upload and install the Python script.

    # Log in to the switch remotely and upload the Python script to the switch. For details about how to upload the script, see File Management in S7700 and S9700 V200R013C00 Configuration Guide - Basic Configuration.

    # Install the Python script on the switch.

    <Switch> ops install file temp.py

  3. Configure a Python script assistant.

    # Configure a Python script assistant and register the CLI event in the script temp.py. Wait for the event to be triggered.

    <Switch> system-view
    [Switch] ops
    [Switch-ops] script-assistant python temp.py
    [Switch-ops] quit

  4. Verify the configuration.

    # After the preceding configurations are complete, set the threshold of the temperature sensor with a specified ID, and check whether there is prompt information on the switch and whether OIDS environment variables and event execution result are written back to OIDS.

    # Check the device temperature.

    [Switch] display temperature all
    ------------------------------------------------------------------------------ 
     Slot  Card  Sensor  Status   Current(C)  Lower(C) Lower     Upper(C) Upper     
                                                       Resume(C)          Resume(C) 
    ------------------------------------------------------------------------------- 
     1     -     1       Normal   36          0        3         67       65        
     2     -     1       Normal   33          0        3         64       62        
           -     2       Normal   32          0        3         60       58        
     3     -     1       Normal   36          0        3         64       62        
           -     2       Normal   32          0        3         57       55        
     6     -     1       Normal   34          0        3         64       62        
           -     2       Normal   28          0        3         58       56        
           -     3       Normal   28          0        3         58       56        
     7     -     1       Normal   32          0        3         64       62        
           -     2       Normal   32          0        3         64       62      
    

    # Set the threshold of temperature sensor 1 in slot 3 to 30, which is lower than the current device temperature 36.

    [Switch] diagnose
    [Switch-diagnose] set tempsns slot 3 sensor 1 major 30
    Info: The major threshold of sensor[1] is successfully set.
    
    NOTE:

    The monitoring period of a temperature sensor is 5 minutes. An OIDS event may not be triggered immediately after the temperature sensor threshold is changed.

    # Run the display oids history-result command in any view to check the OIDS diagnostic result within the last 1 hour.
    [Switch-diagnose] display oids history-result
    ----------------------------------------------------------------------          
    Slot               : 3                                                       
    ObjectName         : Temp_Sensor_1                                              
    AttrName           : Temperature                                                
    Event              : Temperature High                                           
    Event time         : 2019-01-13 15:03:35                                        
    Diagnose begin time: 2019-01-13 15:03:35                                        
    Diagnose end time  : 2019-01-13 15:03:35                                        
    Diagnose result    : Normal                                                     
    Record             : tempy.py run for temperature high.(slot=3, typeName=TEMP, o
    bjectName=Temp_Sensor_1, attributeName=Temperature, eventName=Temperature High, 
    value=36, unit=C) 
    State value        : 36C                                                        
    Record from        : temp.py                                                 
    ---------------------------------------------------------------------- 

Configuration Files and Scripts

  • Configuration file of the switch

    #
    ops
     script-assistant python temp.py
    #
    return
  • Example of the temp.py script

    # -*- coding: utf-8 -*-
    import ops         # Import the OPS module.
    import sys         # Import the sys module.
    import os          # Import the OS module.
    # Subscription processing function
    def ops_condition (_ops):
    	# Subscribe to the sensor overtemperature event.
    	ret, desp = _ops.oids.subscribe("tempHigh", 'TEMP', 'Temperature High')
    	if ret != 0:
    	    print("\r\nError: subscribe failed(ret={0}, desp={1}".format(ret, desp))
    	return 0
    	# Work processing function
    def ops_execute (_ops):
    	# Obtain the OIDS environment variable.
    	slot, errStr = _ops.environment.get('_oids_slot') 
    	typeName, errStr = _ops.environment.get('_oids_type_name')                   
    	objectName, errStr = _ops.environment.get('_oids_object_name') 
    	attributeName, errStr = _ops.environment.get('_oids_attribute_name') 
    	eventName, errStr = _ops.environment.get('_oids_event_name')    
    	value, errStr = _ops.environment.get('_oids_value')
    	unit, errStr = _ops.environment.get('_oids_unit')
    	# Write back event execution result to OIDS.
    	_ops.oids.result(False, "tempy.py run for temperature high..(slot={0}, typeName={1}, objectName={2}, attributeName={3}, eventName={4}, value={5}, unit={6})".format(slot, typeName, objectName, attributeName, eventName, value, unit))
    	return 0
Translation
Download
Updated: 2019-04-20

Document ID: EDOC1100065738

Views: 44358

Downloads: 37

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