Prometheus+Altermanager釘釘報警
1、添加釘釘機器人
參考釘釘官方文檔:https://ding-doc.dingtalk.com/doc#/serverapi2/qf2nxqhtml
2、在k8s上部署釘釘告警deployment,這裏咱們引用第三方的插件。
[root@cn-hongkong webhook-dingtalk]# cat webhook-dingtalk.yaml apiVersion: apps/v1beta2 kind: Deployment metadata: labels: app: webhook-dingtalk name: webhook-dingtalk namespace: monitoring #須要和alertmanager在同一個namespace spec: replicas: 1 selector: matchLabels: app: webhook-dingtalk template: metadata: labels: app: webhook-dingtalk spec: containers: - image: billy98/webhook-dingtalk:latest name: webhook-dingtalk args: - "https://oapi.dingtalk.com/robot/send?access_token=1fd59067ab85bea575122a5e4f05cefd6609d9d3e41a725e46a90c2fad9b3" #上面建立的釘釘機器人hook ports: - containerPort: 8080 protocol: TCP resources: requests: cpu: 100m memory: 100Mi limits: cpu: 500m memory: 500Mi livenessProbe: failureThreshold: 3 initialDelaySeconds: 30 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 1 tcpSocket: port: 8080 readinessProbe: failureThreshold: 3 initialDelaySeconds: 30 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 1 httpGet: port: 8080 path: / imagePullSecrets: - name: IfNotPresent --- apiVersion: v1 kind: Service metadata: labels: app: webhook-dingtalk name: webhook-dingtalk namespace: monitoring #須要和alertmanager在同一個namespace spec: ports: - name: http port: 80 protocol: TCP targetPort: 8080 selector: app: webhook-dingtalk type: ClusterIP
3、alertmanager添加釘釘告警類型
config: global: resolve_timeout: 5m route: group_by: ['job','severity'] group_wait: 30s group_interval: 5m repeat_interval: 12h receiver: default receiver: webhook routes: - match: filesystem: node receiver: webhook receivers: - name: webhook webhook_configs: - url: http://webhook-dingtalk/dingtalk/send/ send_resolved: true
4、查看告警信息
原文出處:https://www.cnblogs.com/Dev0ps/p/11916963.htmlnode