Merge branch 'set_link_scheme' of github.com:Hebo/cabot into Hebo-set_link_scheme

This commit is contained in:
David Buxton 2014-03-02 00:21:09 +00:00
commit fd730d2774
4 changed files with 11 additions and 5 deletions

View File

@ -16,5 +16,6 @@ TWILIO_AUTH_TOKEN = os.environ.get('TWILIO_AUTH_TOKEN')
TWILIO_OUTGOING_NUMBER = os.environ.get('TWILIO_OUTGOING_NUMBER')
CALENDAR_ICAL_URL = os.environ.get('CALENDAR_ICAL_URL')
WWW_HTTP_HOST = os.environ.get('WWW_HTTP_HOST')
WWW_SCHEME = os.environ.get('WWW_SCHEME', "https")
ALERT_INTERVAL = os.environ.get('ALERT_INTERVAL', 10)
NOTIFICATION_INTERVAL = os.environ.get('NOTIFICATION_INTERVAL', 120)

View File

@ -12,7 +12,7 @@ import logging
logger = logging.getLogger(__name__)
email_template = """Service {{ service.name }} https://{{ host }}{% url service pk=service.id %} {% if service.overall_status != service.PASSING_STATUS %}alerting with status: {{ service.overall_status }}{% else %}is back to normal{% endif %}.
email_template = """Service {{ service.name }} {{ scheme }}://{{ host }}{% url service pk=service.id %} {% if service.overall_status != service.PASSING_STATUS %}alerting with status: {{ service.overall_status }}{% else %}is back to normal{% endif %}.
{% if service.overall_status != service.PASSING_STATUS %}
CHECKS FAILING:{% for check in service.all_failing_checks %}
FAILING - {{ check.name }} - Type: {{ check.check_category }} - Importance: {{ check.get_importance_display }}{% endfor %}
@ -23,9 +23,9 @@ Passing checks:{% for check in service.all_passing_checks %}
{% endif %}
"""
hipchat_template = "Service {{ service.name }} {% if service.overall_status == service.PASSING_STATUS %}is back to normal{% else %}reporting {{ service.overall_status }} status{% endif %}: https://{{ host }}{% url service pk=service.id %}. {% if service.overall_status != service.PASSING_STATUS %}Checks failing:{% for check in service.all_failing_checks %} {{ check.name }}{% if check.last_result.error %} ({{ check.last_result.error|safe }}){% endif %}{% endfor %}{% endif %}{% if alert %}{% for alias in users %} @{{ alias }}{% endfor %}{% endif %}"
hipchat_template = "Service {{ service.name }} {% if service.overall_status == service.PASSING_STATUS %}is back to normal{% else %}reporting {{ service.overall_status }} status{% endif %}: {{ scheme }}://{{ host }}{% url service pk=service.id %}. {% if service.overall_status != service.PASSING_STATUS %}Checks failing:{% for check in service.all_failing_checks %} {{ check.name }}{% if check.last_result.error %} ({{ check.last_result.error|safe }}){% endif %}{% endfor %}{% endif %}{% if alert %}{% for alias in users %} @{{ alias }}{% endfor %}{% endif %}"
sms_template = "Service {{ service.name }} {% if service.overall_status == service.PASSING_STATUS %}is back to normal{% else %}reporting {{ service.overall_status }} status{% endif %}: https://{{ host }}{% url service pk=service.id %}"
sms_template = "Service {{ service.name }} {% if service.overall_status == service.PASSING_STATUS %}is back to normal{% else %}reporting {{ service.overall_status }} status{% endif %}: {{ scheme }}://{{ host }}{% url service pk=service.id %}"
telephone_template = "This is an urgent message from Arachnys monitoring. Service \"{{ service.name }}\" is erroring. Please check Cabot urgently."
@ -49,6 +49,7 @@ def send_email_alert(service, users, duty_officers):
c = Context({
'service': service,
'host': settings.WWW_HTTP_HOST,
'scheme': settings.WWW_SCHEME
})
if service.overall_status != service.PASSING_STATUS:
if service.overall_status == service.CRITICAL_STATUS:
@ -88,6 +89,7 @@ def send_hipchat_alert(service, users, duty_officers):
'service': service,
'users': hipchat_aliases,
'host': settings.WWW_HTTP_HOST,
'scheme': settings.WWW_SCHEME,
'alert': alert,
})
message = Template(hipchat_template).render(c)
@ -119,6 +121,7 @@ def send_sms_alert(service, users, duty_officers):
c = Context({
'service': service,
'host': settings.WWW_HTTP_HOST,
'scheme': settings.WWW_SCHEME,
})
message = Template(sms_template).render(c)
mobiles = list(set(mobiles))

View File

@ -44,3 +44,4 @@ TWILIO_OUTGOING_NUMBER=+14155551234
# Used for pointing links back in alerts etc.
WWW_HTTP_HOST=localhost
WWW_SCHEME=http

View File

@ -44,3 +44,4 @@ TWILIO_OUTGOING_NUMBER=+14155551234
# Used for pointing links back in alerts etc.
WWW_HTTP_HOST=cabot.example.com
WWW_SCHEME=http