Skip to main content

Utility for django-statusboard to notify status changes

Project description

statusboard-notify

Build Pypi codecov

Utility for django-statusboard that notifies users about service status changes. The system supports notifications via email, Telegram, and Google Chat.

This app periodically notifies about service status changes - except for changes from "Operational" to "Performance issues" (and viceversa).

screenshot of a Telegram channel

Note the notification script attempts to send the message only once for each backend.

Installation

Install the package:

pip install django-statusboard-notify[with_telegram]

Note: this package requires the pandoc command installed on your system. Otherwise you can install the pypandoc_binary package (see https://pypi.org/project/pypandoc/)

If you don't need Telegram notifications, you can install the package without the with_telegram extra.

Configure the application

Add the following applications to your Django projects:

# settings.py
INSTALLED_APPS += [
    'statusboard',
    'statusboard-notify',
]

Internationalization and localization

django-statusboard supports the following languages:

  • English
  • Italian

Email notification

In order to enable the email notifications, you have to set the sender:

# settings.py
STATUSBOARD_NOTIFY_EMAIL_SENDER = "statusboard@localhost.localdomain

You can edit the subject:

# settings.py
STATUSBOARD_NOTIFY_EMAIL_SUBJECT = "Mysubject"

You can add a list of recipients that will receive the notifications about all the services:

# settings.py
STATUSBOARD_NOTIFY_EMAIL_RECIPIENTS = [
    "admin@localhost.localdomain",
    "anotheradmin@localhost.localdomain",
]

From the admin page you can associate an existing user to one or more services:

screenshot of the admin page

The email is sent in two formats: plain text and html. The email is created using the template statusboard_notify/templates/statusboard_notify/email.html and then is converted using pypandoc to create the plain text version.

It's possibile to customize the footer of the email: create the file templates/statusboard_notify/email.html that extends the original template:

{% extends "statusboard_notify/email.html" %}
{% block footer %}
    <footer class="footer">
        For more informations please visit <a href="https://localhost.localdomain/status">the statuspage</a>
    </footer>
{% endblock %}

Telegram notification

In order to enable the Telegram notifications, you have to:

  1. Create a bot with BotFather.
  2. Create a channel.
  3. Make your bot an admin of your channel.
  4. Go to https://web.telegram.org and open the channel: the URL is something like https://web.telegram.org/#/im?p=c1234567890_1231231231231231231. The channel id is the concatenation of -100 and the numbers between c and _ (in the example, 1234567890, then the chat id is -1001234567890).

Then add the following variables to your settings.py.

# settings.py
STATUSBOARD_NOTIFY_TELEGRAM_TOKEN = "TELEGRAM-TOKEN-FROM-BOTFATHER"
STATUSBOARD_NOTIFY_TELEGRAM_CHAT_ID = -1001234567890

Google Chat notification

To enable the Google Chat notifications, configure the STATUSBOARD_NOTIFY_GOOGLE_CHAT_WEBHOOK_URL setting.

Configure the notification script

The notifications are fired by command send_notifications, that reads the notification queue from the DB and sends the services status changes to the recipients (the notifications are then removed).

You can activate the command using crontab, systemd, celery, etc. Below, an example with crontab:

# Check every 10 minutes for service status changes
*/10 * * * * /path/to/django/project/manage.py send_notifications

Contact and copyright information

Copyright (C) 2021-2026 Emanuele Di Giacomo emanuele@digiacomo.cc

django-statusboard-notify is licensed under GPLv2+.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_statusboard_notify-0.8.1.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_statusboard_notify-0.8.1-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

Details for the file django_statusboard_notify-0.8.1.tar.gz.

File metadata

File hashes

Hashes for django_statusboard_notify-0.8.1.tar.gz
Algorithm Hash digest
SHA256 bf5b31acf2b28674ef5d7a9c8f2de4c8815f30f9d987858bb306e59f74e0d002
MD5 9a5b341abf80e1fc668cb1232a2c238d
BLAKE2b-256 a18a7983d680d8d823b00f535580c1727a813a2d9968e85b3ce40b34403fd3c9

See more details on using hashes here.

File details

Details for the file django_statusboard_notify-0.8.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_statusboard_notify-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 372e5b1d8365c84d274e9bb03b7a9ac4ba078f7eda2f0d2ec8674c7158e556d2
MD5 f0a2bf5fc1147f79a628ca32c2bea969
BLAKE2b-256 dceea4de8d4bfed9c3f9f60d4a42bf62ca8d1ee702744117685c3f831e1143b1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page