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

@ -229,7 +229,7 @@ The release page can be accessed through your web browser or you can download th
Run your client in server mode:
[user@devnode:~]$ simplex-chat -d chatDB
[user@devnode:~]$ simplex-chat -d chatDB
No user profiles found, it will be created now.
Please choose your display name.
It will be sent to your contacts when you connect.
@ -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.
Ctrl-C once it is finished.
## Grafana-Simplex-alerter
@ -286,7 +287,7 @@ You will then be able to run simplex-alerter:
[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:
-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
-d, --debug enable debug mode, increases pyroscope sampling rate if configured
-c, --config CONFIG config file
-g, --generate-config
generate config file with placeholder values
-e, --endpoint ENDPOINT
simplex endpoint
#### With Docker
[user@devnode:~]$ git clone https://github.com/MulliganSecurity/grafana-simplex-alerter.git
cd grafana-simplex-alerter
docker build . -t simplex-alerter
To build using docker please use the instructions in the repository README.md
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:
- 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
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
alert_groups:
- 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
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
so it looks like this:
[user@devnode:~]$ cat config.yml
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
@ -368,7 +360,7 @@ so it looks like this:
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
@ -511,18 +503,21 @@ sudo cat /etc/systemd/system/alerter.service
[Unit]
[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]
WantedBy=multi-user.service
WantedBy=multi-user.target
```
## Enable the services
Now enable the service:
```sh
sudo systemctl daemon-reload
sudo systemctl enable --now alerter.service
```
Now enable the services
sudo systemctl daemon-reload
sudo systemctl enable --now alerter.service
# 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.