Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fz8770 opened this issue May 20, 2020 · 1 comment
Open

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

fz8770 opened this issue May 20, 2020 · 1 comment

Comments

@fz8770
Copy link

fz8770 commented May 20, 2020

定义的模板

[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"
@michael-liumh
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants