Hi, I connected the template file to my alertmanager config, when I start alertmanager, I get the error: err="failed to parse templates: template: default.tmpl:10: function \"duration\" not defined", what needs to be fixed to add in the config, help me please
default.tmpl
{{ define "telegram.default" }}
{{ range .Alerts }}
{{ if eq .Status "firing"}}π₯ {{ .Labels.alertname }} π₯{{ else }}β {{ .Labels.alertname }} β {{ end }}
Labels:{{ range $key, $value := .Labels }}{{ if ne $key "alertname" }}
{{ $key }}: {{ $value }}{{ end }}{{ end }}
Annotations:{{ range $key, $value := .Annotations }}
{{ $key }}: {{ $value }}{{ end }}{{ if eq .Status "firing"}}
Duration: {{ since .StartsAt }}{{ else }}
Duration: {{ duration .StartsAt .EndsAt }}
Ended: {{ .EndsAt | since }}{{ end }}
{{ end }}
{{ end }}
Hi, I connected the template file to my alertmanager config, when I start alertmanager, I get the error: err="failed to parse templates: template: default.tmpl:10: function \"duration\" not defined", what needs to be fixed to add in the config, help me please
default.tmpl
alertmanager.yml
docker-compose.yml