Send notifications when predefined conditions are met
Project description
About RabbitMQ Alert
Send notifications when predefined conditions are met.
Which conditions?
Ready messages
Unacknowledged messages
Total queued messages
Number of connected consumers
Number of open connections
Number of nodes running
Memory used by each node in MBs
What type of notifications?
Currently the following are supported:
E-mails
Slack messages
Telegram messages
Installation
Use the PIP command, which should already exist in your Linux installation:
sudo pip install rabbitmq-alert
Usage
Execute with the global configuration file
Copy the example configuration file to the default path of the global configuration file:
sudo cp /etc/rabbitmq-alert/config.ini.example /etc/rabbitmq-alert/config.ini
sudo rabbitmq-alert
Execute with options
Example:
sudo rabbitmq-alert \ --host=my-server --port=55672 --username=guest --password=guest \ --vhost=%2F --queue=my_queue1,my_queue2 --ready-queue-size=3 --check-rate=300 \ --email-to=admin@example.com --email-from=admin@example.com \ --email-subject="RabbitMQ alert at %s - %s" --email-server=localhost
Execute with a custom configuration file
Then execute rabbitmq-alert with the configuration file option:
sudo rabbitmq-alert -c my_config.ini
Execute as a daemon
sudo systemctl daemon-reload sudo systemctl start rabbitmq-alert
To have rabbitmq-alert always started on boot:
sudo systemctl enable rabbitmq-alert
In case your system still uses init.d, an init.d script has been created in /etc/init.d upon PIP installation. To start rabbitmq-alert as a daemon:
sudo /etc/init.d/rabbitmq-alert start
To have rabbitmq-alert always started on boot:
sudo update-rc.d rabbitmq-alert defaults
Different options per queue
[Conditions:my-queue] ... [Conditions:my-other-queue] ...
Note that queue names also have to be defined in the [Server] section of the configuration file:
[Server] ... queues=my-queue,my-other-queue ...
Logging
Execute in a container
docker run -d --name rabbitmq-alert -v config.ini:/etc/rabbitmq-alert/config.ini \ mylkoh/rabbitmq-alert:latest
For the configuration file, advise the config.ini.example that exists in the project’s repository.
Contribute
Prepare your environment
To start, you have to install the dev dependencies which are some required python packages:
make deps-dev
Run the tests!
After writing your awesomeness, run the test suites to ensure that everything is still fine:
make test
Firstly, ensure that you have removed the rabbitmqalert package from your system. Otherwise you may find yourself running the tests on the installed package instead of the source code.
Do add tests yourself for the code you contribute to ensure the quality of the project.
Happy coding :-)
Build and publish a new container version
To build a new image version of the project:
docker build --no-cache -t mylkoh/rabbitmq-alert:1.2.2 -t mylkoh/rabbitmq-alert:latest .
Publish the image:
docker push mylkoh/rabbitmq-alert
Testing the container
Create a network that all containers will belong to:
docker network create rabbitmq-alert
Run rabbitmq into a container:
docker run -d --name some-rabbit --net rabbitmq-alert -p 8080:15672 rabbitmq:3-management
docker run -d --name fake-smtp --net rabbitmq-alert -p 25:25 munkyboy/fakesmtp
Now, run rabbitmq-alert using the same network:
docker run -d --name rabbitmq-alert --net rabbitmq-alert \ -v config.ini:/etc/rabbitmq-alert/config.ini mylkoh/rabbitmq-alert:latest
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
File details
Details for the file rabbitmq-alert-1.9.0.tar.gz
.
File metadata
- Download URL: rabbitmq-alert-1.9.0.tar.gz
- Upload date:
- Size: 13.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb96e45a89150e8b77c3936299db72f1d6ca39ab55b1bef25163a3144c624a61 |
|
MD5 | 372847dcfd5591a64ab3fe2e14e184d0 |
|
BLAKE2b-256 | 26cf090b4eec098cf2c9dbcbfdc189f3b26ebc80688bcbff36b04f7c16a1a9e3 |