All Products
Search
Document Center

Managed Service for Prometheus:CreateEnvServiceMonitor

Last Updated:May 09, 2024

Creates a ServiceMonitor for an environment.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region ID.

cn-hangzhou
AliyunLangstringNo

The language. Valid values: zh and en. Default value: zh.

zh
EnvironmentIdstringYes

The ID of the environment instance.

env-xxxxxx
DryRunbooleanNo

Specifies whether to perform only a dry run, without performing the actual request.

true
ConfigYamlstringYes

The YAML configuration string of the ServiceMonitor.

Refer to supplementary instructions.

Response parameters

ParameterTypeDescriptionExample
object

Schema of Response

RequestIdstring

The request ID.

78901766-3806-4E96-8E47-CFEF59E4****
Codeinteger

The HTTP status code. The status code 200 indicates that the request was successful.

200
Dataobject

The returned struct.

MatchedMsgstring

Indicates whether targets are matched.

Match successful.
Namespacestring

The namespace.

arms-prom
ServiceMonitorNamestring

The name of the created ServiceMonitor.

arms-admin1
MatchedTargetCountinteger

The number of matched targets.

1
Messagestring

The returned message.

message

Examples

Sample success responses

JSONformat

{
  "RequestId": "78901766-3806-4E96-8E47-CFEF59E4****",
  "Code": 200,
  "Data": {
    "MatchedMsg": "Match successful.\n",
    "Namespace": "arms-prom",
    "ServiceMonitorName": "arms-admin1",
    "MatchedTargetCount": 1
  },
  "Message": "message"
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history