SkyWalking 支持的告警通知方式(Alarm Hooks)类型

告警通知类型说明

  • webhook: 通用的 Webhook 通知方式,可以将告警发送到自定义的 HTTP 接口
  • gRPC: 通过 gRPC 协议发送告警通知
  • wechat: 发送到企业微信(WeChat Work)应用
  • slack: 发送到 Slack 协议的聊天 workspace
  • dingtalk: 发送到钉钉(DingTalk)应用
  • feishu: 发送到飞书(Feishu/Lark)应用
  • welink: 发送到华为 Welink 应用
  • discord: 发送到 Discord 聊天平台
  • pagerduty: 发送到 PagerDuty 运维平台

告警模版:

XML 复制代码
rules:
  # Rule unique name, must be ended with `_rule`.
  endpoint_percent_rule:
    expression: sum(endpoint_percent < 75) >= 3
    period: 10
    # How many times of checks, the alarm keeps silence after alarm triggered, default as same as period.
    silence-period: 10
    message: Successful rate of endpoint {name} is lower than 75%

  service_percent_rule:
    expression: sum(service_percent < 85) >= 4
    # [Optional] Default, match all services in this metrics
    include-names:
      - service_a
      - service_b
    exclude-names:
      - service_c
    period: 10

  endpoint_percent_more_rule:
    expression: sum(endpoint_percent > 60) >= 3
    # The length of time to evaluate the metrics
    period: 10
    # How many times of checks, the alarm keeps silence after alarm triggered, default as same as period.
    silence-period: 10
    message: Successful rate of endpoint {name} is higher than 60%
    hooks:
      - "slack.custom1"
      - "pagerduty.custom1"

  comp1_rule:
    expression: sum((endpoint_percent > 60) * (endpoint_percent < 75)) >= 3
    period: 10
    silence-period: 10
    message: xxxxx

  comp2_rule:
    expression: sum((endpoint_percent > 60) * (endpoint_percent < 75)) >= 3
    period: 10
    silence-period: 10
    message: xxxxx
    hooks:
      - "slack.default"
      - "slack.custom1"
      - "pagerduty.custom1"

hooks:
  webhook:
    default:
      is-default: true
      urls:
        - http://127.0.0.1/notify/
        - http://127.0.0.1/go-wechat/
    custom1:
      urls:
        - http://127.0.0.1/custom1
      headers:
        Authorization: Bearer bearer_token
        x-company-header: arbitrary-additional-http-headers

  gRPC:
    default:
      is-default: true
      target-host: 127.0.0.1
      target-port: 9888

  slack:
    default:
      is-default: true
      text-template: |-
        {
          "type": "section",
          "text": {
            "type": "mrkdwn",
            "text": ":alarm_clock: *Apache Skywalking Alarm* \n **%s**."
          }
        }
      webhooks:
        - https://hooks.slack.com/services/x/y/zssss
    custom1:
      text-template: |-
        {
          "type": "section",
          "text": {
            "type": "mrkdwn",
            "text": ":alarm_clock: *Apache Skywalking Alarm* \n **%s**."
          }
        }
      webhooks:
        - https://hooks.slack.com/services/x/y/zssss

  wechat:
    default:
      is-default: true
      text-template: |-
        {
          "msgtype": "text",
          "text": {
            "content": "Apache SkyWalking Alarm: \n %s."
          }
        }
      webhooks:
        - https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=dummy_key

  dingtalk:
    default:
      is-default: true
      text-template: |-
        {
          "msgtype": "text",
          "text": {
            "content": "Apache SkyWalking Alarm: \n %s."
          }
        }
      webhooks:
        - url: https://oapi.dingtalk.com/robot/send?access_token=dummy_token
          secret: dummysecret
        - url: https://oapi.dingtalk.com/robot/send?access_token=dummy_token2
          secret:

  feishu:
    default:
      is-default: true
      text-template: |-
        {
        "msg_type": "text",
        # at someone with feishu_user_ids
        # "ats": "feishu_user_id_1,feishu_user_id_2",
        "content": {
          "text": "Apache SkyWalking Alarm: \n %s."
          }
        }
      webhooks:
        - url: https://open.feishu.cn/open-apis/bot/v2/hook/dummy_token
          secret: dummysecret
        - url: https://open.feishu.cn/open-apis/bot/v2/hook/dummy_token2
          secret:

  welink:
    default:
      is-default: true
      text-template: "Apache SkyWalking Alarm: \n %s."
      webhooks:
        # you may find your own client_id and client_secret in your app, below are dummy, need to change.
        - client-id: "dummy_client_id"
          client-secret: dummy_secret_key
          access-token-url: https://open.welink.huaweicloud.com/api/auth/v2/tickets
          message-url: https://open.welink.huaweicloud.com/api/welinkim/v1/im-service/chat/group-chat
          # if you send to multi group at a time, separate group_ids with commas, e.g. "123xx","456xx"
          group-ids: "dummy_group_id"
          # make a name you like for the robot, it will display in group
          robot-name: robot

  pagerduty:
    default:
      is-default: true
      text-template: "dummy_text_template"
      integration-keys:
        - dummy_key
        - dummy_key2
    custom1:
      text-template: "Apache SkyWalking Alarm: \n %s."
      integration-keys:
        #    # you can find your integration key(s) on the Events API V2 integration page for your PagerDuty service(s).
        #    # (you may need to create an Events API V2 integration for your PagerDuty service if you don't have one yet)
        #    # below are dummy keys that should be replaced with your own integration keys.
        - dummy_key
        - dummy_key2

注意:缩进只能用空格,不能用 tab(\t)

相关推荐
随风,奔跑3 天前
Spring Cloud Alibaba(六)-链路追踪SkyWalking
java·后端·spring·skywalking
tsyjjOvO3 天前
分布式事务 Seata 与链路追踪 SkyWalking 全解析
分布式·skywalking
小旭95274 天前
分布式事务 Seata 详解 + 链路追踪 SkyWalking 实战
java·分布式·后端·信息可视化·skywalking
dEso RSET11 天前
Skywalking介绍,Skywalking 9.4 安装,SpringBoot集成Skywalking
spring boot·后端·skywalking
身如柳絮随风扬15 天前
链路追踪SkyWalking 架构了解
架构·skywalking
洒满阳光的午后19 天前
我做了一个“能理解业务语义”的可观测性 MCP Server:统一接入 Prometheus、OpenObserve 和 SkyWalking
人工智能·ai·prometheus·skywalking·openobserve·mcp
梵得儿SHI19 天前
SpringCloud 实战落地:可观测性建设(SkyWalking + Prometheus + Grafana)从 0 到 1 生产级部署
grafana·prometheus·springcloud·skywalking·微服务可观测性·线上问题排查
Jinkxs21 天前
SkyWalking - Spring Cloud Alibaba 全链路追踪实战
skywalking
烛之武22 天前
Skywalking服务链路追踪与Jemeter压力测试
压力测试·skywalking
鬼先生_sir22 天前
Spring Cloud 微服务监控实战:SkyWalking + Prometheus+Grafana 全栈解决方案
运维·spring cloud·grafana·prometheus·skywalking