Prometheus XMPP Alerts hook
Project description
prometheus-xmpp-alerts
A simple web hook that forwards prometheus alerts over XMPP.
Usage
To use, configure a web hook in alertmanager. E.g.:
receivers:
- name: 'jelmer-xmpp'
webhook_configs:
- url: 'http://192.168.2.1:9199/alert'
Edit the configuration file (defaults to /etc/prometheus/xmpp-alerts.yml):
jid: 'alertmanager@example.com'
password: 'PASSWORD'
# Alternatively, set a 'password_command' that should write a password to
# stdout
# password_command: 'pass show xmpp-alertmanager'
to_jid: 'jelmer@example.com'
listen_address: '192.168.2.1'
listen_port: 9199
# Text message template as jinja2; defaults to html_template with tags stripped (optional)
text_template: |
{{ status.upper() }}: *{{ labels.alertname }}* at {{ labels.host or labels.instance }}:\
{{ annotations.message }}. {{ generatorURL }}
You can also set the following environment variables instead:
-
XMPP_ID- XMPP JID -
XMPP_PASS- Password -
XMPP_RECIPIENTS- comma-separated list of recipients -
XMPP_AMTOOL_ALLOWED- comma-separated list of users (optional) -
WEBHOOK_HOST- Address to listen on (optional) -
WEBHOOK_PORT- Port to listen on (optional) -
TEXT_TEMPLATE- Template for text messages (see above, optional) -
HTML_TEMPALTE- Template for HTML messages (see above, optional)
And run the web hook::
$ python3 -m prometheus_xmpp --config=/etc/prometheus/xmpp-alerts.yaml
If you have amtool set up,
then you can also allow users to see existing alerts and manage silences.
Set the amtool_allowed option to JIDs that are allowed to use amtool.
Docker file
You can build your own docker images using the Dockerfile in this directory, or
use ghcr.io/jelmer/prometheus-xmpp-alerts. Provide your configuration in
/config.yaml or through environment variables.
Message Format
The default message format looks something like this:
FIRING: AlertName at somehost: Alert Summary. https://prometheus.example.com/expr?...
The text_template option in the configuration can be used to customize the
format, using jinja2.
Testing
The web hook can be accessed on three paths:
/alert: used by Prometheus to deliver alerts, expects POST requests with JSON body/test: delivers a test message/metrics: exposes statistics about number of alerts received
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prometheus_xmpp_alerts-0.6.0.tar.gz.
File metadata
- Download URL: prometheus_xmpp_alerts-0.6.0.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed0fde7d3e1b1dd64cb3e8fc485654c43e527f4c60297783d17d27d35982ae2e
|
|
| MD5 |
8966f8a6f16a17e5eaf54d5f91e963b3
|
|
| BLAKE2b-256 |
f41420b0d0283804c4baa9ad96694c0602feb5b4d2600325a1bf40523d023e90
|
Provenance
The following attestation bundles were made for prometheus_xmpp_alerts-0.6.0.tar.gz:
Publisher:
wheels.yaml on jelmer/prometheus-xmpp-alerts
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prometheus_xmpp_alerts-0.6.0.tar.gz -
Subject digest:
ed0fde7d3e1b1dd64cb3e8fc485654c43e527f4c60297783d17d27d35982ae2e - Sigstore transparency entry: 511476252
- Sigstore integration time:
-
Permalink:
jelmer/prometheus-xmpp-alerts@e20e7910bbc5c477d5caae41a603f32bca199aa6 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/jelmer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yaml@e20e7910bbc5c477d5caae41a603f32bca199aa6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file prometheus_xmpp_alerts-0.6.0-py3-none-any.whl.
File metadata
- Download URL: prometheus_xmpp_alerts-0.6.0-py3-none-any.whl
- Upload date:
- Size: 13.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74ac994758917ec29a410b425900643c281668b7e2641ef2d0368b029c43e888
|
|
| MD5 |
2e7203511b53387ddaecc22864cf847c
|
|
| BLAKE2b-256 |
d0f678e1d43ed4382ebaa4d0127197f4146c4a5b16de75100498b76a5c504097
|
Provenance
The following attestation bundles were made for prometheus_xmpp_alerts-0.6.0-py3-none-any.whl:
Publisher:
wheels.yaml on jelmer/prometheus-xmpp-alerts
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prometheus_xmpp_alerts-0.6.0-py3-none-any.whl -
Subject digest:
74ac994758917ec29a410b425900643c281668b7e2641ef2d0368b029c43e888 - Sigstore transparency entry: 511476255
- Sigstore integration time:
-
Permalink:
jelmer/prometheus-xmpp-alerts@e20e7910bbc5c477d5caae41a603f32bca199aa6 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/jelmer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yaml@e20e7910bbc5c477d5caae41a603f32bca199aa6 -
Trigger Event:
push
-
Statement type: