跳转到主要内容
告警与响应相关接口/告警规则
PUTAlerting起始版本 1.0同步需要认证

更新告警抑制规则

更新已存在抑制规则配置。

调试可用性

在线调试

使用当前认证信息和示例参数提交 Mock 请求。

路径参数

请求参数

路径参数

  • ruleIdString必填

    规则ID。

请求体字段

  • nameString必填

    资源名称。

    示例: Updated inhibition rule

  • descriptionString必填

    资源的详细描述。

    示例: Updated description

  • sourceMatchString必填

    新源匹配器表达式。

    示例: alertname=HostDown

  • targetMatchString必填

    新目标匹配器表达式。

    示例: alertname=DiskFull

  • equalLabelsString必填

    新等于标签。

    示例: host

响应状态

200 OK

该 API 成功时返回以下响应结构。

  • uuidString

    资源的UUID,唯一标识该资源。

    示例: inhib-001

  • nameString

    资源名称。

    示例: Suppress disk alerts when host down

  • descriptionString

    资源的详细描述。

    示例: Suppress disk alerts when host is unreachable

  • sourceMatchString

    源告警匹配器表达式。

    示例: alertname=HostDown

  • targetMatchString

    目标告警匹配器表达式抑制。

    示例: alertname=DiskFull

  • equalLabelsString

    等于标签。

    示例: host,cluster

  • enabledBoolean

    是否启用。

    示例: true

  • createDateString

    创建时间。

    示例: 2026-01-15T08:00:00Z

  • lastOpDateString

    最近一次操作时间。

    示例: 2026-01-15T08:00:00Z

请求地址

PUT/api/v1/alerting/inhibition-rules/{ruleId}

/api/v1/alerting/inhibition-rules/{ruleId}

操作 ID

UpdateAlertInhibitionRule

永久链接

请求示例

curl -X PUT '{host}/api/v1/alerting/inhibition-rules/{ruleId}' -H 'Authorization: Bearer {token}' -H 'Content-Type: application/json' -d '{"name":"Updated inhibition rule","description":"Updated description","sourceMatch":"alertname=HostDown","targetMatch":"alertname=DiskFull","equalLabels":"host","enabled":true}'

响应示例

200
{
  "uuid": "inhib-001",
  "name": "Suppress disk alerts when host down",
  "description": "Suppress disk alerts when host is unreachable",
  "sourceMatch": "alertname=HostDown",
  "targetMatch": "alertname=DiskFull",
  "equalLabels": "host,cluster",
  "enabled": true,
  "createDate": "example"
}

变更历史

此 API 暂无变更历史记录。

查看全部变更历史