# Connect Prometheus Alertmanager to SREbox

> Use Alertmanager's webhook receiver to send Prometheus firing and resolved alert groups to SREbox without migrating time series.

Prometheus evaluates alerting rules and Alertmanager handles notification delivery. Configure the Alertmanager webhook receiver—not the Prometheus scrape or remote-write path—to send alerts to SREbox. Your Prometheus metrics, dashboards and retention can remain in your current stack.

## Create the SREbox integration

Set up a rota, an enabled escalation policy with at least one rota tier, and an incoming integration under **On-call → Integrations**. Select the policy and copy the integration endpoint and one-time key into your secret store. The integration is bound to one policy; create another integration when a separate team needs a different policy.

Incoming alerts require an on-call eligible SREbox plan. There is no additional charge per webhook integration. SMS and voice use the plan's included allowance and paid-plan top-ups when applicable.

## Configure Alertmanager

Add a receiver to `alertmanager.yml`. Use a `credentials_file` readable only by the Alertmanager process, or the secret mechanism supported by your deployment. Do not commit the key to a public repository.

```yaml
route:
  receiver: srebox
  # Add matchers or child routes to limit which alert groups page.

receivers:
  - name: srebox
    webhook_configs:
      - url: https://srebox.tech/api/oncall/incoming/INTEGRATION-ID/
        send_resolved: true
        http_config:
          authorization:
            type: Bearer
            credentials_file: /etc/alertmanager/secrets/srebox-webhook-key
```

Validate the configuration with the Alertmanager tool that matches your installed version, then reload Alertmanager. Alertmanager supports grouping, repeat intervals, inhibition and routing; set these deliberately to match your alert volume and avoid sending every low-impact signal to a paging policy.

## Payload mapping and lifecycle

Alertmanager sends a webhook envelope with a top-level `status` and an `alerts` list. SREbox handles each alert individually:

- `fingerprint` is the stable deduplication ID.
- `labels.alertname` is the incident title.
- `labels.severity` or `labels.priority` is mapped to SREbox severity (`critical`/`disaster` become high; `warning` becomes low).
- `labels.instance` or `labels.host` identifies the source.
- `annotations.summary` and `annotations.description` become responder context; labels and annotations are included as bounded context.
- Per-alert `status` takes priority over the envelope's status.

Repeated firing notifications for an active fingerprint update one incident. A resolved notification with that fingerprint resolves the incident and cancels pending pages. A later firing after resolution creates a new incident. SREbox accepts up to 100 alerts in one request and up to 64 KB per request. Keep labels useful, concise and free of secrets.

Use Alertmanager's route matchers to send selected labels to SREbox. For team routing, create a distinct receiver and a distinct SREbox integration for each escalation policy. Label-to-policy mapping does not happen inside a single SREbox integration.

## Test and troubleshoot

Use a controlled test rule whose firing and resolved states are safe. Confirm Alertmanager reports the webhook as delivered, then inspect **On-call → Incidents**. SREbox currently shows the last-received time for the integration but does not keep a full webhook delivery-attempt history.

- **404:** wrong endpoint/key or paused integration; compare the one-time key and rotate it if necessary.
- **400:** malformed JSON or missing stable fingerprint, title, or recognised status.
- **403:** workspace plan does not include on-call.
- **409:** selected escalation policy is not available or lacks a valid rota tier.
- **413:** webhook body exceeds 64 KB.
- **Duplicate pages:** check that the sender includes a stable fingerprint and that retries do not generate a new ID.
- **Recovery not linked:** ensure Alertmanager sends resolved notifications and that the recovered alert has the same fingerprint.
- **No notification despite incident:** verify rota coverage, methods, notification provider configuration, and remaining credits.

Keep the bearer key private, restrict access to Alertmanager's secret file, use HTTPS, and rotate the key after exposure or staff access changes. Alert labels and annotations are supplied by your monitoring configuration; review them for tokens, customer data or other information you do not want stored in an incident record.

Official references: [Prometheus alerting rules](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/), [Alertmanager configuration and webhook receiver](https://prometheus.io/docs/alerting/latest/configuration/).
