apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    run: prometheus-webhook-dingtalk
  name: prometheus-webhook-dingtalk
  namespace: ops
spec:
  selector:
    matchLabels:
      run: prometheus-webhook-dingtalk
  template:
    metadata:
      labels:
        run: prometheus-webhook-dingtalk
    spec:
      containers:
      - args:
        - --adapter=/app/prometheusalert/dingtalk.js=/adapter/dingtalk=https://oapi.dingtalk.com/robot/send?access_token={token}#{secret}
        - --adapter=/app/prometheusalert/wx.js=/adapter/wx=https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key={key}
        image: registry.cn-hangzhou.aliyuncs.com/guyongquan/webhook-adapter
        name: prometheus-webhook-dingtalk
        ports:
        - containerPort: 80
          protocol: TCP

---
apiVersion: v1
kind: Service
metadata:
  labels:
    run: prometheus-webhook-dingtalk
  name: prometheus-webhook-dingtalk
  namespace: ops
spec:
  ports:
  - port: 8060
    protocol: TCP
    targetPort: 80
  selector:
    run: prometheus-webhook-dingtalk
  type: ClusterIP
alertmanager中配置webhook receiver

    receivers:
    - name: allreceivers
      webhook_configs:
       - url: http://prometheus-webhook-dingtalk.ops.svc.cluster.local:8060/adapter/dingtalk
         send_resolved: false
       - url: http://prometheus-webhook-dingtalk.ops.svc.cluster.local:8060/adapter/wx
         send_resolved: false```
         
webhook adapter代码库 https://github.com/guyongquan/webhook-adapter
Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