文档

CreateEnvServiceMonitor - 创建环境的ServiceMonitor

更新时间:

创建环境的ServiceMonitor。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

当前API暂无授权信息透出。

请求参数

名称类型必填描述示例值
RegionIdstring

地域 ID。

cn-hangzhou
AliyunLangstring

语言环境:

  • zh(默认):中文
  • en:英文
zh
EnvironmentIdstring

环境实例 ID。

env-xxxxxx
DryRunboolean

试运行。检查格式是否合法、是否能匹配到 targets。

true
ConfigYamlstring

ServiceMonitor 的 YAML 配置串。

参见补充说明。

ConfigYaml 示例:

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: arms-admin1
  namespace: arms-prom
  annotations:
    arms.prometheus.io/discovery: 'true'
spec:
  endpoints:
  - interval: 30s
    port: operator
    path: /metrics
  - interval: 10s
    port: operator1
    path: /metrics
  namespaceSelector:
    any: true
  selector:
    matchLabels:
     app: arms-prometheus-ack-arms-prometheus

其中 arms.prometheus.io/discovery 必须存在,其值为“true”,表示 serviceMonitor 启用,否则表示停止。

返回参数

名称类型描述示例值
object

Schema of Response

RequestIdstring

Id of the request

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

状态码。200 表示成功。

200
Dataobject

返回结构体。

MatchedMsgstring

Target 匹配提示信息。

匹配成功。
Namespacestring

命名空间。

arms-prom
ServiceMonitorNamestring

成功创建的 ServiceMonitor 名称。

arms-admin1
MatchedTargetCountinteger

匹配出的 target 数量。

1
Messagestring

返回结果的提示信息。

message

示例

正常返回示例

JSON格式

{
  "RequestId": "78901766-3806-4E96-8E47-CFEF59E4****",
  "Code": 200,
  "Data": {
    "MatchedMsg": "匹配成功。",
    "Namespace": "arms-prom",
    "ServiceMonitorName": "arms-admin1",
    "MatchedTargetCount": 1
  },
  "Message": "message"
}

错误码

访问错误中心查看更多错误码。

变更历史

变更时间变更内容概要操作
暂无变更历史
  • 本页导读 (1)
文档反馈