mirror of
https://github.com/healthchecks/healthchecks.git
synced 2025-04-07 06:05:34 +00:00
Split report and reminder (nag) templates
This commit is contained in:
parent
fbc6ac58ba
commit
d57ea3309a
11 changed files with 60 additions and 43 deletions
|
@ -239,10 +239,10 @@ class Profile(models.Model):
|
||||||
for check in checks:
|
for check in checks:
|
||||||
check.past_downtimes = check.downtimes_by_boundary(boundaries)[:-1]
|
check.past_downtimes = check.downtimes_by_boundary(boundaries)[:-1]
|
||||||
|
|
||||||
ctx["nag"] = False
|
|
||||||
ctx["checks"] = checks
|
ctx["checks"] = checks
|
||||||
ctx["boundaries"] = boundaries[:-1]
|
ctx["boundaries"] = boundaries[:-1]
|
||||||
ctx["monthly_or_weekly"] = self.reports
|
ctx["monthly_or_weekly"] = self.reports
|
||||||
|
emails.report(self.user.email, ctx, headers)
|
||||||
|
|
||||||
if nag:
|
if nag:
|
||||||
# For nags, only show checks that are currently down
|
# For nags, only show checks that are currently down
|
||||||
|
@ -251,10 +251,9 @@ class Profile(models.Model):
|
||||||
return False
|
return False
|
||||||
ctx["checks"] = checks
|
ctx["checks"] = checks
|
||||||
ctx["num_down"] = len(checks)
|
ctx["num_down"] = len(checks)
|
||||||
ctx["nag"] = True
|
|
||||||
ctx["nag_period"] = self.nag_period.total_seconds()
|
ctx["nag_period"] = self.nag_period.total_seconds()
|
||||||
|
emails.nag(self.user.email, ctx, headers)
|
||||||
|
|
||||||
emails.report(self.user.email, ctx, headers)
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def sms_sent_this_month(self):
|
def sms_sent_this_month(self):
|
||||||
|
|
|
@ -21,7 +21,6 @@ MOCK_NOW = Mock(return_value=CURRENT_TIME)
|
||||||
NAG_TEXT = """Hello,
|
NAG_TEXT = """Hello,
|
||||||
|
|
||||||
This is a hourly reminder sent by Mychecks.
|
This is a hourly reminder sent by Mychecks.
|
||||||
|
|
||||||
One check is currently DOWN:
|
One check is currently DOWN:
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,11 @@ def report(to, ctx, headers={}):
|
||||||
send(m, block=True)
|
send(m, block=True)
|
||||||
|
|
||||||
|
|
||||||
|
def nag(to, ctx, headers={}):
|
||||||
|
m = make_message("nag", to, ctx, headers=headers)
|
||||||
|
send(m, block=True)
|
||||||
|
|
||||||
|
|
||||||
def deletion_notice(to, ctx, headers={}):
|
def deletion_notice(to, ctx, headers={}):
|
||||||
m = make_message("deletion-notice", to, ctx, headers=headers)
|
m = make_message("deletion-notice", to, ctx, headers=headers)
|
||||||
send(m, block=True)
|
send(m, block=True)
|
||||||
|
|
34
templates/emails/nag-body-html.html
Normal file
34
templates/emails/nag-body-html.html
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
{% extends "emails/base.html" %}
|
||||||
|
{% load humanize hc_extras %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
Hello,<br />
|
||||||
|
|
||||||
|
This is a
|
||||||
|
{% if nag_period == 3600 %}hourly{% endif %}
|
||||||
|
{% if nag_period == 86400 %}daily{% endif %}
|
||||||
|
reminder sent by <a href="{% site_root %}">{% site_name %}</a>.<br />
|
||||||
|
|
||||||
|
{% if num_down == 1%}
|
||||||
|
One check is currently <strong>DOWN</strong>:<br />
|
||||||
|
{% else %}
|
||||||
|
{{ num_down }} checks are currently <strong>DOWN</strong>:<br />
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% include "emails/nag-summary-html.html" %}
|
||||||
|
|
||||||
|
<strong>Too many notifications?</strong>
|
||||||
|
Visit the <a href="{{ notifications_url }}">Email Reports</a>
|
||||||
|
page on {% site_name %} to set your notification preferences.
|
||||||
|
<br /><br />
|
||||||
|
|
||||||
|
Cheers,<br>
|
||||||
|
The {% site_name %} Team
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block unsub %}
|
||||||
|
<br>
|
||||||
|
<a href="{{ unsub_link }}" target="_blank" style="color: #666666; text-decoration: underline;">
|
||||||
|
Unsubscribe
|
||||||
|
</a>
|
||||||
|
{% endblock %}
|
10
templates/emails/nag-body-text.html
Normal file
10
templates/emails/nag-body-text.html
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{% load hc_extras %}Hello,
|
||||||
|
|
||||||
|
This is a {% if nag_period == 3600 %}hourly {% endif %}{% if nag_period == 86400 %}daily {% endif %}reminder sent by {% site_name %}.
|
||||||
|
{% if num_down == 1%}One check is currently DOWN:{% else %}{{ num_down }} checks are currently DOWN:{% endif %}
|
||||||
|
{% include 'emails/summary-text.html' %}
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
Cheers,
|
||||||
|
{% site_name %}
|
1
templates/emails/nag-subject.html
Normal file
1
templates/emails/nag-subject.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Reminder: {{ num_down }} check{{ num_down|pluralize }} still down
|
|
@ -4,38 +4,14 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
Hello,<br />
|
Hello,<br />
|
||||||
|
|
||||||
{% if nag %}
|
This is a {{ monthly_or_weekly }} report sent by
|
||||||
This is a
|
<a href="{% site_root %}">{% site_name %}</a>.<br />
|
||||||
{% if nag_period == 3600 %}hourly{% endif %}
|
|
||||||
{% if nag_period == 86400 %}daily{% endif %}
|
|
||||||
reminder sent by <a href="{% site_root %}">{% site_name %}</a>.<br />
|
|
||||||
|
|
||||||
{% if num_down == 1%}
|
{% include "emails/report-summary-html.html" %}
|
||||||
One check is currently <strong>DOWN</strong>:
|
|
||||||
{% else %}
|
|
||||||
{{ num_down }} checks are currently <strong>DOWN</strong>:
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<br />
|
|
||||||
{% include "emails/summary-html.html" %}
|
|
||||||
|
|
||||||
<strong>Too many notifications?</strong>
|
|
||||||
Visit the <a href="{{ notifications_url }}">Email Reports</a>
|
|
||||||
page on {% site_name %} to set your notification preferences.
|
|
||||||
|
|
||||||
{% else %}
|
|
||||||
This is a {{ monthly_or_weekly }} report
|
|
||||||
sent by <a href="{% site_root %}">{% site_name %}</a>.
|
|
||||||
|
|
||||||
<br />
|
|
||||||
{% include "emails/summary-downtimes-html.html" %}
|
|
||||||
|
|
||||||
<strong>Just one more thing to check:</strong>
|
|
||||||
Do you have more cron jobs,
|
|
||||||
not yet on this list, that would benefit from monitoring?
|
|
||||||
Get the ball rolling by adding one more!
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
<strong>Just one more thing to check:</strong>
|
||||||
|
Do you have more cron jobs, not yet on this list, that would benefit from monitoring?
|
||||||
|
Get the ball rolling by adding one more!
|
||||||
<br /><br />
|
<br /><br />
|
||||||
|
|
||||||
Cheers,<br>
|
Cheers,<br>
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
{% load hc_extras %}Hello,
|
{% load hc_extras %}Hello,
|
||||||
|
|
||||||
{% if nag %}This is a {% if nag_period == 3600 %}hourly {% endif %}{% if nag_period == 86400 %}daily {% endif %}reminder sent by {% site_name %}.
|
This is a {{ monthly_or_weekly }} report sent by {% site_name %}.
|
||||||
|
|
||||||
{% if num_down == 1%}One check is currently DOWN:{% else %}{{ num_down }} checks are currently DOWN:{% endif %}{% else %}This is a {{ monthly_or_weekly }} report sent by {% site_name %}.{% endif %}
|
|
||||||
{% include 'emails/summary-text.html' %}
|
{% include 'emails/summary-text.html' %}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1 @@
|
||||||
{% if nag %}
|
{{ monthly_or_weekly|capfirst }} Report
|
||||||
Reminder: {{ num_down }} check{{ num_down|pluralize }} still down
|
|
||||||
{% else %}
|
|
||||||
{{ monthly_or_weekly|capfirst }} Report
|
|
||||||
{% endif %}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue