Skip to main content

Receive notifications for Supervisor process events.

Project description

supervisor-alert

Version pyversions Downloads License

Are you using Supervisor to manage processes on a server? With supervisor-alert you can receive messages when the state of your processes change. Be the first to know when your services die!

With the default configuration supervisor-alert sends messages over Telegram. For this to work you need to install telegram-send system-wide first. You can also use any shell command to send the notifications.

Installation

Install supervisor-alert on your system:

sudo pip install supervisor-alert

You must install it with Python 2 because Supervisor doesn’t support Python 3 yet. For Supervisor 4+ you may have Python 3 support, if python3 -c 'import supervisor' doesn’t give an error, you should install supervisor-alert with pip3/python3.

Then run:

sudo supervisor-alert --configure

for the default configuration. This will send notifications over Telegram. Read the next section to customize or if you dislike automatic configurations.

Manual Configuration

Create the file /etc/supervisor/conf.d/supervisor_alert.conf as root:

[eventlistener:supervisor_alert]
command=supervisor-alert --telegram
events=PROCESS_STATE_RUNNING,PROCESS_STATE_EXITED,PROCESS_STATE_FATAL
autostart=true
autorestart=true
stdout_logfile=NONE
user=supervisor_alert

This will send the notifications over Telegram, to use something else, for example ntfy, pass in the command:

command=supervisor-alert -c 'ntfy send'

By default the config file at /etc/telegram-send.conf is used for telegram-send, to use a different config, or to pass any other options:

command=supervisor-alert -c 'telegram-send --config /home/user/bunny.conf'

Optionally you can show the hostname before each message with the --show-hostname option:

command=supervisor-alert --telegram --show-hostname

The default configuration will run the event listener as the user supervisor_alert. It is a good practice to isolate services by running them as separate users (and avoiding running them as root). Add the user with:

sudo adduser supervisor_alert --system --no-create-home

Optionally, you can also subscribe to different supervisor events, look at the docs to see on which ones you’d like to be notified.

Finally, load the config and start the event listener:

sudo supervisorctl reread
sudo supervisorctl update

You should now receive your first alert, notifying you that supervisor_alert has started running.

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

supervisor-alert-0.6.2.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

supervisor_alert-0.6.2-py2-none-any.whl (7.2 kB view details)

Uploaded Python 2

File details

Details for the file supervisor-alert-0.6.2.tar.gz.

File metadata

File hashes

Hashes for supervisor-alert-0.6.2.tar.gz
Algorithm Hash digest
SHA256 86c0c9f2357905bdc2df465c3ff2313e8a77d44a1b515a349a640e3223aaa831
MD5 19af3fb5168c32e54351afa1aa1bf17b
BLAKE2b-256 50975844c8bb46ba22defe5183b7244f354fe51991a33edb378984c4807d6abc

See more details on using hashes here.

File details

Details for the file supervisor_alert-0.6.2-py2-none-any.whl.

File metadata

File hashes

Hashes for supervisor_alert-0.6.2-py2-none-any.whl
Algorithm Hash digest
SHA256 2c0e21a0f266483c6078dec1a6edc90f1e2d3c17ef826efd895cbe7d36fb177f
MD5 46614bc9c06a6613030306df3532e152
BLAKE2b-256 3f4d18b945313b71f629e1aa49e068f491c4db368de43ffcb45c990dbc134d10

See more details on using hashes here.

Supported by

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