TOWERBY CETMIX
← Hangar / jet_template_alertmanager

Alertmanager with Docker and Tower Webhook Routing

Run Prometheus Alertmanager in Docker and forward every alert to a Cetmix Tower webhook with bearer-token authentication.

↓ 0 downloads

Summary

Category
Jet Templates
Tags
Monitoring
Authors
Cetmix OÜ
License
AGPL-3
Version
1.0.0
Call sign
jet_template_alertmanager

This snippet imports an Alertmanager Jet Template using prom/alertmanager:v0.28.1. It allows one instance per server, keeps its data and configuration under the Jet root and runs as nobody (65534) on the shared Docker network. Port 9093 is not published, so Prometheus reaches Alertmanager by its container name. Alertmanager groups alerts by tower_server and sends them all to a single Tower webhook, repeating them every alertmanager_repeat_interval (10m by default). The Docker, Fail2ban and Tower Core dependency templates are included.

Configure and launch

  1. Import the YAML and install the template on the monitoring server. Docker must be running on it.
  2. Set the value of the Alertmanager Webhook Token secret. Use the same value in the bearer authenticator of the Tower webhook that receives the alerts (see the separate Alertmanager webhook snippet).
  3. Set alertmanager_webhook_url to <tower_url>/cetmix_tower_webhooks/<endpoint>. The default is a placeholder, so replace it with your own Tower URL. Keep alertmanager_repeat_interval below the stale-after time of the metrics it carries.
  4. Create a Jet targeting Running. Prepare creates the data and config directories and locks the Jet against deletion. Build pushes alertmanager.yml and the token file, fixes ownership, pulls the image and creates the container. Start brings it online.
  5. In prometheus.yml add alerting.alertmanagers with the target <alertmanager_jet_reference>:9093 and your rule_files, then reload Prometheus.

Operate and troubleshoot

After changing the webhook URL, the repeat interval or the token, run Reload config. It re-pushes both files, restores ownership and sends SIGHUP, so the container is not recreated. Rebuild recreates the container from the current image tag and keeps the data directory. The Jet logs show the container output and the result of the Alertmanager health probe. If no alerts reach Tower, check the Jet logs, the webhook URL and that the token matches the authenticator. Destroy removes the container, image, files, DNS record, root directory and volumes of the Jet.