Alertmanager and Grafana
Since 1.2.2 Prometheus Alertmanager and Grafana alerting can set component status directly, the way the
Uptime Kuma endpoint does. Point a webhook at one of these addresses, with a Write token of
the page as Authorization: Bearer <token>:
POST https://status.example.com/api/v1/alertmanager
POST https://status.example.com/api/v1/grafana
# another status page, with a token of that page
POST https://status.example.com/api/v1/pages/{slug}/alertmanager
POST https://status.example.com/api/v1/pages/{slug}/grafana
Every alert names its component with the label pharos_component: the component id, or its
exact name, on the page of the token. The severity label sets how bad it is:
| Alert | The component becomes |
|---|---|
Firing, severity="critical" | Major outage |
Firing, severity="warning" | Partial outage |
Firing, severity="info" | Degraded performance |
| Firing, no severity or another one | Major outage |
| Resolved | Operational |
- When one notification carries several alerts for the same component, the worst one wins.
- Alerts without the label, for a component Pharos does not know, or for a component with its own enabled check change nothing. The JSON answer lists them under
ignored, with the reason (no_component_label,unknown_componentorchecked_component), next to what wasapplied. - Like the Kuma endpoint, these set the component only. They do not open or close incidents and do not notify anyone.
- The component is marked as set from outside by that token, so its uptime is counted from the reported status.
- The same limits as the other writing endpoints apply: 60 requests a minute, and a body of 256 KiB at most.
Alertmanager
Add a receiver and send the alerts for the status page to it. Alertmanager sends resolved alerts to webhooks by default.
route:
receiver: pharos
receivers:
- name: pharos
webhook_configs:
- url: https://status.example.com/api/v1/alertmanager
send_resolved: true
http_config:
authorization:
type: Bearer
credentials: "<write token>"
Then give the alerting rules the labels Pharos reads:
- alert: ApiDown
expr: probe_success{job="api"} == 0
for: 2m
labels:
severity: critical
pharos_component: "API"
Grafana
- In Grafana, open Alerting, Contact points and add a contact point with the integration Webhook.
- URL:
https://status.example.com/api/v1/grafana, method POST. - Under the optional webhook settings, set the authorization header scheme to
Bearerand the credentials to the Write token. Save the contact point. - In each alert rule that belongs on the status page, add the label
pharos_componentwith the component id or name, andseverityif it is not a full outage. Send the rule to the contact point, directly or through a notification policy.
Grafana's test button sends an alert without pharos_component: Pharos answers it, lists it under ignored and changes nothing. Going the other way, /api/v1/components needs no token, so the Infinity data source can chart the current status directly.