Merge branch 'simplex-alerts' into forgejo_alerter

This commit is contained in:
midas@devnull 2025-06-16 22:10:28 +02:00
commit 51b91f1623

View file

@ -245,6 +245,7 @@ This command will:
Once you are done, you can Ctrl-c as the DB will be used by the alerter container. Once you are done, you can Ctrl-c as the DB will be used by the alerter container.
Ctrl-C once it is finished.
## Grafana-Simplex-alerter ## Grafana-Simplex-alerter
@ -286,7 +287,7 @@ You will then be able to run simplex-alerter:
[user@devnode:~]$ simplex-alerter --help [user@devnode:~]$ simplex-alerter --help
usage: simplex-alerter [-h] [-a ADDR] [-m PROMETHEUS_CONFIG] [-o OTEL_SERVER] [-f PYROSCOPE_SERVER] [-b BIND_ADDR] [-d] [-c CONFIG] [-g] [-e ENDPOINT] usage: simplex-alerter [-h] [-a ADDR] [-m PROMETHEUS_CONFIG] [-o OTEL_SERVER] [-f PYROSCOPE_SERVER] [-b BIND_ADDR] [-d] [-c CONFIG] [-e ENDPOINT]
options: options:
-h, --help show this help message and exit -h, --help show this help message and exit
@ -298,21 +299,15 @@ You will then be able to run simplex-alerter:
host:port to run the app on host:port to run the app on
-d, --debug enable debug mode, increases pyroscope sampling rate if configured -d, --debug enable debug mode, increases pyroscope sampling rate if configured
-c, --config CONFIG config file -c, --config CONFIG config file
-g, --generate-config
generate config file with placeholder values
-e, --endpoint ENDPOINT -e, --endpoint ENDPOINT
simplex endpoint simplex endpoint
#### With Docker #### With Docker
To build using docker please use the instructions in the repository README.md
[user@devnode:~]$ git clone https://github.com/MulliganSecurity/grafana-simplex-alerter.git
cd grafana-simplex-alerter
docker build . -t simplex-alerter
For the rest of the tutorial I will show the docker commands. If you installed the alerter using nix, simply replace "docker run simplex-alerter" with simplex-alerter.
Do take note of the following: Do take note of the following:
- In docker run the "--rm" parameter will be used to automatically destroy the container after it's run. If using from nix you can disregard it. - In docker run the "--rm" parameter will be used to automatically destroy the container after it's run. If using from nix you can disregard it.
@ -340,10 +335,10 @@ I will now need to create an invite link so the alert can send messages there:
#### Generate a basic config file #### Generate a basic config file
To get started we need a basic config file to fill out with our alerter information: To get started we need a basic config file: please use the template provided (example_config.yml) in the repository
[user@devnode:~]$ docker run --rm simplex-alerter -g > config.yml [user@devnode:~]$ cp example_config.yml config.yml
[user@devnode:~]$ cat config.yml [user@devnode:~]$ cat config.yml
alert_groups: alert_groups:
- invite_link: https://simplex.chat/contact#/?v=2-7&sm... - invite_link: https://simplex.chat/contact#/?v=2-7&sm...
@ -353,12 +348,9 @@ To get started we need a basic config file to fill out with our alerter informat
##### Configure the alerter ##### Configure the alerter
Update your config file with the invite link you created earler and set the name to your group name Update your config file with the invite link you created earlier and set the name to your group name
[user@devnode:~]$ vi config.yml [user@devnode:~]$ vi config.yml
so it looks like this:
[user@devnode:~]$ cat config.yml [user@devnode:~]$ cat config.yml
alert_groups: alert_groups:
- invite_link: https://simplex.chat/contact#/?v=2-7&smp=smp%3A%2F%2FUkMFNAXLXeAAe0beCa4w6X_zp18PwxSaSjY17BKUGXQ%3D%40smp12.simplex.im%2FlOgzQT8ZxfF3TV_x00c0mNLMFBDkl6gj%23%2F%3Fv%3D1-4%26dh%3DMCowBQYDK2VuAyEAypkpAgfmsShNThQBGvPXxjBk8O03vKe1x0311UHhK3I%253D%26q%3Dc%26srv%3Die42b5weq7zdkghocs3mgxdjeuycheeqqmksntj57rmejagmg4eor5yd.onion&data=%7B%22groupLinkId%22%3A%22EfuyLGxGhsc0iWkqr9NYvQ%3D%3D%22%7D - invite_link: https://simplex.chat/contact#/?v=2-7&smp=smp%3A%2F%2FUkMFNAXLXeAAe0beCa4w6X_zp18PwxSaSjY17BKUGXQ%3D%40smp12.simplex.im%2FlOgzQT8ZxfF3TV_x00c0mNLMFBDkl6gj%23%2F%3Fv%3D1-4%26dh%3DMCowBQYDK2VuAyEAypkpAgfmsShNThQBGvPXxjBk8O03vKe1x0311UHhK3I%253D%26q%3Dc%26srv%3Die42b5weq7zdkghocs3mgxdjeuycheeqqmksntj57rmejagmg4eor5yd.onion&data=%7B%22groupLinkId%22%3A%22EfuyLGxGhsc0iWkqr9NYvQ%3D%3D%22%7D
@ -368,7 +360,7 @@ so it looks like this:
Run the container Run the container
sudo docker run -v $(pwd):/config -v $(pwd):/alerterconfig -v $(pwd):/simplex --rm -p 127.0.0.1:7897:7897 simplex-alerter -c /alerterconfig/config.yml sudo docker run -v $(pwd):/alerterconfig -p 127.0.0.1:7898:7898 --rm simplex-alerter
It will connect to the simplex-chat client we started earlier. You can check the metrics to make sure it's running by checking the metrics page It will connect to the simplex-chat client we started earlier. You can check the metrics to make sure it's running by checking the metrics page
@ -511,18 +503,21 @@ sudo cat /etc/systemd/system/alerter.service
[Unit] [Unit]
[Service] [Service]
ExecStart=docker run --rm simplex-alerter -v /my/alerter/folder:/simplex -v /my/alerter/folder:/alerterconfig -p 127.0.0.1:7897:7897 -c /alerterconfig/config.yaml ExecStart=docker run -p 127.0.0.1:7898:7898 -v /my/alerter/data:/alerterconfig --rm simplex-alerter
[Install] [Install]
WantedBy=multi-user.service WantedBy=multi-user.target
``` ```
## Enable the services ## Enable the services
Now enable the service: Now enable the services
```sh
sudo systemctl daemon-reload sudo systemctl daemon-reload
sudo systemctl enable --now alerter.service sudo systemctl enable --now alerter.service
```
# Conclusion # Conclusion
We now have an easy way to set multiple alerts to different groups based on our monitoring system, furthermore those alerts will be sent over tor through a privacy-preserving messaging system. We now have an easy way to set multiple alerts to different groups based on our monitoring system, furthermore those alerts will be sent over tor through a privacy-preserving messaging system.