GithubHelp home page GithubHelp logo

gmh5225 / server-supervisor-alert Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rahiel/supervisor-alert

0.0 1.0 0.0 14 KB

Receive notifications for supervisor process events.

Home Page: https://www.rahielkasim.com/supervisor-alert/

License: Apache License 2.0

Python 100.00%

server-supervisor-alert's Introduction

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.

server-supervisor-alert's People

Contributors

ilariofebi avatar rahiel avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.