This module lets Alertmanager publish alerts to pubsub via webhooks.
The relevant pubsub nodes must be created and configured somehow.
Because the request IP address is used to publish, the
publisher
affiliation should be given to the IP address
Alertmanager sends webhooks from.
A Prometheus rule_files
might contain something along
these lines:
groups:
- name: Stuff
rules:
- alert: Down
expr: up == 0
for: 5m
annotations:
title: 'Stuff is down!'
labels:
severity: 'critical'
On the Alertmanager site the webhook configuration may look something like this:
receivers:
- name: pubsub
webhook_configs:
- url: http://pubsub.localhost:5280/pubsub_alertmanager
And then finally some Alertmanager routes would point at that receiver:
route:
receiver: pubsub
On the Prosody side, apart from creating and configuring the node(s) that will be used, configure your pubsub service like this:
"pubsub.example.com" "pubsub"
Component = {
modules_enabled "pubsub_alertmanager",
}
-- optional extra settings:
= [[
alertmanager_body_template *ALARM!* {annotations.title?Alert} is {status}
Since {startsAt}{endsAt& until {endsAt}}
Labels: {labels%
{idx}: {item}}
Annotations: {annotations%
{idx}: {item}}
]]
= "alerts/{alert.labels.severity}" alertmanager_node_template
If no node template is given, either an optional part after
“pubsub_alertmanager” in the HTTP path is used as node, or the string
“alerts”. Here, an alerts would be published to different nodes based on
the ‘severity’ label, so e.g. alerts/critical
in this
example.
Available configuration options:
alertmanager_body_template
alertmanager_node_template
"{path?alerts}"
alertmanager_path_configs
It’s possible to override configuration options based on the path
suffix. For example, if a request is made to
http://prosody/pubsub_alertmanager/foo
the path suffix is
foo
. You can then supply the following configuration:
= {
alertmanager_path_configs = {
foo = "alerts/{alert.labels.severity}";
node_template = "user@example.net";
publisher };
}
With the plugin installer in Prosody 0.12 you can use:
sudo prosodyctl install --server=https://modules.prosody.im/rocks/ mod_pubsub_alertmanager
For earlier versions see the documentation for installing 3rd party modules