告警与响应相关接口/告警规则
POSTAlerting起始版本 1.0同步需要认证
创建告警规则
创建新告警规则阈值通知设置。
调试可用性
在线调试
使用当前认证信息和示例参数提交 Mock 请求。
请求参数
请求体字段
nameString必填资源名称。
示例: High CPU Usage
descriptionString必填资源的详细描述。
示例: Alert when CPU exceeds 90%
resourceTypeString必填资源类型。
示例: vm
metricNameString必填监控项名称。
示例: cpu_usage_percent
operatorString必填比较运算符。
示例: >
响应状态
请求地址
POST/api/v1/alerting/rules
/api/v1/alerting/rules
请求示例
curl -X POST '{host}/api/v1/alerting/rules' -H 'Authorization: Bearer {token}' -H 'Content-Type: application/json' -d '{"name":"High CPU Usage","description":"Alert when CPU exceeds 90%","resourceType":"vm","metricName":"cpu_usage_percent","operator":">","threshold":90.0,"duration":300,"severity":"critical","state":"enabled","notifyUrl":"https://example.com/callback","platformUuid":"plat-001-abc","type":"metric","logQuery":"level=error","logWindow":600,"actions":"(nested array)","labelSelectors":"(nested object)"}'
响应示例
200{
"uuid": "rule-abc123-def456",
"name": "High CPU Usage",
"description": "Triggers when CPU usage exceeds 90% for 5 minutes",
"resourceType": "vm",
"metricName": "cpu_usage_percent",
"operator": ">",
"threshold": 90.0,
"duration": 300
}变更历史
此 API 暂无变更历史记录。
