Thanks for your reply
It seems to work! :D
But now how to set time between firing and resolved? I have something like
this:
global:
resolve_timeout: 4m
route:
receiver: alert-emailer-cpu-30m
group_by: ['alertname', 'priority', 'instance']
group_wait: 10s
group_interval: 10s
repeat_interval: 30m
But i get mail with resolved after few seconds. How to change it?
And my second question - how to tell alertmanager that i want only to see
status with "resolved" not with "firing".
html: '{{ template "email" .}}'
headers:
subject: "[CUK][{{ .Status | toUpper }}{{ if eq .Status 'resolved'
}}]{{ .CommonLabels.severity }} {{ .CommonLabels.instance }} {{
.CommonLabels.alertname }} | {{ .CommonAnnotations.description }}"
I tried something like this but it's not working. I just want to see that
word "RESOLVED" if alert is resolved. If still firing i don't want to see
"FIRING".
Thanks for your help!
śr., 19 maj 2021 o 01:17 Julien Pivotto <[email protected]>
napisał(a):
> On 14 May 13:57, Sebastian Glock wrote:
> > Hi,
> >
> > I have send resolved set to true and I found an interesting option to
> show
> > the alert time in the alert:
> >
> > duration: {{(.EndsAt.Sub .StartsAt).Truncate 1000000000}}
>
> {{if eq $alert.Status "resolved"}}{{(.EndsAt.Sub .StartsAt).Truncate
> 1000000000}}{{end}}
>
> >
> > But when alerts fires i have something like this:
> >
> > -2562047h47m16s
> >
> > When resolved alert comes it looks gr8:
> >
> > 2m15s
> > How can i separate those two emails? Or maybe u have better query to show
> > duration between StartsAt and EndsAt?
> >
> > Is there way to separate templates?
> > My actual config:
> >
> > - name: alert-emailer-cpu-1h
> > email_configs:
> > - to: '[email protected]'
> > send_resolved: true
> > from:***
> > smarthost: ***
> > auth_username: ***
> > auth_password: ***
> > auth_secret:***
> > auth_identity:***
> > html: '{{ template "email" .}}'
> > headers:
> > subject: "[{{ .Status | toUpper }}][CUK] {{ .CommonLabels.severity
> }}
> > {{ .CommonLabels.instance }} {{ .CommonLabels.alertname }} | {{
> > .CommonAnnotations.description }}"
> >
> >
> > and template:
> > {{ define "email" }}
> > <html>
> > <head>
> > <style type="text/css">
> > table {
> > font-family: verdana,arial,sans-serif;
> > font-size:14px;
> > color:#333333;
> > border-width: 1px;
> > border-color: #999999;
> > border-collapse: collapse;
> > }
> > table th {
> > background-color:#ff6961;
> > border-width: 1px;
> > padding: 8px;
> > border-style: solid;
> > border-color: #F54C44;
> > }
> > table td {
> > border-width: 1px;
> > padding: 8px;
> > border-style: solid;
> > border-color: #F54C44;
> > text-align: center;
> > }
> > </style>
> > </head>
> > <body>
> > <table border=1>
> > <thead>
> > <tr>
> > <th>Alert name</th>
> > <th>Instance</th>
> > <th>Summary</th>
> > <th>Description</th>
> > </tr>
> > </thead>
> >
> > <tbody>
> > {{ range .Alerts }}
> > <tr>
> > <td><b>{{ .Labels.alertname }}</td></b>
> > <td>{{ .Labels.instance }}</td>
> > <td>{{ .Annotations.summary }}</td>
> > <td>{{ .Annotations.description }}</td>
> > <td>{{ .StartsAt.Format "2006-01-02 15:04:05" }}</td>
> > <td>{{(.EndsAt.Sub .StartsAt).Truncate 1000000000}}</td>
> >
> > </tr>
> > </tbody>
> > {{end}}
> > </table>
> > </body>
> > </html>
> >
> > {{end}}
> >
> >
> > Maybe there's way to see only duration between firing and resolved ? If i
> > can separate alerts (maybe with template) resolved and firing it would be
> > also gr8. But I don't know how :(
> >
> > I'm not best in it so please be kind :D
> >
> > Thanks for all replies!
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Prometheus Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/prometheus-users/CAFn4LSqxfWGMvR8d4obDgOgZ3EFQ5L5nDwWvaYhx6tpqys_xYg%40mail.gmail.com
> .
>
>
>
> --
> Julien Pivotto
> @roidelapluie
>
--
You received this message because you are subscribed to the Google Groups
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/prometheus-users/CAFn4LSqJR2YA4HL8JMXaTs7oR_5XkzKuORwURpJ9%3DmsPqrHUKw%40mail.gmail.com.