Browse Source

Add the "Last Ping Type" field in the email notification template

pull/468/head
Pēteris Caune 4 years ago
parent
commit
ca3d1d3a3b
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
2 changed files with 38 additions and 11 deletions
  1. +1
    -1
      CHANGELOG.md
  2. +37
    -10
      templates/emails/alert-body-html.html

+ 1
- 1
CHANGELOG.md View File

@ -6,7 +6,7 @@ All notable changes to this project will be documented in this file.
## Improvements
- Add tighter parameter checks in hc.front.views.serve_doc
- Update OpsGenie instructions (#450)
- Update the email notification template to include more check and last ping details
## v1.18.0 - 2020-12-09


+ 37
- 10
templates/emails/alert-body-html.html View File

@ -47,28 +47,55 @@
<b>Schedule</b><br>
<code>{{ check.schedule }}</code>
</td>
{% if trttr %}Yo!{% endif %}
{{ trtr|safe }} {% cycle trtr %}
{% endif %}
{% if ping %}
<td style="padding-right: 32px; padding-bottom: 8px; vertical-align: top;">
<b>Total Pings</b><br>
{{ check.n_pings }}
{% if check.created %}(since {{ check.created|date:'M j, Y' }}){% endif %}
</td>
</tr>
{% if ping %}
<tr>
<td style="padding-right: 32px; padding-bottom: 8px; vertical-align: top;">
<b>Last Ping</b><br>
{{ ping.created|naturaltime }}{% if ping.remote_addr %}, from {{ ping.remote_addr }}{% endif %}
</td>
{% if trttr %}Yo!{% endif %}
{{ trtr|safe }} {% cycle trtr %}
{% endif %}
<td style="padding-right: 32px; padding-bottom: 8px; vertical-align: top;">
<b>Total Pings</b><br>
{{ check.n_pings }}
{% if check.created %}(since {{ check.created|date:'M j, Y' }}){% endif %}
<b>Last Ping Type</b><br>
{% if ping.exitstatus > 0 %}
<span style="background-color: #f2dede; color: #333333; padding-left: 4px; padding-right: 4px; border-radius: 2px;">
Exit status {{ ping.exitstatus }}
</span>
{% elif ping.exitstatus == 0 %}
<span style="background-color: #dff0d8; color: #333333; padding-left: 4px; padding-right: 4px; border-radius: 2px;">
Exit status 0
</span>
{% elif ping.kind == "fail" %}
<span style="background-color: #f2dede; color: #333333; padding-left: 4px; padding-right: 4px; border-radius: 2px;">
Failure
</span>
{% elif ping.kind == "start" %}
<span style="background-color: #dff0d8; color: #333333; padding-left: 4px; padding-right: 4px; border-radius: 2px;">
Started
</span>
{% elif ping.kind == "ign" %}
<span style="background-color: #eeeeee; color: #333333; padding-left: 4px; padding-right: 4px; border-radius: 2px;">
Ignored
</span>
{% else %}
<span style="background-color: #dff0d8; color: #333333; padding-left: 4px; padding-right: 4px; border-radius: 2px;">
Success
</span>
{% endif %}
</td>
</tr>
{% endif %}
</table>
{% if ping.body %}
{% if ping and ping.body %}
<p><b>Last Ping Body</b></p>
<pre>{{ ping.body|slice:":10000"|linebreaksbr }}{% if ping.body|length > 10000 %} [truncated]{% endif %}</pre>
{% endif %}


Loading…
Cancel
Save