Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webhook发送的body中未包含value信息 #212

Open
lefreet opened this issue Jun 19, 2023 · 2 comments
Open

webhook发送的body中未包含value信息 #212

lefreet opened this issue Jun 19, 2023 · 2 comments
Assignees

Comments

@lefreet
Copy link

lefreet commented Jun 19, 2023

问题

  • 采用自定义服务转发webhook的消息格式,发送过来的请求中无相关实时值.Value,希望能够带上,用于告知管理员当前实时数据
{
  "receiver": "prometheus",
  "status": "firing",
  "alerts": [
    {
      "status": "firing",
      "labels": {
        "alerttype": "metric",
        "namespace": "pro",
        "owner_kind": "Deployment",
        "rule_id": "pro-e5df62249c7c718b",
        "severity": "error",
        "workload": "Deployment:pro1-web-v1",
        "cluster": "default",
        "alertname": "ram"
      },
      "annotations": {
        "rules": "[{\"_metricType\":\"namespace:workload_memory_usage:sum{$1}\",\"condition_type\":\">\",\"thresholds\":\"1\",\"unit\":\"Mi\"}]",
        "summary": "Deployment pro1-web-v1 内存用量 > 1Mi",
        "aliasName": "内存占用过高",
        "kind": "Deployment",
        "message": "请及时处理\n\n# @users wsn\n# @webhook xxxxx",
        "resources": "[\"pro1-web-v1\"]",
        "rule_update_time": "2023-06-19T06:49:26Z"
      },
      "startsAt": "2023-06-19T06:51:16.65157632Z",
      "endsAt": "0001-01-01T00:00:00Z",
      "generatorURL": "/graph?g0.expr=namespace%3Aworkload_memory_usage%3Asum%7Bnamespace%3D%22pro%22%2Cworkload%3D%22Deployment%3Apro1-web-v1%22%7D+%3E+1.048576e%2B06&g0.tab=1",
      "fingerprint": "cfd8b7774964e037"
    }
  ],
  "groupLabels": {
    "alertname": "ram",
    "namespace": "pro",
    "rule_id": "pro-e5df62249c7c718b"

  },

  "commonLabels": {
    "owner_kind": "Deployment",
    "rule_id": "pro-e5df62249c7c718b",
    "severity": "error",
    "workload": "Deployment:pro1-web-v1",
    "alertname": "ram",
    "alerttype": "metric",
    "namespace": "pro"
  },
  "commonAnnotations": {
    "summary": "Deployment pro1-web-v1 内存用量 > 1Mi",
    "aliasName": "内存占用过高",
    "kind": "Deployment",
    "message": "请及时处理\n\n# @users wsn\n# @webhook xxxxxx",
    "resources": "[\"pro1-web-v1\"]",
    "rule_update_time": "2023-06-19T06:49:26Z",
    "rules": "[{\"_metricType\":\"namespace:workload_memory_usage:sum{$1}\",\"condition_type\":\">\",\"thresholds\":\"1\",\"unit\":\"Mi\"}]"
  },
  "externalURL": "http://alertmanager-main-0:9093"
}
@benjaminhuo
Copy link
Member

@junotx prometheus alert rule 计算的只是一个阈值是否超限,结果类似是否告警这种二元信息,可能带上 value 的信息吗?

@lefreet
Copy link
Author

lefreet commented Jun 19, 2023

@benjaminhuo 看了模板的文档, webhook 是用template 特殊序列化的(没找到具体实现),template本身有支持.Value,应该可以; 本身用grafana的另一套监控系统是支持这个机制的,应该是常规操作

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants