Skip to content

Prometheus Alertmanager

Send Alertmanager alerts to Argavon with a webhook receiver.

Before you start

  • A Argavon source of type prometheus and its token. Create it on Integrations → Prometheus → Connect Prometheus, or see Create a source.
  • Access to your alertmanager.yml.

1. Add the receiver

Add a receiver that posts to Argavon:

receivers:
  - name: neuroops
    webhook_configs:
      - url: 'https://argavon.com.com/api/v1/ingest/prometheus'
        send_resolved: true
        http_config:
          authorization:
            type: Bearer
            credentials: '<your source token>'

Keep send_resolved: true. Without it Argavon never learns that an alert recovered, and incidents do not close on their own.

2. Route alerts to it

To send every alert to Argavon and leave your existing routing as it is, make this the first child of your root route:

route:
  routes:
    - receiver: neuroops
      continue: true
    # … your existing child routes stay below

continue: true lets Alertmanager keep matching your other routes, so current notifications still go out.

3. Reload Alertmanager

Reload or restart Alertmanager so it reads the new config.

4. Check it

Click Test next to the source on Integrations. The page shows Sent. 1 event accepted; see Incidents., and an incident titled [Test] Error rate > 5% on checkout-api appears under Incidents.

The test sends a "resolved" right after the alert, so the test incident closes itself after the quiet period (5 minutes by default). Each click makes a new test incident.

When a real alert fires, the source on Integrations changes from waiting for data to healthy and shows when data last arrived.

How alerts are mapped

Argavon field Taken from
Service The service label. If it is missing, the alertname label. If both are missing, unknown-service.
Severity The severity label, normalized (table below). A missing label becomes medium.
Title The summary annotation, else the alertname label.
Message The description annotation.
Labels All alert labels are kept.
Start time startsAt; if missing or unreadable, the time Argavon received it.
Identity Alertmanager's fingerprint. Firing, repeat and resolved messages for one alert update the same alert in Argavon.

Argavon groups alerts into incidents by service, so give every alert rule a service label.

Exporter service labels

Some setups (for example kube-prometheus-stack) set service to the exporter that produced the metric, so every alert would land on one service. When the service label names an exporter, Argavon builds the service from other labels instead:

service label looks like Service becomes
ends in node-exporter node/<node>, or node/<host of instance>
ends in blackbox-exporter probe/<host of instance>
ends in kube-state-metrics, is kubelet or cadvisor, or starts with kube-prometheus-stack- <namespace>/<deployment, statefulset, daemonset, container, pod or job_name>, else <namespace>, else the job label

Pod names lose their generated suffix (checkout-7d4b9c8f6d-x2k9p becomes checkout). The original value is kept in the label service.original, and service.derived_from says which labels were used.

Severity

severity label Argavon severity
critical, crit, fatal, p0, emergency, emerg, alert, panic, page, pager, disaster critical
high, error, err, p1, major high
warning, warn, medium, med, average, moderate, ticket, p2 medium
low, minor, info, notice, debug, p3, p4 and any other word low
no label medium

This is the same table OpenTelemetry, Grafana and the events API use, so one word means one severity whichever way the alert arrives.

Matching ignores case.

Annotations kept on the alert

Two annotations are copied into the alert's labels:

  • runbook_url (stored as annotation.runbook_url): shown as a link on the alert in the incident.
  • value (stored as annotation.value): Alertmanager does not send the metric value. To keep it, add it to your rule:
annotations:
  summary: "Error rate above 5%"
  value: "{{ $value }}"

Resolved alerts and auto-close

When Alertmanager sends "status": "resolved" for an alert, Argavon marks that alert as recovered. A resolved message never opens an incident and never raises an incident's alert count.

When every alert in an open incident has recovered, a quiet period starts. If any alert in it fires again during the quiet period, the close is cancelled. When the quiet period ends and all alerts are still recovered, Argavon resolves the incident and adds the note:

Resolved automatically: all N alert(s) recovered and stayed quiet for 5m0s.

The quiet period is 5 minutes. Change it with the backend setting AUTO_CLOSE_QUIET_PERIOD (a Go duration such as 10m). An invalid value is ignored and 5 minutes is used. See Configuration.

Incidents that also contain alerts from a source that never sends a resolve (for example OpenTelemetry) are not closed automatically.

Alertmanager setup helper

If your alertmanager.yml is large, the web app can read it and write the snippets for you.

  1. Open Alertmanager setup (under Platform; operators and admins).
  2. Paste your alertmanager.yml and click Analyze.
  3. Under 1. Send alerts to Argavon, copy the Receiver and the Route. Replace <NEUROOPS_SOURCE_TOKEN> with your source token.
  4. Under 2. Escalation routes, the helper lists the routes that page people today (receivers with PagerDuty, Opsgenie, VictorOps, Pushover, Telegram or SNS). Each one is turned into a Argavon escalation route by service and minimum severity. Pick an escalation policy for each, or leave Skip, then click Add routes. New routes go after your existing ones, above any route for every service. See Escalation.
  5. Routing tree shows each route with the conditions it inherits.

What the helper reads from routes: matchers on service, app or job become the Argavon service pattern (exact value, or one * at the start or end); matchers on severity become the minimum severity. Other matchers are not used, and the table says so next to the route.

The configuration is read once in memory and never stored. The answer never contains any of its secrets: receivers are listed by kind only.

The same thing over the API (operator or admin):

jq -Rs '{config: .}' alertmanager.yml | curl -sS -X POST \
  https://argavon.com.com/api/v1/alertmanager/helper \
  -H "Authorization: Bearer $NEUROOPS_API_KEY" \
  -H "Content-Type: application/json" -d @-

The answer has receiver_yaml, route_yaml, suggestions, routes, receivers and notes. If a receiver already posts to /api/v1/ingest/prometheus, already_wired is true and a note says so.

Helper errors:

Message Meaning
this does not look like alertmanager.yml: it needs a route and receivers The YAML has no route or no receivers.
not valid YAML: … Fix the YAML.
the configuration is larger than 512 KB Paste a smaller file.
route … uses receiver "…", which is not defined A route names a receiver that does not exist.

Working example: the demo

./quickstart.sh --demo starts Argavon with a real Prometheus and Alertmanager (docker-compose.demo.yml). The demo's demo/setup.sh creates a prometheus source and writes this Alertmanager config:

route:
  receiver: neuroops
  group_by: [alertname, service]
  group_wait: 10s
  group_interval: 30s
  repeat_interval: 1h
receivers:
  - name: neuroops
    webhook_configs:
      - url: http://backend:8080/api/v1/ingest/prometheus
        send_resolved: true
        http_config:
          authorization:
            type: Bearer
            credentials: <the demo source token>

The rules in demo/rules.yml fire real alerts with service and severity labels. QueueBacklogHigh fires for 4 minutes in every 15, so you can watch its incident close itself after the quiet period. Prometheus is on http://localhost:9090.

If it does not work

You see Fix
Alertmanager log shows 401 The token is wrong, rotated, or the source was deleted. Check credentials.
403 source token not authorized for /ingest/prometheus The token is for a Zabbix or OpenTelemetry source. Use a prometheus source.
400 alerts array is empty or missing Something other than Alertmanager is posting. The payload is in the dead-letter queue.
400 too many alerts (max 1000 per request) Split large groups (for example group by more labels).
413 request body too large (max 1 MiB) Same: send fewer alerts per notification.
Every alert lands on one service Add a service label to your rules, or see Exporter service labels.
Incidents never close Set send_resolved: true.