All Projects → cnych → alertmanager-dingtalk-hook

cnych / alertmanager-dingtalk-hook

Licence: other
alertmanager dingtalk webhook simple server 🍋 🍊 🍒 🍰 🍇 🍉 🍓 🌽 🍑

Programming Languages

python
139335 projects - #7 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to alertmanager-dingtalk-hook

Prometheus Book
Prometheus操作指南
Stars: ✭ 2,637 (+3835.82%)
Mutual labels:  prometheus, alertmanager
docker-prometheus
A minimal Prometheus Server, Node Exporter, BlackBox Exporter and Grafana implementation with `docker-compose`.
Stars: ✭ 71 (+5.97%)
Mutual labels:  prometheus, alertmanager
dockerize-and-ansible
🐳 Build & Deploy the containerized Dev & Prod Env
Stars: ✭ 20 (-70.15%)
Mutual labels:  prometheus, alertmanager
Dockprom
Docker hosts and containers monitoring with Prometheus, Grafana, cAdvisor, NodeExporter and AlertManager
Stars: ✭ 4,489 (+6600%)
Mutual labels:  prometheus, alertmanager
Awesome Prometheus Alerts
🚨 Collection of Prometheus alerting rules
Stars: ✭ 3,323 (+4859.7%)
Mutual labels:  prometheus, alertmanager
mattermost-plugin-alertmanager
AlertManager Bot for Mattermost
Stars: ✭ 48 (-28.36%)
Mutual labels:  prometheus, alertmanager
loki exporter
Prometheus exporter to collect metrics and run queries against the Grafana Loki API.
Stars: ✭ 28 (-58.21%)
Mutual labels:  prometheus, alertmanager
emq exporter
Simple server that scrapes EMQ metrics and exporters them via HTTP for Prometheus consumption
Stars: ✭ 31 (-53.73%)
Mutual labels:  prometheus
docker-jmx-prometheus-exporter
Dockerized jmx-exporter for prometheus
Stars: ✭ 24 (-64.18%)
Mutual labels:  prometheus
metrics-server-exporter
Metrics Server Exporter
Stars: ✭ 58 (-13.43%)
Mutual labels:  prometheus
resoto
Resoto - Find leaky resources, manage quota limits, detect drift, and clean up!
Stars: ✭ 562 (+738.81%)
Mutual labels:  prometheus
druid-prometheus-exporter
Service to collect Apache Druid metrics and export them to Prometheus
Stars: ✭ 14 (-79.1%)
Mutual labels:  prometheus
sa-prometheus-exporters
Collection of the preselected prometheus exporters to be installed on a target nodes
Stars: ✭ 17 (-74.63%)
Mutual labels:  prometheus
chia-monitor
🍃 A comprehensive monitoring and alerting solution for the status of your Chia farmer and harvesters.
Stars: ✭ 131 (+95.52%)
Mutual labels:  prometheus
horizon-exporter
Export Laravel Horizon metrics using this Prometheus exporter.
Stars: ✭ 17 (-74.63%)
Mutual labels:  prometheus
gluster exporter
Gluster Exporter for Prometheus
Stars: ✭ 70 (+4.48%)
Mutual labels:  prometheus
prometheus-hetzner-sd
Prometheus Service Discovery for Hetzner
Stars: ✭ 15 (-77.61%)
Mutual labels:  prometheus
alertmanager-github-receiver
Prometheus Alertmanager webhook receiver that creates GitHub issues from alerts
Stars: ✭ 28 (-58.21%)
Mutual labels:  prometheus
gobgp exporter
Prometheus Exporter for GoBGP
Stars: ✭ 15 (-77.61%)
Mutual labels:  prometheus
firehose
Firehose is an extensible, no-code, and cloud-native service to load real-time streaming data from Kafka to data stores, data lakes, and analytical storage systems.
Stars: ✭ 213 (+217.91%)
Mutual labels:  prometheus

alertmanager-dingtalk-hook 🍋 🍊 🍒 🍰 🍇 🍉 🍓 🌽 🍑

AlertManager 钉钉报警简单服务示例

alertmanager dingtalk message demo

运行

使用Docker运行

$ docker run -p 5000:5000 --name -e ROBOT_TOKEN=<钉钉机器人TOKEN> -e ROBOT_SECRET=<钉钉机器人安全SECRET> -e LOG_LEVEL=debug -e PROME_URL=prometheus.local dingtalk-hook -d cnych/alertmanager-dingtalk-hook:v0.3.5

环境变量配置:

  • ROBOT_TOKEN:钉钉机器人 TOKEN
  • PROME_URL:手动指定跳转后的 Promethues 地址,默认会是 Pod 的地址
  • LOG_LEVEL:日志级别,设置成 debug 可以看到 AlertManager WebHook 发送的数据,方便调试使用,不需调试可以不设置该环境变量
  • ROBOT_SECRET:为钉钉机器人的安全设置密钥,机器人安全设置页面,加签一栏下面显示的 SEC 开头的字符串

dingtalk secret

Kubernetes集群中运行

第一步建议将钉钉机器人TOKEN创建成Secret资源对象:

$ kubectl create secret generic dingtalk-secret --from-literal=token=<钉钉群聊的机器人TOKEN> --from-literal=secret=<钉钉群聊机器人的SECRET> -n kube-ops
secret "dingtalk-secret" created

然后定义DeploymentService资源对象:(dingtalk-hook.yaml)

apiVersion: apps/v1
kind: Deployment
metadata:
  name: dingtalk-hook
  namespace: kube-ops
spec:
  selector:
    matchLabels:
      app: dingtalk-hook
  template:
    metadata:
      labels:
        app: dingtalk-hook
    spec:
      containers:
      - name: dingtalk-hook
        image: cnych/alertmanager-dingtalk-hook:v0.3.6
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 5000
          name: http
        env:
        - name: PROME_URL
          value: prometheus.local
        - name: LOG_LEVEL
          value: debug
        - name: ROBOT_TOKEN
          valueFrom:
            secretKeyRef:
              name: dingtalk-secret
              key: token
        - name: ROBOT_SECRET
          valueFrom:
            secretKeyRef:
              name: dingtalk-secret
              key: secret
        resources:
          requests:
            cpu: 50m
            memory: 100Mi
          limits:
            cpu: 50m
            memory: 100Mi

---
apiVersion: v1
kind: Service
metadata:
  name: dingtalk-hook
  namespace: kube-ops
spec:
  selector:
    app: dingtalk-hook
  ports:
  - name: hook
    port: 5000
    targetPort: http

直接创建上面的资源对象即可:

$ kubectl create -f dingtalk-hook.yaml
deployment.apps "dingtalk-hook" created
service "dingtalk-hook" created
$ kubectl get pods -n kube-ops
NAME                            READY     STATUS      RESTARTS   AGE
dingtalk-hook-c4fcd8cd6-6r2b6   1/1       Running     0          45m
......

最后在AlertManager中 webhook 地址直接通过 DNS 形式访问即可:

receivers:
- name: 'webhook'
  webhook_configs:
  - url: 'http://dingtalk-hook.kube-ops.svc.cluster.local:5000'
    send_resolved: true

参考文档

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].