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

This commit is contained in:
Pēteris Caune 2020-12-28 17:34:58 +02:00
parent 26a7918b5b
commit ca3d1d3a3b
No known key found for this signature in database
GPG Key ID: E28D7679E9A9EDE2
2 changed files with 39 additions and 12 deletions

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

View File

@ -47,16 +47,6 @@
<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>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 %}
@ -66,9 +56,46 @@
{% 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>
<td style="padding-right: 32px; padding-bottom: 8px; vertical-align: top;">
<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 %}