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

eSight V300R010C00SPC200, 300, and 500 Self-Service Integration Guide 11

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).
Performance Management APIs

Performance Management APIs

Query Historical Data

Function

This interface is used to query counter data of devices.

You are advised to use the FTP northbound API to obtain historical performance data through a third party. If you want to use the open API for query, you are advised to use the Query Historical Data (by Indicator) API.

URI

/rest/openapi/pm/history

Access Method

POST

Request Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Headers

String

Indicates a session ID, used for open API authorization.

NOTE:

A third-party system invokes the login interface of the security management module to obtain the value of this parameter.

mos

Mandatory

URL

String

Indicates the JSON character string composing NE information arrays. NE information consists of the following fields:

  • dn: indicates the NE DN. This field is mandatory and of the string type.
  • displayValue: measurement object name, which corresponds to the measurement object column on the performance data page. For interfaces and cards, the value is usually the interface name or card name. The value type is string. This parameter is optional.
NOTE:
  • The value of dn can be obtained from the nedn field in Query the Network Device List.

meastypeids

Mandatory

URL

String

Indicates the counter ID.

NOTE:
  • Use commas (,) to separate multiple indicator IDs.
  • The indicator ID can be obtained from the collectindex_id field in the tbl_collect_index table in the OMSPM database. For example, to query the CPU usage of a board of the Oracle database, run the following SQL statement:

    select collectindex_id from omspm.tbl_collect_index where restype = 'slot' and indexgroup = 'CpuState' and indextype = 'cpuUsage';

  • For details about the restype, indexgroup, and indextype fields, see Performance Indicator List.

beginTime

Mandatory

URL

long

Indicates the start time (UTC time). The time is accurate to milliseconds.

endTime

Mandatory

URL

long

Indicates the end time (UTC time). The time is accurate to milliseconds.

Request Example

POST https://10.120.70.220:32102/rest/openapi/pm/history?mos=[{"dn":"NE=34603017","displayValue":"Slot:MPU Board 0"}]&meastypeids=66&beginTime=1534903300215&endTime=1534903303215

Headers: key = openid, value = d21ee8aae2f9c05b2098e82a33b3430b37e1c6980d26004f

Response Parameters

Field

Value Type

Description

result

int

Indicates the return code. The options are as follows:

  • 0: succeeded
  • 1: failed

data

Object

Indicates the return information.

The following table lists the fields contained in the data object.

Field

Value Type

Description

result

HistoryQueryData

Indicates the historical performance data map.

resultCode

int

Indicates the return code. The options are as follows:

  • 0: succeeded
  • 1: failed

resultDesc

String

Indicates the description of the returned result.

The following table lists the fields contained in the HistoryQueryData object.

Field

Value Type

Description

totalPage

int

Indicates the total number of pages.

resultData

List<HistoryQueryValue>

Indicates the search results.

groupQueryData

List<List<HistoryQueryValue>>

Indicates the sorted search results.

startTime

long

Indicates the start time (UTC time). The time is accurate to milliseconds.

endTime

long

Indicates the end time (UTC time). The time is accurate to milliseconds.

timeDisplayInfos

List<TimeDisplayInfo>

Indicates the mapping between the timestamp and display value.

yAxisScaleCount

int

Indicates the scale value in the Y axis.

The following table lists the fields contained in the HistoryQueryValue object.

Field

Value Type

Description

dn

String

Indicates the NE DN.

neName

String

Indicates the NE name.

displayValue

String

Indicates the name of a measurement object connected to an NE.

displayValueKey

String

Indicates the name key of a measurement object connected to an NE.

indexId

int

Indicates the counter ID.

indexName

String

Indicates the counter name.

indexUnit

String

Indicates the counter unit.

oper

String

Indicates the threshold operator.

thresholdList

List<Float>

Indicates the threshold information.

indexValues

List<HistoryIndexValue>

Indicates the counter data.

resourceType

String

Indicates the resource type.

indexGroup

String

Indicates the counter group.

displayRate

long

Indicates the display period, in seconds.

indexKey

String

Indicates the counter key.

The following table lists the fields contained in the HistoryIndexValue object.

Field

Value Type

Description

timestamp

long

Indicates a data collection timestamp (UTC time). The time is accurate to milliseconds.

timestampStr

String

Indicates the timestamp content.

indexValue

String

Indicates the counter data.

breakpoint

boolean

Indicates whether the performance curve is broken.

  • true: The performance curve is broken.
  • false: The performance curve is continuous.

The following table lists the fields contained in the TimeDisplayInfo object.

Field

Value Type

Description

timestamp

long

Indicates the timestamp (UTC time). The time is accurate to milliseconds.

timestampStr

String

Indicates the timestamp text. The display rule is as follows:

  • When the scale range is less than 60*1000 ms, the parameter is converted to the MM-dd HH:mm:ss format.
  • When the scale range is greater than or equal to 60*1000 ms and less than 60*60*60*1000 ms, the parameter is converted to the MM-dd HH:mm format.
  • When the scale range is greater than or equal to 60*60*60*1000 ms, the parameter is converted to the MM-dd format.

Response Example

{
  "result": 0,
  "data": "{\"resultCode\":0,\"result\":{\"totalPage\":1,\"resultData\":[{\"dn\":\"NE=34603017\",\"neName\":\"Quidway-234\",\"displayValue\":\"Slot:MPU Board 0\",\"displayValueKey\":\"Slot:MPU Board 0\",\"indexId\":66,\"indexName\":\"Board CPU usage\",\"indexUnit\":\"%\",\"oper\":\"\",\"thresholdList\":[-1.0,-1.0,-1.0,-1.0],\"indexValues\":[],\"resourceType\":\"slot\",\"indexGroup\":\"CpuState\",\"displayRate\":0,\"indexKey\":\"cpuUsage\"}],\"groupQueryData\":null,\"startTime\":1534903300215,\"timeDisplayInfos\":[{\"timestamp\":1534903301000,\"timestampStr\":\"08-22 10:01:41\"},{\"timestamp\":1534903302000,\"timestampStr\":\"08-22 10:01:42\"},{\"timestamp\":1534903303000,\"timestampStr\":\"08-22 10:01:43\"}],\"endTime\":1534903303215,\"yAxisScaleCount\":7},\"resultDesc\":null}"
}

Precautions

  • Users can query the data generated in one year.
  • The total number of queried counters (Number of counters x Number of devices) cannot exceed 100. The upper limits of the counters and devices are 10 for each.

Example

package com.huawei.oms.ros.test;

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;
import com.huawei.oms.ros.test.GlobalVar;
import com.huawei.oms.ros.test.NewHttpsAccess;
import com.huawei.oms.ros.test.NewRosSecurity;

/**
 * Query Historical Performance Data
 */
public class QueryPmHistory {
 private static final String PM_DATA = "/rest/openapi/pm/history";

 public static void main(String[] args) throws Exception {
  Login.login();
  queryPmHistoryTest();
 }

 public static void queryPmHistoryTest() throws Exception {
  //set the URL and method
  String openidURL = PM_DATA;
  String method = "POST";
  
  //set headers
  BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
  //set parameters
  BasicNameValuePair[] parameters =
        {
                new BasicNameValuePair("mos", "[{\"dn\":\"DN=TEST_ME_1367737041745\",\"displayValue\":\"3, Intel\"}]"), 
                new BasicNameValuePair("meastypeids", "1143"), 
                new BasicNameValuePair("beginTime", "1367651166413"), 
                new BasicNameValuePair("endTime", "1367737566413")
        };
  
  //send the request
  HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
  //get the result
  String body = NewHttpsAccess.getResult(response);
  System.out.println(body);
 }
}

The returned result is as follows:

{
    "result":0,
    "data":"{\"resultCode\":0, ...(omitted here) ,\"resultDesc\":null}"
}

Values of the data field can be converted to the following JSON object:

{
    "resultCode": 0,
    "result": {
        "totalPage": 1,
        "resultData": [{
            "dn": "NE=34603115",
            "neName": "WLAN_AC_Location",
            "displayValue": null,
            "displayValueKey": null,
            "indexId": 64,
            "indexName": "NE average Memory usage",
            "indexUnit": "%",
            "oper": ">",
            "thresholdList": [ - 1.0, 50.0, -1.0, -1.0],
            "indexValues": [{
                "timestamp": 1484728200000,
                "timestampStr": "2017-01-18 16:30:00",
                "indexValue": "29.86",
                "breakpoint": false
            },
            {
                "timestamp": 1484728200000,
                "timestampStr": "2017-01-18 16:30:00",
                "indexValue": "24.67",
                "breakpoint": false
            }],
            "resourceType": "device",
            "indexGroup": "NeMemState",
            "displayRate": 0,
            "indexKey": "memUsage"
        },
        {
            "dn": "NE=34603224",
            "neName": "WLAN_AC_Location",
            "displayValue": null,
            "displayValueKey": null,
            "indexId": 64,
            "indexName": "NE average Memory usage",
            "indexUnit": "%",
            "oper": ">",
            "thresholdList": [ - 1.0, 50.0, -1.0, -1.0],
            "indexValues": [{
                "timestamp": 1484728200000,
                "timestampStr": "2017-01-18 16:30:00",
                "indexValue": "29.86",
                "breakpoint": false
            },
            {
                "timestamp": 1484728200000,
                "timestampStr": "2017-01-18 16:30:00",
                "indexValue": "24.67",
                "breakpoint": false
            }],
            "resourceType": "device",
            "indexGroup": "NeMemState",
            "displayRate": 0,
            "indexKey": "memUsage"
        }],
        "groupQueryData": null,
        "startTime": 1484728028787,
        "timeDisplayInfos": [{
            "timestamp": 1484728080000,
            "timestampStr": "01-18 16:28"
        },
        {
            "timestamp": 1484728200000,
            "timestampStr": "01-18 16:30"
        }],
        "endTime": 1484728928787,
        "yAxisScaleCount": 7
    },
    "resultDesc": null
}

Create a Real-Time Performance Task

Function

This interface is used to create a real-time performance task.

  1. The life cycle of a real-time performance task is specified by the northTaskAgeingTime parameter in the <Installation directory>/AppBase/etc/oms.pm/pm.properties file. The default value is 120 minutes. The task is automatically deleted after the life cycle ends.
  2. The number of real-time performance tasks created for one third-party system (SystemID) is limited. The maximum number is specified by the maxTaskPerNorthSystem parameter in the <Installation directory>/AppBase/etc/oms.pm/pm.properties file. The default value is 50, and the value range is 1-50. The number of tasks equals the number of measurement objects times the number of collected indicators. New tasks cannot be created after the number of real-time performance tasks reaches the maximum. For example, if there are five measurement objects, and four indicators need to be collected for each object, 20 real-time performance tasks need to be created.
  3. The maximum number of indicators that each real-time performance task can collect is specified by the maxIndicatorPerNorthTask parameter in the <Installation directory>/AppBase/etc/oms.pm/pm.properties file. New tasks cannot be created after the number of indicators reaches the maximum.
  4. A maximum of 10 third-party systems can simultaneously deliver real-time performance tasks. The total number of real-time performance task delivery users of the third-party system and eSight cannot exceed 10. For example, if two users are delivering real-time performance tasks on eSight, only 8 third-party systems can deliver real-time performance tasks.

URI

/rest/openapi/pm/realtimePerformance

Access Method

PUT

Request Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Headers

String

Indicates a session ID, used for open API authorization.

NOTE:

A third-party system invokes the login interface of the security management module to obtain the value of this parameter.

systemID

Mandatory

URL

String

Indicates the third-party system ID.
NOTE:

The value is a string of 1 to 64 valid characters including uppercase letters A to Z, lowercase letters a to z, digits 0 to 9, and special characters except [], {}, =, and space characters.

This parameter is configured through the id field under system in the configuration file eSight\AppBase\etc\oms.ros\ros.web.notification.xml. The modification takes effect upon restart.

taskID

Mandatory

URL

String

Indicates the real-time performance task ID defined by a third-party system. For a performance update task, the latest task ID takes effect.

neDN

Optional

URL

String

Indicates the unique device DN on eSight. If a third-party system does not synchronize resources from eSight, the device IP address is recommended as the device DN.

neIpAddress

Optional

URL

String

Indicates the device IP address. Either the device DN or the IP address is mandatory, and the value must be the same as that on eSight. If both the device DN and IP address are available, the device DN is used.

subResourceName

Mandatory

URL

String

Indicates the name of a sub-resource in the device (measurement object name, which corresponds to the measurement object column on the performance data page).

NOTE:

When subResourceType is set to slot, eSight collects information from all boards of the devices when subResourceName = "".

subResourceType

Mandatory

URL

String

Indicates the sub-resource type of a device, which is defined by Huawei. For details, see the restype field in Performance Indicator List.

NOTE:

Currently, only slot and interface are supported.

indicatorsGroupKey

Mandatory

URL

String

Indicates the indicator group ID. For details, see the indexgroup field in Performance Indicator List.

indicatorsData

Mandatory

URL

List

Indicates the collection of key values (indicator list in an indicator group).

periodType

Mandatory

URL

int

Indicates the collection interval. The options are as follows:

  • 1. 5s
  • 2. 10s
  • 3. 15s
  • 4. 30s

The following table lists the fields contained in the indicatorsData object.

Field

Value Type

Description

indicatorKey

String

Indicates the indicator key value. For details, see the indextype field in Performance Indicator List.

symbol

int

Indicates the threshold operator, which is reserved.

thresholdValue

int

Indicates the threshold value, which is reserved.

Request Example

PUT https://10.120.70.220:32102/rest/openapi/pm/realtimePerformance?systemID=example@system&taskID=task666&neDN=NE=34603032&neIpAddress=10.134.122.174&subResourceName=Slot:LPU Board 10&subResourceType=slot&indicatorsGroupKey=CpuState&indicatorsData=[{"indicatorKey":"cpuUsage","symbol":"","thresholdValue":""}]&periodType=1

Headers: key = openid, value = d21ee8aae2f9c05b2098e82a33b3430b37e1c6980d26004f

Response Parameters

Field

Value Type

Description

code

int

Indicates the return code. The options are as follows:

  • 0: succeeded
  • Non-0: failed

data

List

The field is displayed as null.

description

String

Indicates the description of the interface invoking result.

Response Example

{
  "code": 0,
  "data": null,
  "description": null
}

Precautions

Currently, eSight can only invoke this API to collect CPU, slot, and interface information.

Example

package com.huawei.oms.ros.test;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;



public class StartRealTimeTask
{
    public static void main(String[] args) throws Exception
    {
        Login.login();
        startRealtime();
    } 

    public static void startRealtime() throws Exception
    {
        // set the URL and method 
        String openidURL = "/rest/openapi/pm/realtimePerformance";
        String method = "PUT";

        List<Map<String, String>> list = new ArrayList<Map<String, String>>();
        Map<String, String> map = new HashMap<String, String>();
        map.put("indicatorKey", "ifInDiscardRate");// Rate at which received packets are discarded on the interface 
        map.put("symbol", "");
        map.put("thresholdValue", "");
        list.add(map);
        Map<String, String> map2 = new HashMap<String, String>();
        map2.put("indicatorKey", "ifHCInOctets");// Number of received bytes on an interface 
        map2.put("symbol", "");
        map2.put("thresholdValue", "");
        list.add(map2);

        JSONObject model = new JSONObject();
        model.put("systemID", "example@system");

        model.put("taskID", "task2");
        model.put("neDN", "");
        model.put("neIpAddress", "10.137.61.2");
        model.put("subResourceName", "GigabitEthernet0/0/0");
        model.put("subResourceType", "interface");
        model.put("indicatorsGroupKey", "ifXEntryStat");
        model.put("indicatorsData", JSONArray.fromObject(list).toString());
        model.put("periodType", "1");

        BasicNameValuePair[] parameters = convertJsonObj(model);
        // set headers 
        BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
        HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
        // get the result 
        String body = NewHttpsAccess.getResult(response);
        System.out.println(body);
    } 

    private static BasicNameValuePair[] convertJsonObj(JSONObject model)
    {
        // TODO Auto-generated method stub 
        BasicNameValuePair[] parameters = new BasicNameValuePair[model.size()];

        Iterator<String> it = model.keys();
        int index = 0;
        while (it.hasNext())
        {
            String key = it.next();
            String value = model.get(key).toString();

            parameters[index] = new BasicNameValuePair(key, value);
            index++;
        }
        return parameters;
    }
}

The returned result is as follows:

https://10.137.59.61:32102/rest/openapi/sm/session
{"code":0,"data":"44c9728b-b94e-45a5-a763-958ae9d46d2a","description":"Operation success."}
https://10.137.59.61:32102/rest/openapi/pm/realtimePerformance
{"code":0,"data":null,"description":null}

Delete a Real-time Performance Task

Function

This interface is used to delete a real-time performance task.

URI

/rest/openapi/pm/realtimePerformance

Access Method

DELETE

Request Parameter Description

Parameter

Mandatory/Optional

Parameter List

Value Type

Description

openid

Mandatory

Headers

String

Indicates the session ID, which is used for open API authorization.

NOTE:

A third-party system invokes the login interface of the security management module to obtain the value of this parameter.

systemID

Mandatory

URL

String

Indicates the third-party system ID.
NOTE:

The value is a string of 1 to 64 valid characters including uppercase letters A to Z, lowercase letters a to z, digits 0 to 9, and special characters except [], {}, =, and space characters.

This parameter is configured through the id field under system in the configuration file eSight\AppBase\etc\oms.ros\ros.web.notification.xml. The modification takes effect upon restart.

taskID

Mandatory

URL

String

Indicates the real-time performance task ID defined by a third-party system. An error is reported if the task uniquely identified by the system ID and task ID does not exist.

Request Example

DELETE https://10.120.70.220:32102/rest/openapi/pm/realtimePerformance?systemID=example@system&taskID=task666
Headers: key = openid, value = d21ee8aae2f9c05b2098e82a33b3430b37e1c6980d26004f

Response Parameters

Field

Value Type

Description

code

int

Indicates the return code. The options are as follows:

  • 0: succeeded
  • Non-0: failed

data

List

The field is displayed as null.

description

String

Indicates the description of the interface invoking result.

Response Example

{
  "code": 0,
  "data": null,
  "description": null
}

Precautions

None.

Example

package com.huawei.oms.ros.test;

import java.util.Iterator;

import net.sf.json.JSONObject;

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;

public class StopRealTimeTask
{
    public static void main(String[] args) throws Exception
    {
        Login.login();
        stopRealtime();
    }

    public static void stopRealtime() throws Exception
    {
        // set the URL and method 
        String openidURL = "/rest/openapi/pm/realtimePerformance";

        String method = "DELETE";

        JSONObject model = new JSONObject();
        model.put("systemID", "example@system");
        model.put("taskID", "task2");

        BasicNameValuePair[] parameters = convertJsonObj(model);

        // set headers 
        BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
        HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
        // get the result 
        String body = NewHttpsAccess.getResult(response);
        System.out.println(body);
    }

    private static BasicNameValuePair[] convertJsonObj(JSONObject model)
    {
        // TODO Auto-generated method stub 
        BasicNameValuePair[] parameters = new BasicNameValuePair[model.size()];

        Iterator<String> it = model.keys();
        int index = 0;
        while (it.hasNext())
        {
            String key = it.next();
            String value = model.get(key).toString();

            parameters[index] = new BasicNameValuePair(key, value);
            index++;
        }
        return parameters;
    }
}

The returned result is as follows:

https://10.137.59.61:32102/rest/openapi/pm/realtimePerformance
{"code":0,"data":null,"description":null}

Query Real-Time Performance Task Information

Function

This interface is used to query a real-time performance task.

URI

/rest/openapi/pm/realtimePerformance

Access Method

GET

Request Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Headers

String

Indicates the session ID, which is used for open API authorization.

NOTE:

A third-party system invokes the login interface of the security management module to obtain the value of this parameter.

systemID

Mandatory

URL

String

Indicates the third-party system ID.
NOTE:

The value is a string of 1 to 64 valid characters including uppercase letters A to Z, lowercase letters a to z, digits 0 to 9, and special characters except [], {}, =, and space characters.

This parameter is configured through the id field under system in the configuration file eSight\AppBase\etc\oms.ros\ros.web.notification.xml. The modification takes effect upon restart.

Request Example

GET https://10.120.70.220:32102/rest/openapi/pm/realtimePerformance?systemID=example@system
Headers: key = openid, value = d21ee8aae2f9c05b2098e82a33b3430b37e1c6980d26004f

Response Parameters

Field

Value Type

Description

code

int

Indicates the return code. The options are as follows:

  • 0: succeeded
  • Non-0: failed

data

List

Indicates the real-time performance task information delivered by a third-party system.

description

String

Indicates the description of the interface invoking result.

The following table lists the parameters contained in the data object.

Parameter

Value Type

Description

taskID

String

Indicates the real-time performance task ID defined by a third-party system.

systemID

String

Third-party system ID, which must be consistent with the system ID in the request.

taskLastModifyTimeMS

Long

Indicates the last time when the task is updated.

monitorId

String

Real-time task ID on the network management system, which is automatically generated by the network management system.

neDN

String

Indicates the unique device DN on eSight. If a third-party system does not synchronize resources from eSight, the device IP address is recommended as the device DN.

neIpAddress

String

Indicates the device IP address. Either the device DN or the IP address is mandatory, and the value must be the same as that on eSight. If both the device DN and IP address are available, the device DN is used.

subResourceName

String

Indicates the sub-resource name of a device (measurement object name).

subResourceType

String

Indicates the sub-resource type of a device, which is defined by Huawei, for example, device, slot, or interface.

indicatorsGroupKey

String

Specifies the counter group ID.

indicatorsData

List

Indicates the collection of key values (counter list in a counter group).

periodType

int

Indicates the collection interval. The options are as follows:

  • 1. 5s
  • 2. 10s
  • 3. 15s
  • 4. 30s

The following table lists the fields contained in the indicatorsData object.

Field

Value Type

Description

id

int

Indicates the indicator ID.

indicatorKey

String

Indicates the counter key value.

symbol

int

Indicates the threshold operator, which is reserved.

thresholdValue

int

Indicates the threshold value, which is reserved.

indicatorName

String

Indicates the counter name.

indicatorUnit

String

Indicates the counter unit.

isLimited

int

Indicates whether the threshold is exceeded. The options are as follows:

  • 0: no
  • 1: yes

Response Example

{
  "code": 0,
  "data": [
    {
      "systemID": "example@system",
      "taskID": "task666",
      "taskLastModifyTimeMS": 1535128207666,
      "monitorId": "realTimeMonitor_8",
      "neDN": "NE=34603017",
      "neIpAddress": "10.134.122.174",
      "subResourceName": "Slot:MPU Board 0",
      "subResourceType": "slot",
      "indicatorsGroupKey": "CpuState",
      "indicatorsData": [
        {
          "indicatorKey": "cpuUsage",
          "indicatorName": "Board CPU usage",
          "indicatorUnit": "%",
          "indicatorData": "",
          "id": 66,
          "isLimited": 0,
          "symbol": 0,
          "thresholdValue": 0
        }
      ],
      "periodType": 1,
      "measureObject2Index": [
        {
          "dn": "NE=34603017",
          "neName": "Quidway-234",
          "displayValue": "Slot:MPU Board 0",
          "displayValueKey": "Slot:MPU Board 0",
          "indexId": 66,
          "indexName": "Board CPU usage",
          "objectHasInit": true,
          "aggrType": 0,
          "displayPeriod": 0
        }
      ]
    }
  ],
  "description": null
}

Precautions

None.

Example

package com.huawei.oms.ros.test;

import java.util.Iterator;

import net.sf.json.JSONObject;

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;

public class QueryRealTimeTask
{
    public static void main(String[] args) throws Exception
    {
        Login.login();
        getRealtime();
    }

    public static void getRealtime() throws Exception
    {
        // set the URL and method 
        String openidURL = "/rest/openapi/pm/realtimePerformance";

        String method = "GET";

        JSONObject model = new JSONObject();
        model.put("systemID", "example@system");

        BasicNameValuePair[] parameters = convertJsonObj(model);

        // set headers 
        BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
        HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
        // get the result 
        String body = NewHttpsAccess.getResult(response);
        System.out.println(body);
    }

    private static BasicNameValuePair[] convertJsonObj(JSONObject model)
    {
        // TODO Auto-generated method stub 
        BasicNameValuePair[] parameters = new BasicNameValuePair[model.size()];

        Iterator<String> it = model.keys();
        int index = 0;
        while (it.hasNext())
        {
            String key = it.next();
            String value = model.get(key).toString();

            parameters[index] = new BasicNameValuePair(key, value);
            index++;
        }
        return parameters;
    }
}
The returned result is as follows:
https://10.137.59.61:32102/rest/openapi/pm/realtimePerformance
{
    "code":0,
    "data":[
        {
            "systemID":"example@system",
            "taskID":"task2",
            "taskLastModifyTimeMS":1434338475053,
            "monitorId":"realTimeMonitor_2",
            "neDN":"NE=34603409",
            "neIpAddress":"10.137.61.2",
            "subResourceName":"GigabitEthernet0/0/0",
            "subResourceType":"interface",
            "indicatorsGroupKey":"ifXEntryStat",
            "indicatorsData":[
                {
                    "indicatorKey":"ifInDiscardRate",
                    "indicatorName":"Rate of discarding received packets on the interface",
                    "indicatorUnit":"%",
                    "indicatorData":"",
                    "id":1,
                    "isLimited":0,
                    "symbol":0,
                    "thresholdValue":0
                },
                {
                    "indicatorKey":"ifHCInOctets",
                    "indicatorName":"Number of bytes received by an interface"
                    "indicatorUnit":"bytes",
                    "indicatorData":"",
                    "id":2,
                    "isLimited":0,
                    "symbol":0,
                    "thresholdValue":0
                }
            ],
            "periodType":5
        }
    ],
    "description":null
}

Query Historical Data (by Indicator)

Function

This interface is used to query counter data of devices.

You are advised to use the FTP northbound API to obtain historical performance data through a third party.

URI

/rest/openapi/pm/historyByIndexKeys

Access Method

POST

Request Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Headers

String

Indicates a session ID, used for open API authorization.

NOTE:

A third-party system invokes the login interface of the security management module to obtain the value of this parameter.

mos

Mandatory

URL

List<dn2displayValue>

Indicates the NE information set.

indexKeys

Mandatory

URL

List<MeasureType>

Indicator object set. One object consists of the resource type, indicator group, and indicator fields.

beginTime

Mandatory

URL

long

Indicates the start time (UTC time). The time is accurate to milliseconds.

endTime

Mandatory

URL

long

Indicates the end time (UTC time). The time is accurate to milliseconds.

The following table lists the fields contained in the dn2displayValue object.

Field

Value Type

Description

dn

String

Indicates the NE DN. The value of dn can be obtained from the nedn field in Query the Network Device List.

displayValue

String

Measurement object name, which corresponds to the measurement object column on the performance data page. For interfaces and cards, the value is usually the interface name or card name. The value type is string. This parameter is optional.

The following table lists the fields contained in the MeasureType object.

Field

Value Type

Description

resourceType

String

Indicates the resource type. For details, see Performance Indicator List.

measUnitKey

String

Indicates the indicator group. For details, see Performance Indicator List.

measTypeKey

String

Indicates the indicator. For details, see Performance Indicator List.

Request Example

POST https://10.120.70.220:32102/rest/openapi/pm/historyByIndexKeys?mos=[{"dn":"NE=34603017","displayValue":"Slot:LPU Board 10"}]&indexKeys=[{"resourceType":"slot","measUnitKey":"CpuState","measTypeKey":"cpuUsage"},{"resourceType":"slot","measUnitKey":"MemState","measTypeKey":"memUsage"}]&beginTime=1524453437391&endTime=1524457037391
Headers: key = openid, value = d21ee8aae2f9c05b2098e82a33b3430b37e1c6980d26004f

Response Parameters

Field

Value Type

Description

code

int

Indicates the return code. The options are as follows:

  • 0: succeeded
  • 1: failed

data

HistoryQueryData

Indicates the historical performance data map.

description

String

Indicates the description of the returned result.

The following table lists the fields contained in the HistoryQueryData object.

Field

Value Type

Description

totalPage

int

Indicates the total number of pages.

resultData

List<HistoryQueryValue>

Indicates the search results.

groupQueryData

List<List<HistoryQueryValue>>

Indicates the sorted search results.

startTime

long

Indicates the start time (UTC time). The time is accurate to milliseconds.

endTime

long

Indicates the end time (UTC time). The time is accurate to milliseconds.

timeDisplayInfos

List<TimeDisplayInfo>

Indicates the mapping between the timestamp and display value.

yAxisScaleCount

int

Indicates the scale value in the Y axis.

The following table lists the fields contained in the HistoryQueryValue object.

Field

Value Type

Description

dn

String

Indicates the NE DN.

neName

String

Indicates the NE name.

displayValue

String

Indicates the name of a measurement object connected to an NE.

displayValueKey

String

Indicates the name key of a measurement object connected to an NE.

indexId

int

Indicates the counter ID.

