修改集成相关信息。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
授权信息
下表是API对应的授权信息,可以在RAM权限策略语句的Action
元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:
- 操作:是指具体的权限点。
- 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。
- 资源类型:是指操作中支持授权的资源类型。具体说明如下:
- 对于必选的资源类型,用背景高亮的方式表示。
- 对于不支持资源级授权的操作,用
全部资源
表示。
- 条件关键字:是指云产品自身定义的条件关键字。
- 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。
操作 | 访问级别 | 资源类型 | 条件关键字 | 关联操作 |
---|---|---|---|---|
arms:UpdateIntegration | none |
|
| 无 |
请求参数
名称 | 类型 | 必填 | 描述 | 示例值 |
---|---|---|---|---|
IntegrationId | long | 是 | 告警集成 ID。 | 1234 |
IntegrationName | string | 是 | 告警集成名称。 | 云监控集成 |
IntegrationProductType | string | 是 | 集成产品类型:
| CLOUD_MONITOR |
Description | string | 否 | 告警集成描述信息。 | 测试 |
AutoRecover | boolean | 否 | 告警事件是否自动恢复:
| true |
RecoverTime | long | 否 | 告警事件自动恢复时间,默认时间为 300 秒。 | 300 |
DuplicateKey | string | 否 | 去重的字段。 | LABEL.dimensions::LABEL.ruleId |
State | boolean | 否 | 告警集成是否启用:
| true |
Stat | string | 否 | 最近 1 小时总数及异常数。 | [0,0] |
Liveness | string | 否 | 告警集成活跃度。 | ready |
FieldRedefineRules | string | 否 | 事件映射,将源字段映射到目标字段。 固定字段映射,创建集成时默认生成的固定映射。更多信息,请参见下方补充说明。 | [ { "redefineType":"EXTRACT", "matchExpression":null, "fieldName":"alertname", "expression":null, "mappingRuleList":[ ], "name":"告警名称", "integrationId":1234, "jsonPath":"$.alertName", "id":10001, "fieldType":"LABEL" }, { "redefineType":"MAP", "matchExpression":null, "fieldName":"severity", "expression":null, "mappingRuleList":[ { "mappingValue":"critical", "mappingName":"P1", "mappingType":"MAP", "originValue":"CRITICAL" }, { "mappingValue":"error", "mappingName":"P2", "mappingType":"MAP", "originValue":"WARN" }, { "mappingValue":"warning", "mappingName":"P3", "mappingType":"MAP", "originValue":"INFO" } ], "name":"告警等级", "integrationId":1234, "jsonPath":"$.triggerLevel", "id":10002, "fieldType":"LABEL" }, { "redefineType":"EXTRACT", "matchExpression":null, "fieldName":"message", "expression":"{{$labels.namespace}} / {{$labels.dimensions}} 发生 {{ $labels.alertname }}, 当前值 {{$value}}。", "mappingRuleList":[ ], "name":"告警描述", "integrationId":1234, "jsonPath":null, "id":10003, "fieldType":"ANNOTATION" }, { "redefineType":"EXTRACT", "matchExpression":null, "fieldName":"value", "expression":null, "mappingRuleList":[ ], "name":"告警样本值", "integrationId":1234, "jsonPath":"$.curValue", "id":10004, "fieldType":"ANNOTATION" }, { "redefineType":"EXTRACT", "matchExpression":null, "fieldName":"source", "expression":null, "mappingRuleList":[ ], "name":"来源", "integrationId":1234, "jsonPath":null, "id":10007, "fieldType":"LABEL" }, { "redefineType":"ADD", "matchExpression":null, "fieldName":"generatorUrl", "expression":"https://cloudmonitor.console.aliyun.com/index.htm#/alarmInfo/name={{$labels.ruleId}}&searchValue=&searchType=name&searchProduct=/history/all/searchKey:{{$labels.ruleId}},startTime:{{sub $startsAt 300000}},endTime:{{$endsAt}}", "mappingRuleList":[ ], "name":"事件地址", "integrationId":1234, "jsonPath":"https://cloudmonitor.console.aliyun.com/index.htm#/alarmInfo/name={{$labels.ruleId}}&searchValue=&searchType=name&searchProduct=/history/all/searchKey:{{$labels.ruleId}},startTime:{{sub $startsAt 300000}},endTime:{{$endsAt}}", "id":10012, "fieldType":"GENERATE_URL" } ] |
ExtendedFieldRedefineRules | string | 否 | 事件映射,将源字段映射到目标字段,拓展字段增加映射。更多信息,请参见下方补充说明。 | [ { "redefineType":"EXTRACT", "matchExpression":null, "fieldName":"dimensions", "expression":null, "mappingRuleList":[ ], "name":"dimensions", "integrationId":1234, "jsonPath":"$.dimensions", "id":10013, "fieldType":"LABEL" }, { "redefineType":"EXTRACT", "matchExpression":null, "fieldName":"expression", "expression":null, "mappingRuleList":[ ], "name":"expression", "integrationId":1234, "jsonPath":"$.expression", "id":10014, "fieldType":"LABEL" } ] |
InitiativeRecoverField | string | 否 | 告警事件恢复字段。系统收到恢复事件后会根据恢复事件中的字段查询告警事件进行恢复。 说明
仅日志服务支持设置此参数。
| $.status |
InitiativeRecoverValue | string | 否 | 告警事件恢复字段值。系统收到恢复事件后会根据恢复事件中的字段查询告警事件进行恢复。 说明
仅日志服务支持设置此参数。
| ok |
FieldRedefineRules 和 ExtendedFieldRedefineRules 参数说明
完整示例如下:
[
{
"redefineType":"EXTRACT",
"matchExpression":null,
"fieldName":"alertname",
"expression":null,
"mappingRuleList":[
],
"name":"告警名称",
"integrationId":1234,
"jsonPath":"$.alertName",
"id":10001,
"fieldType":"LABEL"
},
{
"redefineType":"MAP",
"matchExpression":null,
"fieldName":"severity",
"expression":null,
"mappingRuleList":[
{
"mappingValue":"critical",
"mappingName":"P1",
"mappingType":"MAP",
"originValue":"CRITICAL"
},
{
"mappingValue":"error",
"mappingName":"P2",
"mappingType":"MAP",
"originValue":"WARN"
},
{
"mappingValue":"warning",
"mappingName":"P3",
"mappingType":"MAP",
"originValue":"INFO"
}
],
"name":"告警等级",
"integrationId":1234,
"jsonPath":"$.triggerLevel",
"id":10002,
"fieldType":"LABEL"
},
{
"redefineType":"EXTRACT",
"matchExpression":null,
"fieldName":"message",
"expression":"{{$labels.namespace}} / {{$labels.dimensions}} 发生 {{ $labels.alertname }}, 当前值 {{$value}}。",
"mappingRuleList":[
],
"name":"告警描述",
"integrationId":1234,
"jsonPath":null,
"id":10003,
"fieldType":"ANNOTATION"
},
{
"redefineType":"EXTRACT",
"matchExpression":null,
"fieldName":"value",
"expression":null,
"mappingRuleList":[
],
"name":"告警样本值",
"integrationId":1234,
"jsonPath":"$.curValue",
"id":10004,
"fieldType":"ANNOTATION"
},
{
"redefineType":"EXTRACT",
"matchExpression":null,
"fieldName":"imageUrl",
"expression":null,
"mappingRuleList":[
],
"name":"告警图片",
"integrationId":1234,
"jsonPath":null,
"id":10005,
"fieldType":"ANNOTATION"
},
{
"redefineType":"EXTRACT",
"matchExpression":null,
"fieldName":"check",
"expression":null,
"mappingRuleList":[
],
"name":"检查项",
"integrationId":1234,
"jsonPath":null,
"id":10006,
"fieldType":"LABEL"
},
{
"redefineType":"EXTRACT",
"matchExpression":null,
"fieldName":"source",
"expression":null,
"mappingRuleList":[
],
"name":"来源",
"integrationId":1234,
"jsonPath":null,
"id":10007,
"fieldType":"LABEL"
},
{
"redefineType":"EXTRACT",
"matchExpression":null,
"fieldName":"class",
"expression":null,
"mappingRuleList":[
],
"name":"分类",
"integrationId":1234,
"jsonPath":null,
"id":10008,
"fieldType":"LABEL"
},
{
"redefineType":"EXTRACT",
"matchExpression":null,
"fieldName":"service",
"expression":null,
"mappingRuleList":[
],
"name":"服务",
"integrationId":1234,
"jsonPath":null,
"id":10009,
"fieldType":"LABEL"
},
{
"redefineType":"EXTRACT",
"matchExpression":null,
"fieldName":"startat",
"expression":null,
"mappingRuleList":[
],
"name":"开始时间",
"integrationId":1234,
"jsonPath":null,
"id":10010,
"fieldType":"START_AT"
},
{
"redefineType":"EXTRACT",
"matchExpression":null,
"fieldName":"endat",
"expression":null,
"mappingRuleList":[
],
"name":"结束时间",
"integrationId":1234,
"jsonPath":null,
"id":10011,
"fieldType":"END_AT"
},
{
"redefineType":"ADD",
"matchExpression":null,
"fieldName":"generatorUrl",
"expression":"https://cloudmonitor.console.aliyun.com/index.htm#/alarmInfo/name={{$labels.ruleId}}&searchValue=&searchType=name&searchProduct=/history/all/searchKey:{{$labels.ruleId}},startTime:{{sub $startsAt 300000}},endTime:{{$endsAt}}",
"mappingRuleList":[
],
"name":"事件地址",
"integrationId":1234,
"jsonPath":"https://cloudmonitor.console.aliyun.com/index.htm#/alarmInfo/name={{$labels.ruleId}}&searchValue=&searchType=name&searchProduct=/history/all/searchKey:{{$labels.ruleId}},startTime:{{sub $startsAt 300000}},endTime:{{$endsAt}}",
"id":10012,
"fieldType":"GENERATE_URL"
}
]
字段说明:
字段 | 说明 |
---|---|
RedefineType | - MAP:通过映射表进行字段映射,如告警等级映射。 - EXTRACT:通过 jsonPath 从 JSON 中解析一个字段映射到目标字段。 - ADD:添加一个内容映射到目标字段。 - CONDITION:条件映射。当满足条件时,通过 jsonPath 从 JSON 中解析一个字段映射到目标字段。 - CONCAT:串联映射。将多个字段以指定的串联符合拼接在一起后映射到模板字段。 |
MatchExpression | - 如果 RedefineType 设置为 CONCAT,MatchExpression 的值即为传递串联的分隔符。 - 如果 RedefineType 设置为 CONDITION,MatchExpression 的值即为传递条件规则的 JSON 字符串。 |
FieldType | - LABEL:告警元数据,一组标签唯一标识一个事件,标签相同的事件为同一个事件,重复上报会进行合并,常见的标签如 “alertname: 告警名称 ”。 - ANNOTATION:注释是告警事件的附加描述,注释不属于元数据。常见的注释有 “message: 告警内容”。 - GENERATE_URL:事件 URL 地址。 - START_AT:告警事件开始时间。 - END_AT:告警事件结束时间。 |
Expression | 条件映射样式,作为转义字符串值存入 Expression。 |
MappingRuleList | 字段重定义规则。 |
Name | 名称。 |
FieldName | 字段名称。 |
JsonPath | 源字段名称。 |
IntegrationId | 集成 ID。 |
Id | 映射字段存储表主键 ID。 |
返回参数
示例
正常返回示例
JSON
格式
{
"RequestId": "34ED024E-9E31-434A-9E4E-D9D15C3****",
"Integration": {
"IntegrationId": 1234,
"IntegrationName": "云监控集成",
"IntegrationProductType": "CLOUD_MONITOR",
"Description": "测试",
"ApiEndpoint": "https://alerts.aliyuncs.com/api/v1/integrations/custom/ymQBN******",
"ShortToken": "ymQBN******",
"AutoRecover": true,
"RecoverTime": 300,
"DuplicateKey": "LABEL.dimensions::LABEL.ruleId",
"State": true,
"Stat": [
0
],
"Liveness": "ready",
"FieldRedefineRules": [
[
{
"redefineType": "EXTRACT",
"matchExpression": null,
"fieldName": "alertname",
"expression": null,
"mappingRuleList": [],
"name": "告警名称",
"integrationId": 1234,
"jsonPath": "$.alertName",
"id": 10001,
"fieldType": "LABEL"
},
{
"redefineType": "MAP",
"matchExpression": null,
"fieldName": "severity",
"expression": null,
"mappingRuleList": [
{
"mappingValue": "critical",
"mappingName": "P1",
"mappingType": "MAP",
"originValue": "CRITICAL"
},
{
"mappingValue": "error",
"mappingName": "P2",
"mappingType": "MAP",
"originValue": "WARN"
},
{
"mappingValue": "warning",
"mappingName": "P3",
"mappingType": "MAP",
"originValue": "INFO"
}
],
"name": "告警等级",
"integrationId": 1234,
"jsonPath": "$.triggerLevel",
"id": 10002,
"fieldType": "LABEL"
},
{
"redefineType": "EXTRACT",
"matchExpression": null,
"fieldName": "message",
"expression": "{{$labels.namespace}} / {{$labels.dimensions}} 发生 {{ $labels.alertname }}, 当前值 {{$value}}。",
"mappingRuleList": [],
"name": "告警描述",
"integrationId": 1234,
"jsonPath": null,
"id": 10003,
"fieldType": "ANNOTATION"
},
{
"redefineType": "EXTRACT",
"matchExpression": null,
"fieldName": "value",
"expression": null,
"mappingRuleList": [],
"name": "告警样本值",
"integrationId": 1234,
"jsonPath": "$.curValue",
"id": 10004,
"fieldType": "ANNOTATION"
},
{
"redefineType": "EXTRACT",
"matchExpression": null,
"fieldName": "source",
"expression": null,
"mappingRuleList": [],
"name": "来源",
"integrationId": 1234,
"jsonPath": null,
"id": 10007,
"fieldType": "LABEL"
},
{
"redefineType": "ADD",
"matchExpression": null,
"fieldName": "generatorUrl",
"expression": "https://cloudmonitor.console.aliyun.com/index.htm#/alarmInfo/name={{$labels.ruleId}}&searchValue=&searchType=name&searchProduct=/history/all/searchKey:{{$labels.ruleId}},startTime:{{sub $startsAt 300000}},endTime:{{$endsAt}}",
"mappingRuleList": [],
"name": "事件地址",
"integrationId": 1234,
"jsonPath": "https://cloudmonitor.console.aliyun.com/index.htm#/alarmInfo/name={{$labels.ruleId}}&searchValue=&searchType=name&searchProduct=/history/all/searchKey:{{$labels.ruleId}},startTime:{{sub $startsAt 300000}},endTime:{{$endsAt}}",
"id": 10012,
"fieldType": "GENERATE_URL"
}
]
],
"ExtendedFieldRedefineRules": [
[
{
"redefineType": "EXTRACT",
"matchExpression": null,
"fieldName": "dimensions",
"expression": null,
"mappingRuleList": [],
"name": "dimensions",
"integrationId": 1234,
"jsonPath": "$.dimensions",
"id": 10013,
"fieldType": "LABEL"
},
{
"redefineType": "EXTRACT",
"matchExpression": null,
"fieldName": "expression",
"expression": null,
"mappingRuleList": [],
"name": "expression",
"integrationId": 1234,
"jsonPath": "$.expression",
"id": 10014,
"fieldType": "LABEL"
}
]
],
"InitiativeRecoverField": "$.status",
"InitiativeRecoverValue": "ok"
}
}
错误码
访问错误中心查看更多错误码。
变更历史
变更时间 | 变更内容概要 | 操作 |
---|---|---|
2023-06-12 | OpenAPI 入参发生变更 | 查看变更详情 |
2022-08-11 | API 内部配置变更,不影响调用 | 查看变更详情 |