Grafana¶
Send Grafana Alerting notifications to Argavon through a webhook contact point.
This works with Grafana's own alerting (Grafana 11, 12 and 13). If your alerts come from Prometheus rules through Alertmanager, use Prometheus Alertmanager instead.
Before you start¶
- A Argavon source of type
grafanaand its token. Create it on Integrations → Grafana → Connect Grafana, or see Create a source. - Permission to edit contact points and notification policies in Grafana.
1. Add the contact point¶
In Grafana:
- Go to Alerting → Contact points → + Add contact point.
- Name it
Argavonand choose the Webhook integration. - URL:
https://argavon.com.com/api/v1/ingest/grafana - Open Optional Webhook settings. Set Authorization Header - Scheme to
Bearerand Authorization Header - Credentials to your source token.
Argavon also accepts the token in an X-Source-Token header, if you prefer to
add a custom header instead.
2. Test it¶
Click Test on the contact point in Grafana. In Argavon, an incident
[Test] Grafana contact point test — <source name> appears on the
service grafana-test. Open it to see the alert arrived. It is marked
recovered at once and closes itself after the auto-close quiet period
(5 minutes by default).
You can also click Test next to the source on the Argavon Integrations page. It sends the same kind of test alert and says Sent. A “[Test] Grafana contact point test” incident is open in Incidents and closes itself in a few minutes.
3. Route alerts to it¶
Save the contact point. Then in Alerting → Notification policies, either make Argavon the default contact point, or add a child policy that matches the alerts to send. Turn on Continue matching on that child policy to keep your existing notifications.
4. Set Grafana's root URL¶
Set root_url under [server] in grafana.ini, for example
https://grafana.example.com/. Grafana builds the rule, dashboard and panel
links from it. Without it, the Open rule in Grafana and Dashboard links
on Argavon alerts point to localhost:3000.
Provisioning file¶
If you manage Grafana with files, put this in provisioning/alerting/ instead
of steps 1 and 2, and restart Grafana:
apiVersion: 1
contactPoints:
- orgId: 1
name: Argavon
receivers:
- uid: neuroops
type: webhook
settings:
url: https://argavon.com.com/api/v1/ingest/grafana
httpMethod: POST
authorization_scheme: Bearer
authorization_credentials: <your source token>
You still need a notification policy that sends alerts to it.
How alerts are mapped¶
| Argavon field | Taken from |
|---|---|
| Service | The service label. If missing, the grafana_folder label (the rule's folder). If missing, the rulename label, then alertname. Else unknown-service. |
| Severity | The severity label, normalized the same way as Prometheus. No label means medium. |
| Title | The summary annotation, else alertname. |
| Message | The description annotation. |
| Labels | All alert labels are kept. |
| Start time | startsAt, else the time Argavon received it. |
| Identity | Grafana's fingerprint, scoped to the Grafana organization. Firing, repeat and resolved messages update the same alert. |
A service label that names an exporter is replaced the same way as for
Prometheus; see Exporter service labels.
Argavon also stores these extras from Grafana as labels on the alert:
| Label | From |
|---|---|
grafana.value |
The value the rule fired on, read from valueString (the threshold expression is skipped), rounded to 2 decimals |
grafana.rule_url |
generatorURL |
grafana.dashboard_url |
dashboardURL |
grafana.panel_url |
panelURL |
grafana.rule_uid |
ruleUID |
grafana.org_id |
orgId |
annotation.runbook_url |
The runbook_url annotation |
No data and query errors¶
When a rule cannot evaluate, Grafana raises DatasourceNoData or
DatasourceError. That means monitoring is blind, not that the service is
broken. Argavon treats these differently:
- severity is
unknown, - the title is No data: <rule name> or Query error: <rule name>,
- the message says it is a monitoring gap, not a confirmed problem (with Grafana's error text for query errors),
- the label
grafana.monitoring_gapisno_dataorquery_error.
Resolved alerts and auto-close¶
When Grafana sends a resolved notification, Argavon marks that alert as
recovered. When every alert in an incident has recovered and stays quiet for the quiet period (5 minutes by
default, AUTO_CLOSE_QUIET_PERIOD), Argavon resolves the incident. Details are
in Prometheus: resolved alerts and auto-close.
Older setups that post to the Prometheus endpoint¶
Before /ingest/grafana existed, Grafana was pointed at
/api/v1/ingest/prometheus. That still works for a grafana source, and the
Grafana mapping above is used. New setups should use /api/v1/ingest/grafana.
If it does not work¶
| You see | Fix |
|---|---|
Grafana's test fails with 401 |
The token is wrong, rotated, or the source was deleted. Check Authorization Header - Credentials and the scheme Bearer. |
403 source token not authorized for /ingest/grafana |
The token belongs to a source of another type (for example prometheus). Create a grafana source. |
400 alerts array is empty or missing |
Something other than a Grafana webhook is posting. The payload is in the dead-letter queue. |
Links on alerts point to localhost:3000 |
Set root_url in grafana.ini. |
| All alerts land on one service named after a folder | Add a service label to your alert rules. |
| Test incident does not appear | Grafana's Test button sends straight to the contact point, so notification policies do not matter here. Check the URL ends in /api/v1/ingest/grafana and the source on Integrations for last error. |