indexName

String

Indicates the counter name.

indexUnit

String

Indicates the counter unit.

oper

String

Indicates the threshold operator.

thresholdList

List<Float>

Indicates the threshold information.

indexValues

List<HistoryIndexValue>

Indicates the counter data.

resourceType

String

Indicates the resource type.

indexGroup

String

Indicates the counter group.

displayRate

long

Indicates the display period, in seconds.

indexKey

String

Indicates the counter key.

The following table lists the fields contained in the HistoryIndexValue object.

Field

Value Type

Description

timestamp

long

Indicates a data collection timestamp (UTC time). The time is accurate to milliseconds.

timestampStr

String

Indicates the timestamp content.

indexValue

String

Indicates the counter data.

breakpoint

boolean

Indicates whether the performance curve is broken. true: The performance curve is broken. false: The performance curve is continuous.

The following table lists the fields contained in the TimeDisplayInfo object.

Field

Value Type

Description

timestamp

long

Indicates the timestamp (UTC time). The time is accurate to milliseconds.

timestampStr

String

Indicates the timestamp text. The display rule is as follows:

  • When the scale range is less than 60*1000 ms, the parameter is converted to the MM-dd HH:mm:ss format.
  • When the scale range is greater than or equal to 60*1000 ms and less than 60*60*60*1000 ms, the parameter is converted to the MM-dd HH:mm format.
  • When the scale range is greater than or equal to 60*60*60*1000 ms, the parameter is converted to the MM-dd format.

Response Example

{
  "code": 0,
  "data": {
    "totalPage": 1,
    "resultData": [
      {
        "dn": "NE=34603017",
        "neName": "Quidway-234",
        "displayValue": "Slot:MPU Board 0",
        "displayValueKey": "Slot:MPU Board 0",
        "indexId": 66,
        "indexName": "Board CPU usage",
        "indexUnit": "%",
        "oper": "",
        "thresholdList": [
          -1,
          -1,
          -1,
          -1
        ],
        "indexValues": [],
        "resourceType": "slot",
        "indexGroup": "CpuState",
        "displayRate": 0,
        "indexKey": "cpuUsage"
      },
      {
        "dn": "NE=34603017",
        "neName": "Quidway-234",
        "displayValue": "Slot:MPU Board 0",
        "displayValueKey": "Slot:MPU Board 0",
        "indexId": 67,
        "indexName": "Board memory usage",
        "indexUnit": "%",
        "oper": "",
        "thresholdList": [
          -1,
          -1,
          -1,
          -1
        ],
        "indexValues": [],
        "resourceType": "slot",
        "indexGroup": "MemState",
        "displayRate": 0,
        "indexKey": "memUsage"
      }
    ],
    "groupQueryData": null,
    "startTime": 1534903300215,
    "timeDisplayInfos": [
      {
        "timestamp": 1534903301000,
        "timestampStr": "08-22 10:01:41"
      },
      {
        "timestamp": 1534903302000,
        "timestampStr": "08-22 10:01:42"
      },
      {
        "timestamp": 1534903303000,
        "timestampStr": "08-22 10:01:43"
      }
    ],
    "endTime": 1534903303215,
    "yAxisScaleCount": 7
  },
  "description": null
}

Precautions

  • The maximum query period is one year.
  • The total number of queried counters (Number of counters x Number of devices) cannot exceed 100. The upper limits of the counters and devices are 10 for each.

Example

package com.huawei.oms.ros.test;

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;
import com.huawei.oms.ros.test.GlobalVar;
import com.huawei.oms.ros.test.NewHttpsAccess;
import com.huawei.oms.ros.test.NewRosSecurity;

/**
 * Query Historical Performance Data
 */
public class QueryPmHistory {
 private static final String PM_DATA = "/rest/openapi/pm/historyByIndexKeys";

 public static void main(String[] args) throws Exception {
  Login.login();
  queryPmHistoryTest();
 }

 public static void queryPmHistoryTest() throws Exception {
  //set the URL and method
  String openidURL = PM_DATA;
  String method = "POST";
  
  //set headers
  BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
  //set parameters
  BasicNameValuePair[] parameters =
        {
                new BasicNameValuePair("mos", "[{\"dn\":\"DN=NE=34603062\",\"displayValue\":\"GigabitEthernet3/0/10\"}]"), 
                new BasicNameValuePair("indexKeys", "[{\"resourceType\":\"interface\",\"measUnitKey\":\"ifXTrafficStat\",\"measTypeKey\":\"ifHCOutOctetsSpeed\"}]"), 
                new BasicNameValuePair("beginTime", "1501134883000"), 
                new BasicNameValuePair("endTime", "1501221283000")
        };
  
  //send the request
  HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
  //get the result
  String body = NewHttpsAccess.getResult(response);
  System.out.println(body);
 }
}

The returned result is as follows:

{
   "code": 0,
   "data":    {
      "totalPage": 1,
      "resultData": [      {
         "dn": "NE=34603062",
         "neName": "L3VPN-PE179",
         "displayValue": "GigabitEthernet3/0/10",
         "displayValueKey": "GigabitEthernet3/0/10",
         "indexId": 34,
         "indexName": "Sending rate of the interface"
         "indexUnit": "bps",
         "oper": "",
         "thresholdList":          [
            -1,
            -1,
            -1,
            -1
         ],
         "indexValues":          [
                        {
               "timestamp": 1501213500000,
               "timestampStr": "2017-07-28 11:45:00",
               "indexValue": "103.12",
               "breakpoint": false
            },
                        {
               "timestamp": 1501214400000,
               "timestampStr": "2017-07-28 12:00:00",
               "indexValue": "103.12",
               "breakpoint": false
            },
                        {
               "timestamp": 1501215300000,
               "timestampStr": "2017-07-28 12:15:00",
               "indexValue": "102.40",
               "breakpoint": false
            },
                        {
               "timestamp": 1501216200000,
               "timestampStr": "2017-07-28 12:30:00",
               "indexValue": "103.12",
               "breakpoint": false
            },
                        {
               "timestamp": 1501217100000,
               "timestampStr": "2017-07-28 12:45:00",
               "indexValue": "103.12",
               "breakpoint": false
            },
                        {
               "timestamp": 1501218000000,
               "timestampStr": "2017-07-28 13:00:00",
               "indexValue": "103.12",
               "breakpoint": false
            },
                        {
               "timestamp": 1501218900000,
               "timestampStr": "2017-07-28 13:15:00",
               "indexValue": "102.40",
               "breakpoint": false
            },
                        {
               "timestamp": 1501219800000,
               "timestampStr": "2017-07-28 13:30:00",
               "indexValue": "105.60",
               "breakpoint": false
            },
                        {
               "timestamp": 1501220700000,
               "timestampStr": "2017-07-28 13:45:00",
               "indexValue": "121.28",
               "breakpoint": false
            }
         ],
         "resourceType": "interface",
         "indexGroup": "ifXTrafficStat",
         "displayRate": 0,
         "indexKey": "ifHCOutOctetsSpeed"
      }],
      "groupQueryData": null,
      "startTime": 1501134883000,
      "timeDisplayInfos":       [
                  {
            "timestamp": 1501142400000,
            "timestampStr": "07-27 16:00"
         },
                  {
            "timestamp": 1501156800000,
            "timestampStr": "07-27 20:00"
         },
                  {
            "timestamp": 1501171200000,
            "timestampStr": "07-28 00:00"
         },
                  {
            "timestamp": 1501185600000,
            "timestampStr": "07-28 04:00"
         },
                  {
            "timestamp": 1501200000000,
            "timestampStr": "07-28 08:00"
         },
                  {
            "timestamp": 1501214400000,
            "timestampStr": "07-28 12:00"
         }
      ],
      "endTime": 1501221283000,
      "yAxisScaleCount": 7
   },
   "description": null
}

Create a Performance Monitoring Task

Function

This interface is used to create a performance monitoring task.

URI

/rest/openapi/pm/collectTask

Access Method

POST

Request Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Headers

String

Indicates a session ID, used for open API authorization.

NOTE:

A third-party system invokes the login interface of the security management module to obtain the value of this parameter.

pollerName

Mandatory

URL

String

Indicates the task name, which is mandatory and cannot be the same as an existing task name. It can contain fewer than 64 characters excluding the following special characters: # % & ' " + / ; < > = ?

period

Mandatory

URL

int

Indicates the collection period.

Currently, options for different type of resources are as follows. (Unit: second)

Device: 60, 300, 900, 1800, 3600, 86400

Board: 60, 300, 900, 1800, 3600, 86400

Interface: 30, 60, 300, 900, 1800, 3600, 86400

Optical port: 300, 900, 1800, 3600, 86400

measTypes

Mandatory

URL

List<CollectIndexJms>

Indicates the indicator information set. Each indicator object contains the resource, indicator group, and indicator fields.

measObjects

Mandatory

URL

List<CollectObjectJms>

Indicates the measurement object set. Each measurement object must be supported by all selected indicators. The resource type corresponding to an indicator can be obtained based on the indicator. The measurement object varies depending on resource type. Therefore, the selected indicators must correspond to the same resource type. The selected measurement object must be supported by the resource type.

The CollectIndexJms structure includes three fields.

Field

Value Type

Description

resType

String

Indicates the resource type corresponding to the indicator. (This field corresponds to the restype field in the performance database table omspm.tbl_collect_index.)

measUnit

String

Indicates the indicator group key. (This field corresponds to the indexgroup field in the performance database table omspm.tbl_collect_index.)

measType

String

Indicates the indicator key. (This field corresponds to the indextype field in the performance database table omspm.tbl_collect_index.)

The CollectObjectJms structure includes four fields.

Field

Value Type

Description

dn

String

Indicates the Dn of the resource to which the measurement object belongs.

Board: Query the northbound open API Query Board List to obtain nedn (corresponding to the dn field in the performance database table omspm.tbl_mo).

Interface: Query the northbound open API Query Port List to obtain nedn.

Optical port: Query the northbound open API Query Port List to obtain nedn.

displayValue

String

Indicates the measurement object name. The value type is string. This parameter is optional.

Board: This field corresponds to the displayvalue field in the performance database table omspm.tbl_mo.

Interface and optical port: This field corresponds to the name field in the view_inv_port_union table in the nemgr database.

keys

List<String>

Indicates the measurement object index list. (The list size is less than 2048.)

Board: This field corresponds to the key of the originalvalue field in the performance database table tbl_mo, that is, the value before < = >.

Interface and optical port: This field has a fixed value ifIndex.

values

List<String>

Indicates the value corresponding to the measurement object index. (The list size is less than 2048.)

Board: Query the open API Query Board List to obtain slotindex (corresponding to the value of originalvalue in the performance database table tbl_mo, that is, the value after < = >).

Interface: Query the open API Query Port List to obtain ifindex.

Optical port: Query the northbound open API Query Port List to obtain portindex.

Request Example

POST https://10.120.70.220:32102/rest/openapi/pm/collectTask?pollerName=IDP_TEST&period=900&measTypes=[{"resType":"slot","measUnit":"CpuState","measType":"cpuUsage"},{"resType":"slot","measUnit":"MemState","measType":"memUsage"}]&measObjects=[{"dn":"NE=34603017","displayvalue":"Slot:MPU Board 0","keys":["entPhysicalIndex"],"values":["603979777"]}]

Headers: key = openid, value = d971d664688018c1fb0a646dc294ac2da8751da952f37ede

Response Parameters

Field

Value Type

Description

code

int

Indicates the return code. The options are as follows:

  • 0: succeeded
  • Non-0: failed

description

String

Indicates the description of the returned result.

data

String

Indicates the ID of a successfully created task.

Response Example

{
  "code": 0,
  "data": "31",
  "description": "The performance collection task is created successfully."
}

Precautions

  • If the parameter name or JSON character string format is incorrect in the input parameter, the system returns a message indicating parameter verification failure and containing the incorrect parameter. Verify that the parameter name and JSON character string format are correct.
  • The following is an information example returned for task creation failure: Failed to create the performance task. The measure object measObject={} is not supported by the indicator measTypes={}.
  • Successfully created tasks are displayed on the monitoring setting page. However, the tasks cannot be modified, started, and stopped on the page and indicator operations cannot be performed on the page. The page supports only performance data query.
  • When a non-open API user deletes a task created by an open API user, a message is displayed. The non-open API user can click Yes to delete the task or click No to cancel the operation.
  • When a task is created, the system verifies the number of collection units. The number of collection units delivered by the task plus the number of delivered collection units cannot exceed the maximum number of collection units supported by eSight.
  • To obtain the indicator information, you need to run the following statement to query the OMSPM.tbl_collect_index table: select restype, indexgroup, indextype from omspm.tbl_collect_index.
  • When creating a board task, you need to query dn, displayvalue, keys, and values in the OMSPM.tbl_mo table. If related data cannot be queried, directly create a device-level task.
  • You can run the following statement to query the nemgr.view_inv_port_union table to obtain data related to the interface and optical port: select nedn, ifindex, portindex from nemgr.view_inv_port_union.

Example

package com.huawei.oms.ros.test;

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;
import com.huawei.oms.ros.test.GlobalVar;
import com.huawei.oms.ros.test.NewHttpsAccess;
import com.huawei.oms.ros.test.NewRosSecurity;

/**
 * create task for openapi
 */
public class CreateTaskForOpenApi
{
    private static final String URL = "rest/openapi/pm/collectTask";

    public static void main(String[] args)
        throws Exception
    {
        Login.login();
        createTask();
    }

    public static void createTask()
        throws Exception
    {
        //set the URL and method
        String openidURL = URL;
        String method = "POST";

        //set headers
        BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
        //set parameters
        BasicNameValuePair[] parameters =
            {
                new BasicNameValuePair("period", "60"),
                new BasicNameValuePair("pollerName", "(cxli_slot)"),
                new BasicNameValuePair(
                    "measTypes",
                    "[{\"resType\":\"slot\",\"measUnit\":\"MemState\",\"measType\":\"memUsage\"},{\"resType\":\"slot\",\"measUnit\":\"CpuState\",\"measType\":\"cpuUsage\"}]"),
                new BasicNameValuePair(
                    "measObjects",
                    "[{\"dn\":\"NE=34603026\",\"displayvalue\":\"Slot:SPU Board 0\",\"keys\":[\"entPhysicalIndex\"],\"values\":[\"70516745\"]}]")};

        //send the request
        HttpResponse response =
            NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
        //get the result
        String body = NewHttpsAccess.getResult(response);
        System.out.println(body);
    }
}

The returned result is as follows:

{
    {"code":0,"data":1,"description":"Performance task created successfully!"}
}

Delete a Performance Monitoring Task

Function

This task is used to delete a performance monitoring task.

URI

rest/openapi/pm/collectTask/{pollerId}

Access Method

DELETE

Request Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Headers

String

Indicates the session ID, which is used for open API authentication.

Note:

A third-party system invokes the login interface for security management to obtain this parameter.

pollerId

Mandatory

Path

int

Indicates the task ID. Only one task ID can be transferred at a time.

Request Example

DELETE https://10.120.70.220:32102/rest/openapi/pm/collectTask/31
Headers: key = openid, value = d21ee8aae2f9c05b2098e82a33b3430b37e1c6980d26004f

Response Parameters

Field

Value Type

Description

code

int

Indicates the return code. The options are as follows:

  • 0: succeeded
  • Non-0: failed

description

String

Indicates the description of the returned result.

data

String

The field is displayed as null.

Response Example

{
  "code": 0,
  "data": null,
  "description": "The performance collection task is deleted successfully."
}

Precautions

  • The northbound performance task deletion interface can delete only performance tasks created by open API users.
  • If the pollerId parameter is invalid, an error is reported and the task fails to be deleted. Example: rest/openapi/pm/collectTask/aaa
  • If the task corresponding to the transferred pollerId parameter does not exist, a message is displayed, indicating that the task to be deleted does not exist.

Example

package com.huawei.oms.ros.test;

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;
import com.huawei.oms.ros.test.GlobalVar;
import com.huawei.oms.ros.test.NewHttpsAccess;
import com.huawei.oms.ros.test.NewRosSecurity;

/**
 * delete task for openapi
 */
public class DeleteTaskForOpenApi
{
    private static final String URL = "rest/openapi/pm/collectTask";

    public static void main(String[] args)
        throws Exception
    {
        Login.login();
        deletecollectTask();
    }

    public static void deletecollectTask()
        throws Exception
    {
        //set the group ID
        int taskId = 1;
        //set the URL and method
        String openidURL = URL + "/" + taskId;
        String method = "DELETE";

        //set headers
        BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
        //set parameters
        BasicNameValuePair[] parameters = {};

        //send the request
        HttpResponse response =
            NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
        //get the result
        String body = NewHttpsAccess.getResult(response);
        System.out.println(body);
    }
}

The returned result is as follows:

{
    {"code":0,"data":null,"description":"Performance task deleted successfully!"}
}

Performance Indicator List

For details about the performance indicator list, see PerformanceIndicatorList.xlsx.

The table contains four columns. The first column is the name of an optional indicator for creating a performance task. You can query the collection of indicator objects based on the indicator name: resource type, indicator group, and indicator.

Query Measurement Objects

Function

This interface is used to query measurement objects.

URI

rest/openapi/pm/displayvalue

Access Method

GET

Request Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Parameter Description

openid

Mandatory

Headers

String

Indicates a session ID, used for open API authorization.

NOTE:

A third-party system invokes the login interface of the security management module to obtain the value of this parameter.

dn

Mandatory

URL

String

Indicates the NE DN. For a network domain device, the DN can be obtained by querying the nedn field in Query the Network Device List.

resType

Mandatory

URL

String

Indicates the resource type name, which can be obtained from the specification list.

measUnit

Mandatory

URL

String

Indicates the indicator group name, which can be obtained from the specification list. (The indicator group queried each time must be under the corresponding resource type.)

Request Example

GET https://10.120.70.220:32102/rest/openapi/pm/displayvalue?dn=NE=34603017&resType=slot&measUnit=CpuState

Headers: key = openid, value = d21ee8aae2f9c05b2098e82a33b3430b37e1c6980d26004f

Response Parameters

Field

Value Type

Description

code

int

Indicates the return code. The options are as follows:

  • 0: succeeded
  • Non-0: failed

description

String

Indicates the description of the returned result.

data

List<String>

Corresponds to displayvalue under dn.

Response Example

{
  "code": 0,
  "data": [
    "Slot:MPU Board 0"
  ],
  "description": "The measurement object is queried successfully."
}

Precautions

The measurement object can be obtained only after the task is created.

Example

package com.huawei.oms.ros.test.pm;

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;
import com.huawei.oms.ros.test.GlobalVar;
import com.huawei.oms.ros.test.Login;
import com.huawei.oms.ros.test.NewHttpsAccess;
import com.huawei.oms.ros.test.NewRosSecurity;

public class DisplayValueQuery {

private static final String URL = "/rest/openapi/pm/displayvalue";

public static void main(String[] args){
try {
Login.login();
queryDisplayValue();
} catch (Exception e) {
e.printStackTrace();
}

}

public static void queryDisplayValue() throws Exception {
// set the URL and method
String openidURL = URL;
String method = "GET";

// set headers
BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL, method);
// set parameters
BasicNameValuePair[] parameters = {
new BasicNameValuePair("dn", "NE=34603522"),
new BasicNameValuePair("resType", "slot"),
new BasicNameValuePair("measUnit", "CpuState")};

// send the request
HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP, GlobalVar.GLOBAL_PORT, openidURL, method, headers, parameters);
// get the result
String body = NewHttpsAccess.getResult(response);
System.out.println(body);
}
}

The returned result is as follows:

{
{code:0,data:[Slot:SPU Board 0],description: The measurement object is queried successfully.}
}

Query Real-Time Performance Data of Storage Devices

Function

This interface is used to query the real-time performance data of a specified counter of an object according to the NE DN, object ID, and counter ID.

URI

/rest/openapi/storage/storageRealTimePm

Access Method

POST

Request Body

Content-type: application/json

Charset: UTF-8

Parameter

Mandatory/Optional

Value Type

Description

dn

Mandatory

String

Indicates the NE DN.

moid

Mandatory

String

Indicates the unique identifier of an object to be queried.

NOTE:

This interface can be invoked to query the real-time performance data of only the following object classes:

FusionStorage Object/File clusters, FusionStorage Object/File nodes, FusionStorage Object/File disks, FusionStorage Object/File network ports, as well as LUNs, storage pools, and file systems on storage devices.

Basic information about the preceding seven object classes can be queried using the released northbound interfaces. For example, the /rest/openapi/storage/storagepool interface can obtain the storage pool moId.

indexIds

Mandatory

Map<String,String>

Indicates the information about the counter to be queried, including the counter key and column.

NOTE:

This interface can be invoked to query the real-time performance data of the existing counters for the following objects: FusionStorage Object/File clusters, FusionStorage Object/File nodes, FusionStorage Object/File disks, FusionStorage Object/File network ports, as well as LUNs, storage pools, and file systems on storage devices. This interface can also be invoked to query the real-time performance data of multiple counters of a single object.

You can enter multiple counter IDs for query. If some counter IDs contain multiple digits, the digits can be separated by commas (,).

The format is as follows:

{"outbandwidthutility":"26","inbandwidthutility":"23", "queuesize":"19,130,142"}

Parameter description of indexIds

Indicator

Name

Key

Column

FusionStorage File/Object Cluster

Cluster Bandwidth

currentbandwidth

236

Cluster Read Bandwidth

readbandwidth

123

Cluster Write Bandwidth

wirtebandwidth

124

Cluster Average CPU Usage

avgcpuusage

68

Cluster Average Memory Usage

avgmemusage

69

Node Write Bandwidth

Node Write Bandwidth

currentbandwidth

236

Node Write Bandwidth

readbandwidth

123

Node Write Bandwidth

wirtebandwidth

124

Node Average CPU Usage

avgcpuusage

68

Node Average Memory Usage

avgmemusage

69

Node Read Throughput (IOPS)

readiops

25

Node Write Throughput (IOPS)

writeiops

28

Node Read Throughput

readhroughput

312

Node Write Throughput

writethroughput

313

FusionStorage File/Object Netport

Network Port Bandwidth

currentbandwidth

236

Network Port Read Bandwidth

readbandwidth

123

Network Port Write Bandwidth

wirtebandwidth

124

FusionStorage File/Object Disk

Average Read I/O Size of Disk

avgreadiosize

24

Average Write I/O Size of Disk

avgwriteiosize

27

Disk Average I/O Latency

avgioresp

78

Disk Read Throughput (IOPS)

readiops

25

Disk Write Throughput (IOPS)

writeiops

28

Disk Read Throughput

readhroughput

312

Disk Write Throughput

writethroughput

313

Disk Usage Ratio

usageratio

18

Disk Average Read I/O Latency

avgreadioresp

197

Disk Average Write I/O Latency

avgwriteioresp

198

Disk Queue Length

queuelength

19

Storage Pool

Storage Pool Bandwidth

currentbandwidth

21

Storage Pool Average I/O Latency

ioresponsetime

78

Storage Pool Write Throughput (IOPS)

iops

22

Storage Pool Read Bandwidth

readbandwidth

23

Storage Pool Write Bandwidth

wirtebandwidth

26

Storage Pool Read Throughput (IOPS)

readthroughput

25

Storage Pool Throughput (IOPS)

wirtethroughput

28

Protect Capacity Usage

snapshotpoolusage

774

Storage Pool Usage

utility

18

LUN

LUN Bandwidth

currentbandwidth

21

LUN Average I/O Latency

ioresponsetime

78

LUN Throughput(IOPS)

iops

22

LUN Read Bandwidth

readbandwidth

23

LUN Write Bandwidth

wirtebandwidth

26

LUN Read Throughput (IOPS)

readthroughput

25

LUN Write Throughput (IOPS)

wirtethroughput

28

Read Cache Hit Ratio of LUNs

readcacheratio

93

Write Cache Hit Ratio of LUNs

writecacheratio

95

File System

File System OPS

ops

182

File System Service Time

servicetime

29

File System Read OPS

readops

232

File System Read Bandwidth

readbandwidth

23

File System Average Read OPS Response Time

readopsresponsetime

464

File System Write OPS

writeops

233

File System Write Bandwidth

wirtebandwidth

26

File System Average Write OPS Response Time

writeopsresponsetime

465

File System Usage

spaceusage

462

File System Size

spacesize

463

Result

Field

Mandatory/Optional

Value Type

Description

code

Mandatory

int

Indicates the operation return code. The value can be:

  • 0: Performance data is collected successfully.

  • 1: Performance data fails to be collected because the authentication fails.

  • 2: Performance data fails to be collected because input parameters do not meet requirements.

  • 3: Performance data fails to be collected because the input NE or measurement object does not exist.

data

Mandatory

StorageRealTimeExtBo

Indicates the real-time performance data.

description

Optional

String

Indicates the description of the interface invocation result.

Fields contained in the StorageRealTimeExtBo object

Field

Mandatory/Optional

Value Type

Description

dn

Mandatory

int

Indicates the NE DN.

neName

Mandatory

String

Indicates the NE name.

displayValue

Mandatory

String

Indicates the displayed object name.

indexInfos

Mandatory

List<Map<String,String>>

Indicates the key, ID, and performance data of the counter. For example, {"indexId":"464","value":"0.0","key":"readopsresponsetime"}

Example

Data Segment

Value

Request URL

https://10.190.45.192:32102/rest/openapi/storage/storageRealTimePm

Request header

65270a0c2b794de4e7857b23d6a3b87e26030a3a70db5367

Request entity

{"dn":"NE=34603229","moid":"989","indexIds":"{\"ops\":\"182\",\"servicetime\":\"29\" ,\"readops\":\"232\" ,\"readbandwidth\":\"23\" ,\"readopsresponsetime\":\"464\" ,\"writeops\":\"233\" ,\"wirtebandwidth\":\"26\" ,\"writeopsresponsetime\":\"465\" ,\"spaceusage\":\"462\" ,\"spacesize\":\"463\" }"}

Response entity

{"code":0,"data":{"dn":"NE=34603229","neName":"3rest","displayValue":"FileSystem016","indexInfos":[{"indexId":"182","value":"0.0","key":"ops"},{"indexId":"29","value":"0.0","key":"servicetime"},{"indexId":"232","value":"0.0","key":"readops"},{"indexId":"23","value":"0.0","key":"readbandwidth"},{"indexId":"464","value":"0.0","key":"readopsresponsetime"},{"indexId":"233","value":"0.0","key":"writeops"},{"indexId":"26","value":"0.0","key":"wirtebandwidth"},{"indexId":"465","value":"0.0","key":"writeopsresponsetime"},{"indexId":"462","value":"99.0","key":"spaceusage"},{"indexId":"463","value":"4.294967295E9","key":"spacesize"}]},"description":"","size":1,"totalPage":1}

package com.huawei.nms.openapi.demo.resource.storage;


import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;

import com.huawei.nms.openapi.demo.global.GlobalVar;
import com.huawei.nms.openapi.demo.global.NewHttpsAccess;
import com.huawei.nms.openapi.demo.global.NewRosSecurity;
import com.huawei.nms.openapi.demo.sm.Login;

/** * Query Real-Time Performance Data of Storage Devices */
public class QueryStoragePerformance
{
    private static final String FM_ALARM_STATIC = "/rest/openapi/storage/storageRealTimePm";

    public static void main(String[] args) throws Exception
    {
        Login.login();
        queryStoragePerformance();
    }

    private static void queryStoragePerformance() throws Exception
    {
        //set the URL  
        String openidURL = FM_ALARM_STATIC;
        //set the method
        String method = "POST";
        //set headers and parameters       
        BasicNameValuePair[] headers = NewRosSecurity.getRosHttpHeader(openidURL,
                method);
        BasicNameValuePair[] parameters = {
            new BasicNameValuePair("dn", "NE=34603012"),
            new BasicNameValuePair("moid", "216"),
            new BasicNameValuePair("indexIds", "{ioresponsetime=78, currentbandwidth=21}")};
        HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP,
                GlobalVar.GLOBAL_PORT,
                openidURL,
                method,
                headers,
                parameters);
        String body = NewHttpsAccess.getResult(response);
        System.out.println(body);
    }
}

Response example:

{
    "code": 0,
    "data": {
        "dn": "NE=34603012",
        "neName": "8.46.7.132",
        "displayValue": "lun1",
        "indexInfos": [{
            "indexId": "21",
            "value": "0.0",
            "key": "currentbandwidth"
        }]
    },
    "description": "",
    "size": 1,
    "totalPage": 1
}

Precautions

This interface can be invoked to query the real-time performance data of the following object classes: FusionStorage Object/File clusters, FusionStorage Object/File nodes, FusionStorage Object/File disks, FusionStorage Object/File network ports, as well as LUNs, storage pools, and file systems on storage devices using the SMI-S and REST protocols. This interface can also be invoked to query the real-time performance data of multiple counters of a single object.

Download
Updated: 2019-12-13

Document ID: EDOC1100044386

Views: 20770

Downloads: 89

Average rating:
This Document Applies to these Products

Related Version

Related Documents

Share
Previous Next