修改集成相關信息。
調試
您可以在OpenAPI Explorer中直接運行該接口,免去您計算簽名的困擾。運行成功后,OpenAPI Explorer可以自動生成SDK代碼示例。
授權信息
下表是API對應的授權信息,可以在RAM權限策略語句的Action
元素中使用,用來給RAM用戶或RAM角色授予調用此API的權限。具體說明如下:
- 操作:是指具體的權限點。
- 訪問級別:是指每個操作的訪問級別,取值為寫入(Write)、讀?。≧ead)或列出(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 內部配置變更,不影響調用 | 查看變更詳情 |