GetEmonMonitorData
Queries the Grafana metric monitoring data of an Elasticsearch instance.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
elasticsearch:QueryEmonMetrics |
get |
*emonProjects
|
None | None |
Request syntax
POST /openapi/emon/projects/{ProjectId}/metrics/query HTTP/1.1
Path Parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ProjectId |
string |
Yes |
The project ID. The format is |
es-185320276651**** |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| body |
string |
No |
The Grafana metric monitoring query conditions, including the query start time, metric expression, and metric query list. |
{"start":1522127381471,"queries":[{"metric":"elasticbuild.elasticsearch.source.total_doc_count","aggregator":"sum","downsample":"avg","tags":{"taskName":"et-testtsk","userId":"123456"},"granularity":"1m"}],"limit":"","end":1522129151000} |
Request body
| Parameter | Type | Required | Example | Description |
| start | Long | Yes | 1522127381471 | The timestamp when the metric monitoring starts. Unit: milliseconds. |
| expression | String | No | a+b | The metric data query expression. |
| queries | List | Yes | The metric query conditions. | |
| └id | String | No | a | If the queries parameter uses the expression parameter, the queries JSON array describes the metrics involved in the expression operation. The id is the algebraic symbol of each metric in the expression, and the actual metric name is specified in each element of the queries array. |
| └metric | String | Yes | elasticbuild.elasticsearch.source.total_doc_count | The metric name. |
| └aggregator | String | Yes | sum | The aggregation method for the metric based on the tags dimension. This groups the metric by the specified tags and performs aggregation operations such as sum, avg, max, and min. |
| └downsample | String | Yes | avg | The aggregation method for the metric based on time granularity. This reduces the time granularity of the metric timeline within the [start,end] window. For example, it aggregates 20s granularity into 1min, 10min, or 1hour granularity. The granularity is automatically reduced based on the size of the time window. |
| └tags | Map | Yes | [env,dev] | The metric query tags. The format is [key,value]. The key must be explicitly specified, and the value supports wildcards. Using wildcards returns multiple time series data records that meet the conditions. |
| └granularity | String | Yes | 1m | The time granularity of the metric query. The range is [start,end]. Unit: milliseconds. |
| limit | String | Yes | "100 " | The maximum size of the returned result set. If this parameter is empty, no limit is applied and all queried data is returned. This is typically used when the value in tags uses wildcards and the returned result set is extremely large. |
| end | String | Yes | 1522129151000 | The timestamp when the metric monitoring ends. Unit: milliseconds. |
└ indicates a child parameter.
Example:
{
"start": 1522127381471,
"queries": [
{
"metric": "elasticbuild.elasticsearch.source.total_doc_count",
"aggregator": "sum",
"downsample": "avg",
"tags": {
"taskName": "et-testtsk",
"userId":"123456"
},
"granularity": "1m"
}
],
"limit": "",
"end": 1522129151000
}
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Code |
string |
The request status code. |
200 |
| Message |
string |
The request result. |
"" |
| RequestId |
string |
The request ID. |
2D184B55-FA51-43F7-A1EF-E68A0545**** |
| Success |
boolean |
Specifies whether the request is successful. Valid values:
|
true |
| Result |
array<object> |
The returned result. |
|
|
array<object> |
|||
| integrity |
number |
The completeness of the time series curve data points in the result returned by the metric query. A value of 1.0 indicates 100% completeness. |
1.0 |
| summary |
number |
If the queries contain wildcards, the result includes multiple matched time series data records. The summary is the aggregation of the value sets of these time series at each time point based on the aggregator type provided in the query. Currently, only avg is supported for the aggregation method. |
10 |
| messageWatermark |
integer |
The timestamp when the request reaches the server. This is used for troubleshooting. |
1522127381471 |
| dps |
object |
The real-time metric monitoring data. The format is |
{ "1586249280": 465.1980465119913, "1586249300": 213.45243650423305 } |
| tags |
object |
The query tags. |
{"taskName":"et-xxx","userId":"123456"} |
| metric |
string |
The metric name. |
elasticbuild.elasticsearch.source.total_doc_count |
In the following response example, only the parameters in the returned data list are guaranteed. Other parameters are for reference only and must not be strictly relied upon in programs.
Examples
Success response
JSON format
{
"Code": "200",
"Message": "\"\"",
"RequestId": "2D184B55-FA51-43F7-A1EF-E68A0545****",
"Success": true,
"Result": [
{
"integrity": 1,
"summary": 10,
"messageWatermark": 1522127381471,
"dps": {
"1586249280": 465.1980465119913,
"1586249300": 213.45243650423305
},
"tags": {
"taskName": "et-xxx",
"userId": "123456"
},
"metric": "elasticbuild.elasticsearch.source.total_doc_count"
}
]
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InstanceActivating | Instance is activating. | Instance is activating. |
| 400 | InstanceNotFound | The instanceId provided does not exist. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.