全部產品
Search
文件中心

Application Real-Time Monitoring Service:通過Webhook上報警示的格式說明

更新時間:Jul 06, 2024

通過配置特定的Webhook的Body參數, ARMS在發送Webhook請求時會自動渲染Body,將警示內容通過開源AlertManager的格式進行發送。

使用限制

通過Webhook自訂警示通知時,Body參數存在以下使用限制。

  • 只能在Body中使用$alertmanager_content欄位。
  • Content-Type類型必須是application/json
  • 不能和$content欄位混用,使用$alertmanager_content$content不生效。
  • ARMS控制台測試Webhook功能無法對$alertmanager_content進行替換測試。

通過Webhook自訂警示通知的操作,請參見通過Webhook自訂警示通知對象

投遞的警示格式

向Webhook投遞開源AlertManager格式如下。更多資訊,請參見Prometheus官方文檔

{
  "alerts": [
    {
      "annotations": {
        "_aliyun_arms_alert_value": "15.521240234375",
        "_aliyun_arms_alert_message": "null\n訊息ID: ac10c42a16124966960554200d2450-7996494\n",
        "_aliyun_arms_alert_now_value": "15.521240234375",
        "message": "警示:命名空間: {{$labels.namespace}} / Pod: {{$labels.pod_name}} / 容器: {{$labels.container}} 記憶體使用量率超>過80%, 當前值{{ printf \"%.2f\" $value }}%",
        "value": "15.521240234375",
        "_aliyun_arms_alert_past_value": "15.521240234375"
      },
      "endsAt": "2021-02-22T07:27:15.404000000Z",
      "fingerprint": "bec72890cc2c7b4a027e008df0cd1013",
      "labels": {
        "container": "kube-state-metrics",
        "severity": "warning",
        "_aliyun_arms_alert_level": "ERROR",
        "instance": "10.0.80.186:10255",
        "clustername": "klyz1688-kubernetes-1",
        "_aliyun_arms_alert_type": "101",
        "_aliyun_arms_integration_name": "測試整合-prometheus",
        "alertname": "容器記憶體使用量率大於80%",
        "_aliyun_arms_userid": "1131971649496228",
        "_aliyun_arms_involvedObject_name": "klyz1688-kubernetes-1",
        "pod_name": "kube-state-metrics-ccb59dbff-jljg4",
        "_aliyun_arms_involvedObject_id": "cb36dcafb9b9340498fad2e1f40b9a254",
        "_aliyun_arms_region_id": "cn-hangzhou",
        "_aliyun_arms_involvedObject_kind": "cluster",
        "_aliyun_arms_product_type": "PROMETHEUS",
        "name": "k8s_kube-state-metrics_kube-state-metrics-ccb59dbff-jljg4_arms-prom_359508f3-7e76-4740-b915-41ea48849641_0",
        "namespace": "arms-prom",
        "_aliyun_arms_integration_id": "80",
        "_aliyun_arms_involvedObject_type": "ManagedKubernetes",
        "_aliyun_arms_alert_rule_id": "3927051"
      },
      "startsAt": "2021-02-22T07:18:15.578000000Z",
      "status": "firing"
    }
  ],
  "commonAnnotations": {
    "_aliyun_arms_alert_value": "15.521240234375",
    "_aliyun_arms_alert_message": "null\n訊息ID: ac10c42a16124966960554200d2450-7996494\n",
    "_aliyun_arms_alert_now_value": "15.521240234375",
    "message": "警示:命名空間: {{$labels.namespace}} / Pod: {{$labels.pod_name}} / 容器: {{$labels.container}} 記憶體使用量率超過80%, 當前值{{ printf \"%.2f\" $value }}%",
    "value": "15.521240234375",
    "_aliyun_arms_alert_past_value": "15.521240234375"
  },
  "commonLabels": {
    "container": "kube-state-metrics",
    "severity": "warning",
    "_aliyun_arms_alert_level": "ERROR",
    "instance": "10.0.80.186:10255",
    "clustername": "klyz1688-kubernetes-1",
    "_aliyun_arms_alert_type": "101",
    "_aliyun_arms_integration_name": "測試整合-prometheus",
    "alertname": "容器記憶體使用量率大於80%",
    "_aliyun_arms_userid": "1131971649496228",
    "_aliyun_arms_involvedObject_name": "klyz1688-kubernetes-1",
    "pod_name": "kube-state-metrics-ccb59dbff-jljg4",
    "_aliyun_arms_involvedObject_id": "cb36dcafb9b9340498fad2e1f40b9a254",
    "_aliyun_arms_region_id": "cn-hangzhou",
    "_aliyun_arms_involvedObject_kind": "cluster",
    "_aliyun_arms_product_type": "PROMETHEUS",
    "name": "k8s_kube-state-metrics_kube-state-metrics-ccb59dbff-jljg4_arms-prom_359508f3-7e76-4740-b915-41ea48849641_0",
    "namespace": "arms-prom",
    "_aliyun_arms_integration_id": "80",
    "_aliyun_arms_involvedObject_type": "ManagedKubernetes",
    "_aliyun_arms_alert_rule_id": "3927051"
  },
  "externalURL": "https://alerts.console.aliyun.com/#/alarm/alert/detail/2848",
  "groupLabels": {
    "alertname": "容器記憶體使用量率大於80%"
  },
  "receiver": "testjiubian",
  "status": "firing"
}