Prometheus Alertmanager

Send Alertmanager's alerts to your phone. Firing alerts open (or update) a ZapaPUSH alert, and resolved alerts close it, silently.

Replace YOUR_KEY with the key from Settings in the app.

Set up

Add a receiver to alertmanager.yml and route your alerts to it:

route:
  receiver: zapapush

receivers:
  - name: zapapush
    webhook_configs:
      - url: https://api.zapapush.com/integrations/alertmanager
        send_resolved: true
        http_config:
          authorization:
            credentials: YOUR_KEY

authorization sends Authorization: Bearer YOUR_KEY, which keeps the key out of the URL. Keep send_resolved: true (the default) so resolved alerts close themselves. Reload Alertmanager (SIGHUP or POST /-/reload) after editing.

Try it

Send a test alert through Alertmanager with amtool:

amtool alert add HighCPU instance=web-1 severity=critical --annotation=summary='TEST: CPU 95%' \
  --alertmanager.url=http://localhost:9093

Or post an Alertmanager-shaped payload straight to ZapaPUSH:

curl -H 'Authorization: Bearer YOUR_KEY' -H 'Content-Type: application/json' \
  https://api.zapapush.com/integrations/alertmanager -d '{
  "status": "firing",
  "alerts": [{"status": "firing", "labels": {"alertname": "HighCPU", "instance": "web-1", "severity": "critical"},
              "annotations": {"summary": "TEST: CPU 95%"}}]
}'

Send it again with "status": "resolved" on the alert to close it.

What you get on your phone

Each alert in the webhook becomes one ZapaPUSH alert, titled from its labels:

[critical] HighCPU: web-1:9100

That's [severity] alertname: instance. Without an instance label the job label stands in, and without either (common in Grafana) the other label values do, for example High memory usage: blue us-1, so each series gets its own alert. The description holds the summary and description annotations, Grafana's current values, the other labels, and links back to Grafana or Prometheus.

  • Firing again with the same labels updates the open alert instead of buzzing you again; if you acked it, it stays silent.
  • Resolved closes it without a push. If you already closed it, nothing happens.
  • Alerts without an alertname label are skipped.

Limits

  • One webhook request counts as one post towards the 60-per-minute limit, however many alerts it carries.
  • Up to 50 alerts per request; the response tells you how many were ignored. Alertmanager's max_alerts and Grafana's Max Alerts setting can cap it on their side.
  • The response is JSON: {"created": 1, "updated": 0, "silenced": 0, "closed": 0, "ignored": 0}.