You need to enable JavaScript to run this app.
文档中心
云监控

云监控

复制全文
下载 pdf
回调
指标告警回调请求内容
复制全文
下载 pdf
指标告警回调请求内容
当告警策略被触发且满足发送告警通知的聚合条件后,云监控通过告警回调接口发送POST请求至指定的URL。指标告警回调请求内容包括回调请求头Header和回调请求体Body。​
回调请求头(Header)​
​
Header 键​
Header 值​
说明​
x-volc-trace-id​
随机 uuid​
用于请求追踪。​
x-volc-rule-id​
{ rule_id }​
策略ID。​
​
回调请求体(Body)​
数据类型​
请求体的数据类型为application/json。​
请求体参数​
​
参数​
类型​
示例值​
说明​
Type​
String​
Metric​
告警类型。​
  • Metric:阈值​
  • Event:事件​
  • MetricRecovered:告警恢复​
  • MetricsNoData:无数据告警​
  • NoDataRecovered:无数据告警恢复​
AccountId​
String​
20*****007​
账户ID。​
RuleName​
String​
测试告警策略​
策略名称。​
RuleId​
String​
1574726******98880​
策略ID。​
Namespace​
String​
VCM_FileNAS​
产品类型。​
SubNamespace​
String​
latency​
维度。​
Level​
String​
critical​
告警级别。​
  • critical:严重​
  • warning:警告​
  • notice:提示​
HappenedAt​
String​
2024-04-11 14:51:01(UTC+08:00)​
告警发生时间。​
RuleCondition​
String​
多指标告警(任意):​
CPU 使用率平均值 > 90%, 持续 10 个周期(1 周期 = 1 分钟)​
内存使用率平均值 > 90%, 持续 10 个周期(1 周期 = 1 分钟)​
告警策略详情。​
Resources​
Array​
-​
告警通知的资源详情。具体格式,请参见Resource结构。​
RecoveredResources​
Array​
-​
告警恢复通知的资源详情。具体格式,请参见Resource结构。​
NoDataResources​
Array​
-​
无数据告警的资源详情。具体格式,请参见Resource结构。​
NoDataRecoveredResources​
Array​
-​
无数据告警恢复通知的资源详情。具体格式,请参见Resource结构。​
​
Resource结构​
​
参数​
类型​
示例值​
说明​
Id​
String​
enas-cn04*****45d06f​
资源ID。​
Name​
String​
enas-cn04*****45d06f​
资源名称。​
Region​
String​
cn-north-3​
地域。​
FirstAlertTime​
Int​
1664332705​
初次告警时间。​
LastAlertTime​
Int​
1664332705​
本次告警发生时间。​
Metrics​
Object​
-​
解析成功的指标。阈值告警请参见该字段。具体格式,请参见Metric结构。​
NoDataMetrics​
Object​
-​
无打点数据的指标。无数据告警请参见该字段。​
DroppedMetrics​
Object​
-​
解析失败的指标。例如值为NaN,有的这种场景在告警计算中使用除法,但被除数是0,导致计算结果认为无法解析。​
AlertGroupId​
String​
673******a06​
告警历史ID。​
Dimensions​
Object​
-​
资源维度信息。具体格式,请参见Dimension结构。​
​
Metric结构​
​
参数​
类型​
示例值​
说明​
Name​
String​
Nfsv3WriteLatency​
指标名称。​
Unit​
String​
ms​
指标的单位。​
Threshold​
Float​
1​
该策略下该指标阈值。​
CurrentValue​
Float​
0.0001​
该指标当前值。​
Description​
String​
NFSv3 write latency​
该指标的描述。​
Warning​
Bool​
true​
该指标触发告警。该字段仅在指标触发告警时存在。​
​
Dimension结构​
​
参数​
类型​
示例值​
说明​
Name​
String​
ResourceID​
指标维度。​
Value​
String​
enas-cn04*****45d06f​
该维度的值。​
NameCN​
String​
实例 ID​
维度的中文名称。​
​
请求体示例​
说明​
您可以忽略实际接收到的请求体中,没有提供参数说明的参数。这些参数将不会影响您获取告警通知的详细信息。​
告警通知请求体​
​
{​
"Type": "Metric",​
"AccountId": "20******007",​
"RuleName": "测试告警策略",​
"RuleId": "1574726******98880",​
"Namespace": "VCM_FileNAS",​
"SubNamespace": "latency",​
"Level": "critical",​
"HappenedAt":"2024-04-11 14:51:01(UTC+08:00)",​
"RuleCondition":"多指标告警(任意):CPU使用率平均值>90%,持续10个周期(1周期=1分钟)内存使用率平均值>90%,持续10个周期(1周期=1分钟)",​
"Resources": [​
{​
"Id": "enas-cn04*****45d06f",​
"Name": "enas-cn04*****45d06f",​
"Region": "cn-north-3",​
"FirstAlertTime": 1664332705,​
"LastAlertTime": 1664332705,​
"Metrics": [​
{​
"Name": "Nfsv3WriteLatency",​
"Unit": "ms",​
"Threshold": 1,​
"CurrentValue": 0.0001,​
"Description": "NFSv3写延时",​
}​
],​
"AlertGroupId": "673******a06",​
"Dimensions": [​
{​
"Name": "ResourceID",​
"NameCN": "实例ID",​
"Value": "enas-cn04*****45d06f"​
},​
{​
"Name": "Node",​
"NameCN": "节点",​
"Value": "enas-cn04*****45d06f-pod-0"​
}​
]​
}​
]​
}​
​
告警恢复通知请求体​
​
{​
"Type": "MetricRecovered",​
"AccountId": "20******007",​
"RuleName": "测试告警策略",​
"RuleId": "1574726******98880",​
"Namespace": "VCM_FileNAS",​
"SubNamespace": "latency",​
"Level": "critical",​
"HappenedAt":"2024-04-11 14:51:01(UTC+08:00)",​
"RuleCondition":"多指标告警(任意):CPU使用率平均值>90%,持续10个周期(1周期=1分钟)内存使用率平均值>90%,持续10个周期(1周期=1分钟)",​
"Resources":[],​
"RecoveredResources": [​
{​
"Id": "enas-cn04*****45d08k",​
"Name": "enas-cn04*****45d08k",​
"Region": "cn-north-3",​
"FirstAlertTime": 1664332705,​
"LastAlertTime": 1664332705,​
"Metrics": [​
{​
"Name": "Nfsv3WriteLatency",​
"Unit": "ms",​
"Threshold": 1,​
"CurrentValue": 0.5,​
"Description": "NFSv3写延时"​
}​
],​
"AlertGroupId": "673******a06",​
"Dimensions": [​
{​
"Name": "ResourceID",​
"NameCN": "实例ID",​
"Value": "enas-cn04*****45d06f"​
},​
{​
"Name": "Node",​
"NameCN": "节点",​
"Value": "enas-cn04*****45d06f-pod-0"​
}​
]​
}​
]​
}​
​
无数据告警通知请求体​
​
{​
"Type": "MetricsNoData",​
"AccountId": "21*****168",​
"RuleName": "test",​
"RuleId": "18039******80320",​
"Namespace": "VCM_ECS",​
"SubNamespace": "Instance",​
"HappenedAt": "2024-07-12 00:43:06(UTC+08:00)",​
"RuleCondition": "多指标告警(任意):\n带外CPU利用率平均值!=12%, 持续1个周期(1周期=1分钟)\nCPU使用率平均值!=14%, 持续1个周期(1周期=1分钟)\n网卡流出速率最大值!=11bit/s, 持续1个周期(1周期=1分钟)",​
"Level": "warning",​
"NoDataResources": [​
{​
"Id": "i-ycd1********dfy01t",​
"Name": "cloudmonitor-test-project",​
"Region": "cn-guilin-boe",​
"FirstAlertTime": 1720704066,​
"LastAlertTime": 1720716186,​
"Metrics": [​
{​
"Name": "Instance_CpuBusy",​
"Unit": "%",​
"Threshold": 12,​
"CurrentValue": 0.0583,​
"Description": "带外CPU利用率",​
"Warning": true,​
},​
{​
"Name": "CpuTotal",​
"Unit": "%",​
"Threshold": 14,​
"CurrentValue": 0.03,​
"Description": "CPU使用率",​
"Warning": true,​
}​
],​
"NoDataMetrics": [​
{​
"Name": "NetworkPerNicOutRate",​
"Unit": "bit/s",​
"Threshold": 0,​
"CurrentValue": 0,​
"Description": "网卡流出速率"​
}​
],​
"AlertGroupId": "673******a06",​
"Dimensions": [​
{​
"Name": "ResourceID",​
"Value": "i-ycd1********fy01t",​
"Description": "实例"​
},​
{​
"Name": "IP.Inside",​
"Value": "192.168.**.**",​
"Description": "私网"​
},​
{​
"Name": "IP.Outside",​
"Value": "10.249.**.**",​
"Description": "公网"​
}​
]​
}​
]​
}​
​
无数据告警恢复通知请求体​
​
{​
"Type": "NoDataRecovered",​
"AccountId": "21******00",​
"RuleName": "test_custom",​
"RuleId": "18076********524992",​
"Namespace": "VCM_CloudMonitor_Metrics_Test_Tool",​
"SubNamespace": "base",​
"HappenedAt": "2024-07-02 15:27:03(UTC+08:00)",​
"RuleCondition": "多指标告警(全部):\n分钟周期的秒值最大值\u003e1ms, 持续1个周期(1周期=1分钟)\n小时最大值\u003e1ms, 持续1个周期(1周期=1分钟)",​
"Level": "critical",​
"NoDataRecoveredResources": [​
{​
"Id": "1784**********92608",​
"Name": "Test random",​
"Region": "cn-taiwan-boe",​
"FirstAlertTime": 1719902340,​
"LastAlertTime": 1719905223,​
"Metrics": [​
{​
"Name": "graph_seconds_of_minutes",​
"Unit": "ms",​
"Threshold": 1,​
"CurrentValue": 60000,​
"Description": "分钟周期的秒值"​
}​
],​
"AlertGroupId": "673******a06",​
"Dimensions": [​
{​
"Name": "ResourceID",​
"Value": "1784*********92608",​
"Description": "base"​
},​
{​
"Name": "Status",​
"Value": "运行中",​
"Description": "状态"​
}​
],​
"DroppedMetrics": [​
{​
"Name": "graph_hours_of_days",​
"Unit": "ms",​
"Threshold": 1,​
"CurrentValue": "NaN",​
"Description": "小时",​
"Reason": "float64 NaN can not encoded by JSON"​
}​
]​
}​
]​
}​
​
​
最近更新时间:2025.12.16 15:24:51
这个页面对您有帮助吗?
有用
有用
无用
无用