prometheus-webhook-dingtalk icon indicating copy to clipboard operation
prometheus-webhook-dingtalk copied to clipboard

自定义模板告警报错, 请指教

Open fz8770 opened this issue 4 years ago • 1 comments

定义的模板

[root@medcloud-test-prome alertmanager]# cat dingding-alert.tmpl 
{{ define "__subject" }}[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] {{ .GroupLabels.SortedPairs.Values | join " " }} {{ if gt (len .CommonLabels) (len .GroupLabels) }}({{ with .CommonLabels.Remove .GroupLabels.Names }}{{ .Values | join " " }}{{ end }}){{ end }}{{ end }}
{{ define "__alertmanagerURL" }}{{ .ExternalURL }}/#/alerts?receiver={{ .Receiver }}{{ end }}

{{ define "default.__text_alert_list" }}{{ range . }}
**告警级别:** \[{{ .Labels.severity | upper }}\]

**告警目标:** {{ .Annotations.summary }}

**触发时间:** {{ .StartsAt.Format "2006-01-02 15:04:05" }}

**恢复时间:** {{ .EndsAt.Format "2006-01-02 15:04:05" }}

**告警详情:**
{{ .Annotations.description }}

日志报错 tail -n 30 /var/log/messages


May 20 18:30:43 medcloud-test-prome alertmanager: level=error ts=2020-05-20T10:30:43.688Z caller=notify.go:372 component=dispatcher msg="Error on notify" err="Post http://localhost:8060/dingtalk/ops_dingding/send: dial tcp [::1]:8060: connect: connection refused" context_err="context deadline exceeded"
May 20 18:30:43 medcloud-test-prome alertmanager: level=error ts=2020-05-20T10:30:43.689Z caller=dispatch.go:301 component=dispatcher msg="Notify for alerts failed" num_alerts=1 err="Post http://localhost:8060/dingtalk/ops_dingding/send: dial tcp [::1]:8060: connect: connection refused"
May 20 18:31:43 medcloud-test-prome alertmanager: level=error ts=2020-05-20T10:31:43.689Z caller=notify.go:372 component=dispatcher msg="Error on notify" err="Post http://localhost:8060/dingtalk/ops_dingding/send: dial tcp [::1]:8060: connect: connection refused" context_err="context deadline exceeded"
May 20 18:31:43 medcloud-test-prome alertmanager: level=error ts=2020-05-20T10:31:43.689Z caller=dispatch.go:301 component=dispatcher msg="Notify for alerts failed" num_alerts=1 err="Post http://localhost:8060/dingtalk/ops_dingding/send: dial tcp [::1]:8060: connect: connection refused"
May 20 18:32:43 medcloud-test-prome alertmanager: level=error ts=2020-05-20T10:32:43.689Z caller=notify.go:372 component=dispatcher msg="Error on notify" err="Post http://localhost:8060/dingtalk/ops_dingding/send: dial tcp [::1]:8060: connect: connection refused" context_err="context deadline exceeded"
May 20 18:32:43 medcloud-test-prome alertmanager: level=error ts=2020-05-20T10:32:43.689Z caller=dispatch.go:301 component=dispatcher msg="Notify for alerts failed" num_alerts=1 err="Post http://localhost:8060/dingtalk/ops_dingding/send: dial tcp [::1]:8060: connect: connection refused"
May 20 18:33:43 medcloud-test-prome alertmanager: level=error ts=2020-05-20T10:33:43.689Z caller=notify.go:372 component=dispatcher msg="Error on notify" err="Post http://localhost:8060/dingtalk/ops_dingding/send: dial tcp [::1]:8060: connect: connection refused" context_err="context deadline exceeded"
May 20 18:33:43 medcloud-test-prome alertmanager: level=error ts=2020-05-20T10:33:43.689Z caller=dispatch.go:301 component=dispatcher msg="Notify for alerts failed" num_alerts=1 err="Post http://localhost:8060/dingtalk/ops_dingding/send: dial tcp [::1]:8060: connect: connection refused"

fz8770 avatar May 20 '20 10:05 fz8770

你这是插件没运行,alertmanager没法把消息传给插件

michael-liumh avatar Nov 30 '20 03:11 michael-liumh