Created
October 30, 2016 06:25
-
-
Save powerman/56b1f5b29fce5d9f8b4c9380e620c7dd to your computer and use it in GitHub Desktop.
clean email template for alertmanager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta name="viewport" content="width=device-width" /> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<title>{{ template "__subject" . }}</title> | |
</head> | |
<body itemscope itemtype="http://schema.org/EmailMessage"> | |
<p> | |
{{ .Alerts | len }} alert{{ if gt (len .Alerts) 1 }}s{{ end }} for {{ range .GroupLabels.SortedPairs }} | |
{{ .Name }}={{ .Value }} | |
{{ end }} | |
<p>View in {{ template "__alertmanager" . }}: {{ template "__alertmanagerURL" . }} | |
{{ if gt (len .Alerts.Firing) 0 }} | |
<h1>[FIRING:{{ .Alerts.Firing | len }}]</h1> | |
{{ end }} | |
{{ range .Alerts.Firing }} | |
<a href="{{ .GeneratorURL }}">Source</a><br> | |
<dl> | |
<dt>Labels:</dt><dd> | |
{{ range .Labels.SortedPairs }} | |
{{ .Name }} = {{ .Value }}<br> | |
{{ end }} | |
{{ if gt (len .Annotations) 0 }} | |
</dd> | |
<dt>Annotations:</dt><dd> | |
{{ end }} | |
{{ range .Annotations.SortedPairs }} | |
{{ .Name }} = {{ .Value }}<br> | |
{{ end }} | |
</dd> | |
</dl> | |
{{ end }} | |
{{ if gt (len .Alerts.Resolved) 0 }} | |
{{ if gt (len .Alerts.Firing) 0 }} | |
<hr> | |
{{ end }} | |
<h1>[RESOLVED:{{ .Alerts.Resolved | len }}]</h1> | |
{{ end }} | |
{{ range .Alerts.Resolved }} | |
<a href="{{ .GeneratorURL }}">Source</a><br> | |
<dl> | |
<dt>Labels:</dt><dd> | |
{{ range .Labels.SortedPairs }} | |
{{ .Name }} = {{ .Value }}<br> | |
{{ end }} | |
{{ if gt (len .Annotations) 0 }} | |
</dd> | |
<dt>Annotations:</dt><dd> | |
{{ end }} | |
{{ range .Annotations.SortedPairs }} | |
{{ .Name }} = {{ .Value }}<br> | |
{{ end }} | |
</dd> | |
</dl> | |
{{ end }} | |
<p><a href="{{ .ExternalURL }}">Sent by {{ template "__alertmanager" . }}</a> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment