alertmanager/template/default.tmpl

219 lines
5.5 KiB
Cheetah

{{ define "slack.default.fallback" }}
fallback
{{ end }}
{{ define "slack.default.pretext" }}
pre text
{{ end }}
{{ define "slack.default.title" }}
Title
{{ end }}
{{ define "slack.default.titlelink" }}
http://localhost:9090
{{ end }}
{{ define "slack.default.text" }}
my text
my text
my text
{{ end }}
{{ define "pagerduty.default.description" }}{{ .GroupLabels }} [{{ len .Alerts }} instance{{ if gt (len .Alerts) 1 }}s{{ end }}]{{ end }}
{{ define "email.default.header" }}From: "Prometheus Alertmanager" <{{ .From }}>
To: {{ .To }}
Date: {{ .Date }}
Subject: [{{ .Alerts.Status }}] {{ .GroupLabels }}
Content-Type: text/html; charset=UTF-8
{{ end }}
{{ define "email.default.html" }}
{{/*
The following is the readable HTML code for the mail template. It has to be inlined, e.g. by
http://templates.mailchimp.com/resources/inline-css/.
The inlined output is inserted after this comment.
----
<style>
table {
border-spacing: 0;
border-collapse: collapse;
}
table.outer {
margin: 0 auto;
width: 100%;
max-width: 700px;
background: #fff;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
color: #202020 !important;
}
td {
padding: 0;
text-align: left;
vertical-align: top;
}
.inner {
padding: 10px;
}
h1 {
font-size: 1.15em;
font-weight: bold;
margin-bottom: 18px;
}
li .labelname, li .labelvalue {
color: inherit;
white-space: pre-wrap;
display: inline-block;
}
li .labelname {
padding-right: 15px;
font-weight: bold;
font-family: monospace;
}
li .labelvalue {
font-size: 0.9em;
}
ul {
list-style: none;
margin: 0;
padding: 0;
}
.column {
width: 100%;
height: 100%;
display: inline-block;
vertical-align: top;
}
.alert {
border: 1px dotted #959595;
}
.labels.column {
max-width: 295px;
color: #fff !important;
background: #4f4f4f;
}
.annotations.column {
max-width: 395px;
}
</style>
<table class="outer" align="center">
<tr>
<td>
<table width="100%">
<tr>
<td class="inner">
<h1>{{ len .Alerts }} alert{{ if gt (len .Alerts) 1 }}s{{ end }} for {{ .GroupLabels }}</h1>
</td>
</tr>
</table>
</td>
{{ range .Alerts }}
<tr>
<td class="alert">
<div class="labels column">
<table width="100%">
<tr>
<td class="inner">
<ul>
{{ range $label, $value := .Labels }}
<li>
<span class="labelname">{{ $label }}</span>
<span class="labelvalue">{{ $value }}</span>
</li>
{{ end }}
</ul>
</td>
</tr>
</table>
</div>
<div class="annotations column">
<table width="100%">
<tr>
<td class="inner">
<ul>
{{ range $label, $value := .Annotations }}
<li>
<span class="labelname">{{ $label }}</span>
<span class="labelvalue">{{ $value }}</span>
</li>
{{ end }}
</ul>
</td>
</tr>
</table>
</div>
</td>
</tr>
{{ end }}
</table>
---
Template end, the following is the inlined version of the above.
*/}}
<table class="outer" align="center" style="border-spacing: 0;border-collapse: collapse;margin: 0 auto;width: 100%;max-width: 700px;background: #fff;font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;color: #202020;">
<tr>
<td style="padding: 0;text-align: left;vertical-align: top;">
<table width="100%" style="border-spacing: 0;border-collapse: collapse;">
<tr>
<td class="inner" style="padding: 10px;text-align: left;vertical-align: top;">
<h1 style="font-size: 1.15em;font-weight: bold;margin-bottom: 18px;">{{ len .Alerts }} alert{{ if gt (len .Alerts) 1 }}s{{ end }} for {{ .GroupLabels }}</h1>
</td>
</tr>
</table>
</td>
{{ range .Alerts }}
</tr><tr>
<td class="alert" style="padding: 0;text-align: left;vertical-align: top;border: 1px dotted #959595;">
<div class="labels column" style="width: 100%;height: 100%;display: inline-block;vertical-align: top;max-width: 295px;color: #fff;background: #4f4f4f;">
<table width="100%" style="border-spacing: 0;border-collapse: collapse;">
<tr>
<td class="inner" style="padding: 10px;text-align: left;vertical-align: top;">
<ul style="list-style: none;margin: 0;padding: 0;">
{{ range $label, $value := .Labels }}
<li>
<span class="labelname" style="color: inherit;white-space: pre-wrap;display: inline-block;padding-right: 15px;font-weight: bold;font-family: monospace;">{{ $label }}</span>
<span class="labelvalue" style="color: inherit;white-space: pre-wrap;display: inline-block;font-size: 0.9em;">{{ $value }}</span>
</li>
{{ end }}
</ul>
</td>
</tr>
</table>
</div>
<div class="annotations column" style="width: 100%;height: 100%;display: inline-block;vertical-align: top;max-width: 395px;">
<table width="100%" style="border-spacing: 0;border-collapse: collapse;">
<tr>
<td class="inner" style="padding: 10px;text-align: left;vertical-align: top;">
<ul style="list-style: none;margin: 0;padding: 0;">
{{ range $label, $value := .Annotations }}
<li>
<span class="labelname" style="color: inherit;white-space: pre-wrap;display: inline-block;padding-right: 15px;font-weight: bold;font-family: monospace;">{{ $label }}</span>
<span class="labelvalue" style="color: inherit;white-space: pre-wrap;display: inline-block;font-size: 0.9em;">{{ $value }}</span>
</li>
{{ end }}
</ul>
</td>
</tr>
</table>
</div>
</td>
</tr>
{{ end }}
</table>
{{ end }}