edit-icon download-icon

QueryMonitorInfoRequest

Last Updated: Nov 16, 2018

Function

Queries the information of basic monitoring and service monitoring.

Request URL

/pop/v5/monitor/queryMonitorInfo

Request method

POST

Request parameters

Parameter Type Required? Description
start Long Yes Start time; unit: ms
end Long Yes End time; unit: ms
metric String Yes A total of 21 metrics are available. For details, see metric.
tags Json Yes Dimension
aggregator String Yes Aggregation mode. Optional values: sum; avg; max; min.
interval String No Time granularity. Optional values: 1m (1 minute); 5m (5 minutes); 15m (15 minutes); 1h (1 hour). The default value is 1m.

Description of tags

Map<String,String>Serialized JSON string.The application dimension, application group dimension, application instance dimension, and service dimension are supported.

Dimension Required tagK field
Application appId
Application group appId and groupId
Application instance appId, groupId, and eccId
Service appId, groupId, and serviceName
Dependent application group appId, groupId, targetAppId, targetGroupId
Dependent service appId, groupId, targetAppId, targetGroupId, targetServiceName

metric

A total of 21 metrics are available. Tags and aggregator are supported.

Metric Meaning Dimension Aggregator
system.cpu CPU usage Application, application group, and application instance min, max, and avg
system.load Load Application, application group, and application instance min, max, and avg
system.memory.total Total memory Application, application group, and application instance min, max, and avg
system.memory.used Used memory Application, application group, and application instance min, max, and avg
system.net.out Network speed Tx Application, application group, and application instance sum and avg
system.net.in Network speed Rx Application, application group, and application instance sum and avg
system.disk.total Total disk capacity Application, application group, and application instance min, max, and avg
system.disk.used Used disk capacity Application, application group, and application instance min, max, and avg
system.disk.io.out Disk read speed Application, application group, and application instance min, max, and avg
system.disk.io.in Disk write speed Application, application group, and application instance min, max, and avg
system.disk.count.out Number of disk read requests Application, application group, and application instance min, max, and avg
system.disk.count.in Number of disk write requests Application, application group, and application instance min, max, and avg
service.http.qps HTTP call QPS Application group and service sum
service.http.errorQps HTTP call error QPS Application group and service sum
service.http.rt HTTP call RT Application group and service avg
service.rpc.server.qps RPC provider call QPS Application group and service sum
service.rpc.server.errorQps RPC provider call error QPS Application group and service sum
service.rpc.server.rt RPC provider local RT Application group and service avg
service.rpc.client.qps RPC client call QPS Dependent application group and service sum
service.rpc.client.errorQps RPC client call error QPS Dependent application group and service sum
service.rpc.client.rt RPC client local RT Dependent application group and service avg

Response parameters

Parameter Type Description
Code Integer Code
Message String Message
MonitorInfo Json Monitoring information, compliant with the open TSDB standard

Other instructions

  1. Throttling policy of this API: The total call times per minute cannot exceed 1,200; the total call times per user per minute cannot exceed 20.
  2. The query time span (end time minus start time) is up to 7 days.

Samples

The following describes how to query the average CPU per day of an application group for your better understanding and use.

Request code

// Create a POP client.
    DefaultAcsClient defaultAcsClient = getAcsClient(EDAS_TEST1_AK, EDAS_TEST1_SK, REGION_HUADONG2);

final Map&lt;String, String> tags = new HashMap&lt;String, String>() {
    {
        // ID of the application to be queried
        put("appId", "3e06d38a-b19d-4337-ab49-f09015d584f2");
        // ID of the application group to be queried
        put("groupId", "d9814437-d37d-48f6-abd0-6db82ea30b3e");
    }
};

// Create a POP query request
QueryMonitorInfoRequest request = new QueryMonitorInfoRequest();
long end = System.currentTimeMillis() - 1000;
long start = end - 24 * 3600 * 1000;
// Set the query start point
request.setStart(start);
// Set the query end point
request.setEnd(end);
// Set the query metric
request.setMetric("system.cpu");
// Set the query dimension
request.setTags(JSON.toJSONString(tags));
// Set the query aggregation method
request.setAggregator("avg");
// Set the query time granularity
request.setInterval("1h");
// Execute a call
QueryMonitorInfoResponse response = defaultAcsClient.getAcsResponse(request);

// Obtain the query result
log.info(response.getMonitorInfo());

Return code

[{"aggregatedTags":["regionId","appId","groupId","userId"],"dps":
[[1510714800000,4.38],[1510718400000,4.05],[1510722000000,4.07],
[1510725600000,4.22],[1510729200000,4.05],[1510732800000,3.92],
[1510736400000,4.02],[1510740000000,4.08],[1510743600000,4.1],
[1510747200000,4.27],[1510750800000,3.95],[1510754400000,3.95],
[1510758000000,4.03],[1510761600000,3.68],[1510765200000,3.77],
[1510768800000,3.97],[1510772400000,3.77],[1510776000000,3.85],
[1510779600000,4.15],[1510783200000,4.17],[1510786800000,3.98],
[1510790400000,3.97],[1510794000000,3.87],[1510797600000,3.83],
[1510801200000,43.86]],"metric":"system.cpu"}]

Scenario description

To help you understand the use cases of instances, the following describes how to query Monitoring Information on the Basic Monitoring page of the EDAS console by running the preceding code. You can modify the values of specific request parameters to obtain other data.

As shown in the following figure, the content in orange blocks indicates request parameters and that in green blocks indicates response parameters and response information.

QueryMonitorInfoRequest scenario description

You can also set the display mode of response information in your monitoring system.

Thank you! We've received your feedback.