From ca3d1d3a3b35745668748c74ea3dff3e17406925 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Mon, 28 Dec 2020 17:34:58 +0200 Subject: [PATCH] Add the "Last Ping Type" field in the email notification template --- CHANGELOG.md | 2 +- templates/emails/alert-body-html.html | 47 +++++++++++++++++++++------ 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f1eca84..65b6507f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/templates/emails/alert-body-html.html b/templates/emails/alert-body-html.html index 1dff5e12..c1b366e3 100644 --- a/templates/emails/alert-body-html.html +++ b/templates/emails/alert-body-html.html @@ -47,28 +47,55 @@ Schedule
{{ check.schedule }} - {% if trttr %}Yo!{% endif %} {{ trtr|safe }} {% cycle trtr %} {% endif %} - {% if ping %} + + Total Pings
+ {{ check.n_pings }} + {% if check.created %}(since {{ check.created|date:'M j, Y' }}){% endif %} + + + + {% if ping %} + Last Ping
{{ ping.created|naturaltime }}{% if ping.remote_addr %}, from {{ ping.remote_addr }}{% endif %} - {% if trttr %}Yo!{% endif %} - {{ trtr|safe }} {% cycle trtr %} - {% endif %} - - Total Pings
- {{ check.n_pings }} - {% if check.created %}(since {{ check.created|date:'M j, Y' }}){% endif %} + Last Ping Type
+ {% if ping.exitstatus > 0 %} + + Exit status {{ ping.exitstatus }} + + {% elif ping.exitstatus == 0 %} + + Exit status 0 + + {% elif ping.kind == "fail" %} + + Failure + + {% elif ping.kind == "start" %} + + Started + + {% elif ping.kind == "ign" %} + + Ignored + + {% else %} + + Success + + {% endif %} + {% endif %} -{% if ping.body %} +{% if ping and ping.body %}

Last Ping Body

{{ ping.body|slice:":10000"|linebreaksbr }}{% if ping.body|length > 10000 %} [truncated]{% endif %}
{% endif %}