mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2025-08-19 13:21:32 +02:00
.config
.github
bin
collections
docs
assets
README.md
alternative-architectures.md
ansible.md
configuring-captcha.md
configuring-dns.md
configuring-playbook-alertmanager-receiver.md
configuring-playbook-appservice-double-puppet.md
configuring-playbook-appservice-draupnir-for-all.md
configuring-playbook-backup-borg.md
configuring-playbook-base-domain-serving.md
configuring-playbook-bot-baibot.md
configuring-playbook-bot-buscarron.md
configuring-playbook-bot-chatgpt.md
configuring-playbook-bot-draupnir.md
configuring-playbook-bot-go-neb.md
configuring-playbook-bot-honoroit.md
configuring-playbook-bot-matrix-registration-bot.md
configuring-playbook-bot-matrix-reminder-bot.md
configuring-playbook-bot-maubot.md
configuring-playbook-bot-mjolnir.md
configuring-playbook-bot-postmoogle.md
configuring-playbook-bridge-appservice-discord.md
configuring-playbook-bridge-appservice-irc.md
configuring-playbook-bridge-appservice-kakaotalk.md
configuring-playbook-bridge-appservice-slack.md
configuring-playbook-bridge-appservice-webhooks.md
configuring-playbook-bridge-beeper-linkedin.md
configuring-playbook-bridge-go-skype-bridge.md
configuring-playbook-bridge-heisenbridge.md
configuring-playbook-bridge-hookshot.md
configuring-playbook-bridge-matrix-bridge-sms.md
configuring-playbook-bridge-mautrix-discord.md
configuring-playbook-bridge-mautrix-facebook.md
configuring-playbook-bridge-mautrix-gmessages.md
configuring-playbook-bridge-mautrix-googlechat.md
configuring-playbook-bridge-mautrix-hangouts.md
configuring-playbook-bridge-mautrix-instagram.md
configuring-playbook-bridge-mautrix-meta-instagram.md
configuring-playbook-bridge-mautrix-meta-messenger.md
configuring-playbook-bridge-mautrix-signal.md
configuring-playbook-bridge-mautrix-slack.md
configuring-playbook-bridge-mautrix-telegram.md
configuring-playbook-bridge-mautrix-twitter.md
configuring-playbook-bridge-mautrix-whatsapp.md
configuring-playbook-bridge-mautrix-wsproxy.md
configuring-playbook-bridge-mx-puppet-discord.md
configuring-playbook-bridge-mx-puppet-groupme.md
configuring-playbook-bridge-mx-puppet-instagram.md
configuring-playbook-bridge-mx-puppet-skype.md
configuring-playbook-bridge-mx-puppet-slack.md
configuring-playbook-bridge-mx-puppet-steam.md
configuring-playbook-bridge-mx-puppet-twitter.md
configuring-playbook-bridge-wechat.md
configuring-playbook-cactus-comments.md
configuring-playbook-client-cinny.md
configuring-playbook-client-element.md
configuring-playbook-client-hydrogen.md
configuring-playbook-client-schildichat.md
configuring-playbook-conduit.md
configuring-playbook-dendrite.md
configuring-playbook-dimension.md
configuring-playbook-dynamic-dns.md
configuring-playbook-email.md
configuring-playbook-email2matrix.md
configuring-playbook-etherpad.md
configuring-playbook-external-postgres.md
configuring-playbook-federation.md
configuring-playbook-jitsi.md
configuring-playbook-ldap-auth.md
configuring-playbook-ma1sd.md
configuring-playbook-matrix-corporal.md
configuring-playbook-matrix-ldap-registration-proxy.md
configuring-playbook-matrix-media-repo.md
configuring-playbook-matrix-registration.md
configuring-playbook-mautrix-bridges.md
configuring-playbook-nginx.md
configuring-playbook-ntfy.md
configuring-playbook-own-webserver.md
configuring-playbook-pantalaimon.md
configuring-playbook-postgres-backup.md
configuring-playbook-prometheus-grafana.md
configuring-playbook-prometheus-nginxlog.md
configuring-playbook-prometheus-postgres.md
configuring-playbook-rageshake.md
configuring-playbook-rest-auth.md
configuring-playbook-riot-web.md
configuring-playbook-s3-goofys.md
configuring-playbook-s3.md
configuring-playbook-shared-secret-auth.md
configuring-playbook-sliding-sync-proxy.md
configuring-playbook-ssl-certificates.md
configuring-playbook-sygnal.md
configuring-playbook-synapse-admin.md
configuring-playbook-synapse-auto-accept-invite.md
configuring-playbook-synapse-auto-compressor.md
configuring-playbook-synapse-s3-storage-provider.md
configuring-playbook-synapse-simple-antispam.md
configuring-playbook-synapse-usage-exporter.md
configuring-playbook-synapse.md
configuring-playbook-telemetry.md
configuring-playbook-traefik.md
configuring-playbook-turn.md
configuring-playbook-user-verification-service.md
configuring-playbook.md
configuring-well-known.md
container-images.md
faq.md
getting-the-playbook.md
howto-server-delegation.md
howto-srv-server-delegation.md
importing-postgres.md
importing-synapse-media-store.md
importing-synapse-sqlite.md
installing.md
maintenance-and-troubleshooting.md
maintenance-checking-services.md
maintenance-migrating.md
maintenance-postgres.md
maintenance-synapse.md
maintenance-upgrading-services.md
obtaining-access-tokens.md
prerequisites.md
registering-users.md
self-building.md
uninstalling.md
updating-users-passwords.md
examples
group_vars
roles
.editorconfig
.envrc
.gitattributes
.gitignore
.yamllint
CHANGELOG.md
LICENSE
Makefile
README.md
YEAR-IN-REVIEW.md
ansible.cfg
flake.lock
flake.nix
jitsi_jvb.yml
justfile
requirements.yml
setup.yml
95 lines
5.0 KiB
Markdown
95 lines
5.0 KiB
Markdown
# Setting up matrix-alertmanager-receiver (optional)
|
|
|
|
The playbook can install and configure the [matrix-alertmanager-receiver](https://github.com/metio/matrix-alertmanager-receiver) service for you. It's a [client](https://prometheus.io/docs/alerting/latest/clients/) for Prometheus' [Alertmanager](https://prometheus.io/docs/alerting/latest/alertmanager/), allowing you to deliver alerts to Matrix rooms.
|
|
|
|
See the project's [documentation](https://github.com/metio/matrix-alertmanager-receiver) to learn more about what this component does and why it might be useful to you.
|
|
|
|
At the moment, **setting up this service's bot requires some manual actions** as described below in [Account and room preparation](#account-and-room-preparation).
|
|
|
|
This service is meant to be used with an external [Alertmanager](https://prometheus.io/docs/alerting/latest/alertmanager/) instance. It's **not** meant to be integrated with the [Prometheus & Grafana stack](./configuring-playbook-prometheus-grafana.md) installed by this playbook, because the Alertmanager component is not installed by it.
|
|
|
|
## Adjusting the playbook configuration
|
|
|
|
Add the following configuration to your `inventory/host_vars/matrix.DOMAIN/vars.yml` file:
|
|
|
|
```yml
|
|
matrix_alertmanager_receiver_enabled: true
|
|
|
|
# This exposes matrix-alertmanager-receiver on the `matrix.` domain.
|
|
# Adjust, if necessary.
|
|
matrix_alertmanager_receiver_hostname: "{{ matrix_server_fqn_matrix }}"
|
|
|
|
# This exposes matrix-alertmanager-receiver under a path prefix containing a random (secret) value.
|
|
# Adjust the `RANDOM_VALUE_HERE` part with a long and secure value.
|
|
matrix_alertmanager_receiver_path_prefix: /matrix-alertmanager-receiver-RANDOM_VALUE_HERE
|
|
|
|
# If you'd like to change the username for this bot, uncomment and adjust. Otherwise, remove.
|
|
# matrix_alertmanager_receiver_config_matrix_user_id_localpart: "bot.alertmanager.receiver"
|
|
|
|
# Specify the bot user's access token here.
|
|
# See the "Account and room preparation" section below.
|
|
matrix_alertmanager_receiver_config_matrix_access_token: ''
|
|
|
|
# Optionally, configure some mappings (URL-friendly room name -> actual Matrix room ID).
|
|
#
|
|
# If you don't configure mappings, you can still deliver alerts using URLs like this:
|
|
# https://matrix.DOMAIN/matrix-alertmanager-receiver-RANDOM_VALUE_HERE/alert/!some-room-id:example.com
|
|
#
|
|
# If a mapping like the one below is configured, you can deliver alerts using friendlier URLs like this:
|
|
# https://matrix.DOMAIN/matrix-alertmanager-receiver-RANDOM_VALUE_HERE/alert/some-room-name
|
|
matrix_alertmanager_receiver_config_matrix_room_mapping:
|
|
some-room-name: "!some-room-id:{{ matrix_domain }}"
|
|
```
|
|
|
|
See `roles/custom/matrix-alertmanager-receiver/defaults/main.yml` for additional configuration variables.
|
|
|
|
|
|
## Account and room preparation
|
|
|
|
The playbook can automatically create users, but it cannot automatically obtain access tokens, nor perform any of the other manual actions below.
|
|
|
|
`matrix-alertmanager-receiver` uses a bot (with a username specified in `matrix_alertmanager_receiver_config_matrix_user_id_localpart` - see above) for delivering messages. You need to **manually register this bot acccount and obtain an access token for it**.
|
|
|
|
1. [Register a new user](registering-users.md): `ansible-playbook -i inventory/hosts setup.yml --extra-vars='username=bot.alertmanager.receiver password=PASSWORD_FOR_THE_BOT admin=no' --tags=register-user`
|
|
2. [Obtain an access token](obtaining-access-tokens.md) for the bot's user account
|
|
3. Invite the bot to a room where you'd like to alerts to be delivered
|
|
4. Log in as the bot using any Matrix client of your choosing, accept the room invitation from the bot's account and log out
|
|
5. (Optionally) Adjust `matrix_alertmanager_receiver_config_matrix_room_mapping` to create a mapping between the new room and its ID
|
|
|
|
Steps 1 and 2 above only need to be done once, while preparing your [configuration](#configuration).
|
|
|
|
Steps 3 and 4 need to be done for each new room you'd like the bot to deliver alerts to. Step 5 is optional and provides cleaner `/alert/` URLs.
|
|
|
|
|
|
## Installation
|
|
|
|
Now that you've [prepared the bot account and room](#account-and-room-preparation) and have [configured the playbook](#configuration), you can run the [installation](installing.md) command: `just install-all`
|
|
|
|
Then, you can proceed to [Usage](#usage).
|
|
|
|
|
|
## Usage
|
|
|
|
Configure your Prometheus Alertmanager with configuration like this:
|
|
|
|
```yml
|
|
receivers:
|
|
- name: matrix
|
|
webhook_configs:
|
|
- send_resolved: true
|
|
url: URL_HERE
|
|
route:
|
|
group_by:
|
|
- namespace
|
|
group_interval: 5m
|
|
group_wait: 30s
|
|
receiver: "matrix"
|
|
repeat_interval: 12h
|
|
routes:
|
|
- receiver: matrix
|
|
```
|
|
|
|
.. where `URL_HERE` looks like `https://matrix.DOMAIN/matrix-alertmanager-receiver-RANDOM_VALUE_HERE/alert/some-room-name` or `https://matrix.DOMAIN/matrix-alertmanager-receiver-RANDOM_VALUE_HERE/alert/!some-room-id:DOMAIN`.
|
|
|
|
This bot does **not** accept room invitations automatically (like many other bots do). To deliver messages to rooms, **the bot must be joined to all rooms manually** - see Step 5 of the [Account and room preparation](#account-and-room-preparation) section.
|