Monitor the status of device power modules using SNMP

更新时间:
复制 MD 格式

This topic describes how to configure Simple Network Management Protocol (SNMP) monitoring from scratch to collect the status of device power modules.

Note

This topic uses power module configuration as an example to describe the steps for monitoring device power module status using SNMP. The procedure for monitoring fan status, temperature, and other components is similar. Simply replace the metric name and Object Identifier (OID) value in this topic with the appropriate values.

Prerequisites

Procedure

Step 1: Create a metric. For more information, see Metric Management.

  1. Log on to the Cloud Managed Network console.

  2. In the navigation pane on the left, click Network Monitoring > Metric Management.

  3. Above the list, click the Create Metric button and select Create Single-Device Metric.

  4. On the Create Metric page, enter the basic information for the metric, such as Metric Name, Description, and Collection Method.

    1. Define a globally unique name for the metric, such as Power_State_Monitor.

    2. Enter a description for the metric. Describe the purpose of the metric to simplify future maintenance. For example, "Monitors the status of device power modules using SNMP. A returned status code of 2 indicates Normal."

    3. Select the security domain where the metric applies, such as CMN-01. The probe in the selected security domain initiates data collection, and the scope is limited to devices within that security domain.

    4. Select the device type. For example, if you select Network Device, the metric collection scope is limited to network devices in the specified security domain.

    5. Select the SNMP collection type. Valid values are get, getNext, getBulk, getWalk, and snmpwalk. In this example, select snmpwalk.

    6. Turn on the Enable switch. Data is collected only when the metric is enabled.

    7. Write the parsing code. The following code is for reference only. Modify it as needed.

      /** The output collected by SNMP is in the following format. Therefore, parse data["output"]["results"]
       {"output":{"results":[{"value":"22","oid":"1.3.6.1.4.1.4881.1.1.10.2.1.1.43.1.4"},{"value":"33","oid":"1.3.6.1.4.1.4881.1.1.10.2.1.1.43.1.5"}]}}
      **/
      function parse(output){
            var result = {};
            var data = JSON.parse(output);
         
          if(data.output.results.length == 0){
           return JSON.stringify(results); 
          }
       data.output.results.forEach(function(kv,index){
            var value = kv["value"];
            result["power_"+index] = value;   
            // Most network devices have multiple power modules. In this example, an index is used to generate data items such as power_0, power_1, and power_2.
        });
          
         // Return a JSON-formatted string. In this example, the returned result is {"power_0":"2","power_1":"2"}
         return JSON.stringify(result);
      }
      Note

      The OIDs used to collect the status of device power modules using SNMP are private. Therefore, the OIDs and output content vary by manufacturer and model. Write the parsing code based on the actual output. The preceding code is for reference only.

    8. (Optional) Add an alert rule. For more information, see Metric Management.

Step 2: Deploy metrics. For more information, see Deploy metrics.

  1. In the navigation pane on the left, click Network Monitoring > Deploy Metrics.

  2. From the drop-down list, select the metric that you created in Step 1: Power_State_Monitor. You can perform a fuzzy search by metric name.

  3. The system automatically displays a list of manufacturers and models. Select the check box next to the model to which you want to apply the metric. For example, to monitor a Juniper MX480 device, select the check box for that model.

  4. For SNMP metrics, set an OID for each manufacturer and model because the OIDs may be private and can vary. This topic uses a Juniper MX480 device as an example. Enter 1.3.6.1.4.1.2636.3.1.13.1.6.2

  5. Click the Submit button to save the deployment configuration. The system then sends the configuration to the probe and starts data collection.

Step 3: View the alert status. For more information, see Alert Status View.

  1. In the navigation pane on the left, click Network Monitoring > Alert Status View.

  2. On the left, select a physical space. The status of all collected metrics and devices in that physical space is displayed on the right. To view the monitoring status of a specific device or metric, enter search criteria in the search bar and click the Query button to filter the results.

  3. Click the Details button for more information.

  4. Click the Device View button to open the device view. This page displays all monitoring data and historical trends for the specified device.