Utility for django-statusboard to notify status changes
Project description
statusboard-notify
Utility for django-statusboard that notifies users about service status changes. The notification are sent via email or published in a Telegram channel.
This app periodically notifies about service status changes - except for changes from "Operational" to "Performance issues" (and viceversa).
Installation
Install the package:
pip install django-statusboard-notify[with_telegram]
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',
]
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:
Telegram notification
In order to enable the Telegram notifications, you have to:
- Create a bot with BotFather.
- Create a channel.
- Make your bot an admin of your channel.
- 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 betweenc
and_
(in the example,1234567890
, then the chat id is-1001234567890
).
The, add the following variables to your settings.py
.
# settings.py
STATUSBOARD_NOTIFY_TELEGRAM_TOKEN = "TELEGRAM-TOKEN-FROM-BOTFATHER"
STATUSBOARD_NOTIFY_TELEGRAM_CHAT_ID = -1001234567890
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 Emanuele Di Giacomo emanuele@digiacomo.cc
django-statusboard-notify is licensed under GPLv2+.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-statusboard-notify-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e149011c9922ac0f270e9adc352477e89b6ee08f6b0e53c5d7a241b552b56f8 |
|
MD5 | a68d91dd32519d44ae90cf36c2822352 |
|
BLAKE2b-256 | da12928b81442bb0465aedba512e5135f108fc7e92599164acae2188be4a5877 |
Hashes for django_statusboard_notify-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c076ee17fe4a0236724cab41137eb214a84b900817d9140f9e979c1a832e0b26 |
|
MD5 | 77aeeb8a41367b173fa7cf15af593a55 |
|
BLAKE2b-256 | 026d64f13a80ac0f6187cca8ecdc46200ef3e6454f18e6d13913882adbed041a |