zengfanpei 2020-03-05
send_resolved: true
agent_id: ‘1000002‘
to_user: ‘@all‘
corp_id: ‘wwae01588e36d3f448‘
api_secret: ‘03vUA6wHSOtfCwfi8f7DkfXc0G4V6juaYOPDRjspnGU‘
PS:生成企业微信id和secret步骤详见前面zabbix配置微信报警
3、创建微信报警模板
vim wechat.tmpl
{{ define "wechat.default.message" }}
{{ range .Alerts }}
========start=========
告警程序: prometheus_alert
告警级别: {{ .Labels.serverity }}
告警类型: {{ .Labels.alertname }}
故障主机: {{ .Labels.instance }}
告警主题: {{ .Annotations.summary }}
告警详情: {{ .Annotations.description }}
触发时间: {{ (.StartsAt.Add 28800e9).Format "2006-01-02 15:04:05" }}
=========end===========
{{ end }}
{{ end }}
4、# 先将之前的 secret 对象删除,重新创建
$ kubectl delete secret alertmanager-main -n monitoring
secret "alertmanager-main" deleted
kubectl create secret generic alertmanager-main --from-file=alertmanager.yaml --from-file=wechat.tmpl -n monitoring
4.启动命令windows:chrome --remote-debugging-port=9222启动命令mac:Google\ Chrome --remote-debugging-port=9222