Query monitoring data

2023-08-15 11:21:17  Updated

Description

You can call this operation to specify an index to query the monitoring data of the index. You must specify the time range of the query and the array of the index. Specify the query scope and summarize the data based on the tag. The query results are listed by time.

The sampling points of the query results approximate to 1440, regardless of the time range of the query.

Call description

Prerequisite

You have passed the authentication for the OCP application service.

Request path

GET /api/v2/monitor/metric

Request parameters

Parameter Type Required Example Description
start_time Datetime Yes 2020-02-16T05:32:16+08:00 The start time of the monitoring data.
end_time Datetime Yes 2020-02-16T07:32:16+08:00 The end time of the monitoring data.
metrics StringArray Yes io_read_time,io_write_time The array of the monitoring metric.
groupBy StringArray Yes app,obregion,ob_cluster_id The tag used for summarizing the monitoring data.
interval Integer Yes 60 The interval of the monitoring data, in the unit of seconds.
labels StringArray Yes app:ob,obregion=foo The filter condition of the monitoring data.

Response parameters

  • Basic data structure
Parameter Type Description
data Object The request data.
├─ contents Array The array of the monitored sample. For more information about its data structure, see the following table.
successful Boolean Whether the request is successful.
timestamp Datetime The timestamp when the server completes the request.
duration Integer The time that the server takes to process the request, in milliseconds.
status Integer The encoding in compliance with the HTTP Status specification.
traceId String The trace ID of the request. This trace ID is used for troubleshooting.
server String The address of the server that responds to the request.
  • Data structure of the sample information, which is determined based on the monitoring metric
Parameter Type Description
timestamp Integer The point in the sampling time, which is counted from 1970-01-01 00:00:00 in the unit of seconds.
Metric name A Float Corresponding to the sample value of the index
Metric name B Float Corresponding to the sample value of the index

Examples

Sample request

Query monitoring data that is generated from 2020-11-11 18:30:00.000+08:00 to 2020-11-11 19:00:00.000+08:00. Set the monitoring metric to net_recv and net_send, and set the sampling interval to 60s. Set the value of app to ob, obregion to ob1, and ob_cluster_id to 1. The monitoring data is summarized based on the app, obregion, and ob_cluster_id tags.

/api/v2/monitor/metric?startTime=2020-11-11T18%3A30%3A00.000%2B08%3A00&endTime=2020-11-11T19%3A00%3A00.000%2B08%3A00&interval=60&metrics=net_recv%2Cnet_send&labels=app%3Aob%2Cobregion%3Aob1%2Cob_cluster_id%3A1&groupBy=app%2Cobregion%2Cob_cluster_id

Sample response

{
    "duration":113,
    "server":"192.168.100.1",
    "status":200,
    "successful":true,
    "timestamp":"2020-11-17T19:01:45.404+08:00",
    "traceId":"0d40b2d8e6984e49",
    "data":{
        "contents":[
            {
                "net_recv":0.3,
                "net_send":0.31,
                "timestamp":1605609840
            },
            {
                "net_recv":0.29,
                "net_send":0.3,
                "timestamp":1605610800
            }
        ],
        "page":{
            "number":2,
            "size":2147483647,
            "totalElements":30,
            "totalPages":1
        }
    }
}

Contact Us