GetEmonMonitorData

Updated at:

Queries the Grafana metric monitoring data of an Elasticsearch instance.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

elasticsearch:QueryEmonMetrics

get

*emonProjects

acs:elasticsearch:{#regionId}:{#accountId}:emonProjects/{#emonProjectsId}

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-current account ID.

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

ParameterTypeRequiredExampleDescription
startLongYes1522127381471The timestamp when the metric monitoring starts. Unit: milliseconds.
expressionStringNoa+bThe metric data query expression.
queriesListYesThe metric query conditions.
└idStringNoaIf 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.
└metricStringYeselasticbuild.elasticsearch.source.total_doc_countThe metric name.
└aggregatorStringYessumThe 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.
└downsampleStringYesavgThe 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.
└tagsMapYes[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.
└granularityStringYes1mThe time granularity of the metric query. The range is [start,end]. Unit: milliseconds.
limitStringYes"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.
endStringYes1522129151000The timestamp when the metric monitoring ends. Unit: milliseconds.
Note

└ 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: Successful.

  • false: Unsuccessful.

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 {timestamp:data}.

{ "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.