Grafana
Connect Grafana with a Viewer service-account token so the agent reads dashboards and queries the backends behind them, and point Grafana alerting at the workspace webhook.
How-to · Updated 2026-10-23 · Describes release 0.1.164
Overview
Grafana is an umbrella: one connection reaches the dashboards and, through Grafana's datasource proxy, the metrics, logs and traces backends behind them. The catalog therefore lists it under Alerting, Metrics, Logs, Tracing and Dashboards, and a connected Grafana counts as metrics, logs and traces coverage for the Incident agent; the SecOps and FinOps agents, the estate x-ray and the insights chat read it too.
The connection is the read side. Grafana alerting reaches the platform through a webhook contact point, see Alerts in.
Setup
Before you start
- The
datasources.managepermission; the built-in owner and operator roles carry it. - A Grafana service-account token with the Viewer role (Installation).
- The Grafana URL reachable from the platform or from a private-network agent.
Installation
In Grafana open Administration → Users and access → Service accounts and add an account named aiops-reader with the Viewer role, then Add service account token and copy the token. Restrict the account's folders and datasource query permissions to the dashboards and backends the agent needs. A fix never runs through this connection, so there is no reason to raise it above Viewer.
Configuration
- Open Settings · Data in → Data sources and select Connect datasource.
- Under Type, choose Grafana. Enter a Connection name; the connected list shows it, and per-connection agent tools are named after it.
- Fill the fields; the TLS-skip field sits under Advanced connection settings:
| Field (portal label) | API key | Value |
|---|---|---|
| Grafana URL | url |
https://grafana.example.com |
| API token (Viewer role) | api_key |
The service-account token; stored write-only |
| Skip TLS verify for a self-signed cert (optional — type: true) | insecure |
true only for a self-signed certificate |
- Optionally, open Optional · describe this environment and fill What should AIOps know about it? with the dashboards and datasource names that matter.
- Under Use this connection for, choose Investigate only and select Connect and verify.
The same connection through the API (POST /api/aiops/{tenant_id}/datasources, requires datasources.manage; the token goes in secret_values):
{
"type_key": "grafana",
"name": "prod-grafana",
"description": "Prod dashboards; the Checkout and Payments folders are the ones on call reads.",
"config": {
"url": "https://grafana.example.com"
},
"secret_values": {
"api_key": "<service-account token>"
},
"role": "read",
"enabled": true
}
Validation
Connect and verify, and Test on the row later, sends a GET to /api/health with Authorization: Bearer <token>. You should see a dialog titled <connection name> is connected with Connected — verified from the control plane, and later in the row's Last test ok · HTTP 200 /api/health — {"commit": …. Grafana answers that endpoint without authentication, so a green result proves the URL and TLS, not the token: a wrong token still passes Test and fails on the agent's first real request. Select Audit perms on the row to see what the token can read, or let the agent open one dashboard.
If something fails
The dialog shows Needs a fix, what to fix and the check's own detail; the row is saved either way. Select Edit, correct the field the detail names and save again, or select Retry once a cause outside the form (network, vendor-side permission) is fixed. Every verdict this connector produces, and what to do about it, is in Troubleshooting below.
Data collected
Tools the agent gets
<name>_request— the HTTP tool against the base URL withAuthorization: Bearer <token>:method,path,query,body,content_type. Dashboards come fromGET /api/searchandGET /api/dashboards/uid/<uid>, annotations fromGET /api/annotations, the backends behind Grafana fromPOST /api/ds/querywith the datasource uid in the body.
There is no native Grafana tool, and a Grafana connection does not register prometheus_query; a direct Prometheus connection does. Responses are capped at 20,000 characters per call.
Read surface
GET and HEAD run freely, and so do POST requests to api/ds/query and api/tsdb/query, the two query proxies. Every other POST, PUT, PATCH and DELETE — creating annotations or dashboards, silencing alerts, editing datasources — is refused in an investigation, never offered for approval: Investigation connections are read-only. This operation was not executed; prepare an incident change using a write connection and obtain approval. The full rule table is under The read/write gate in detail in Connections and remediation access.
Alerts in
Grafana unified alerting posts its native, Alertmanager-shaped payload. Add a contact point of type Webhook with the URL https://<your-host>/webhook/grafana/<workspace-slug> and the token as Authorization: Bearer <webhook-token>; keep resolved notifications on, because status per alert is what closes the incident. Add a service label to each alert rule's Labels section — Grafana forwards custom labels verbatim, and service is the identity the platform groups on. The endpoint and the token are in the webhook reference. Field by field, with the response counters and error strings: webhook reference.
Troubleshooting
| What you see | Cause | What to do |
|---|---|---|
failed · SSRF guard: '<host>' resolves to non-public address … — blocked. The agent can still use this endpoint — only the Test probe is blocked by the SSRF guard's secure default. |
A cluster-internal or private address. The agent's own tools are not SSRF-guarded. | Accept it, add the host to the workspace's ssrf_allow_hosts, or turn the workspace SSRF guard off under Guardrails. |
Test is green, but every agent request answers HTTP 401 |
/api/health needs no token; the token is wrong, expired or revoked. |
Rotate the token on Edit (a blank secret field keeps the stored value; only a non-empty one replaces it) and Test again. |
Dashboards list, but POST /api/ds/query answers HTTP 403 |
The service account may see the dashboard but not query its datasource. | Grant the account datasource query permission in Grafana. |
failed · HTTP 404 /api/health |
The URL carries a path Grafana does not serve the API under. | Use the Grafana root URL, with the sub-path only if Grafana is served under one. |
failed · ConnectError: … or ConnectTimeout |
The platform cannot reach the URL. | Use an address the platform reaches, or install a private-network agent. |
A POST /api/annotations or POST /api/dashboards/db answers Investigation connections are read-only. |
The write gate. | Expected. |
| Grafana alerts arrive but open incidents with no service | The alert rule has no service label. |
Add it under the rule's Labels, or map the rule's own label with label_map. |
Grafana's webhook test answers 401 invalid webhook credentials |
Wrong token, wrong workspace slug or a disabled workspace; the endpoint never says which. | Mint or copy the token under Alert intake & tokens and paste the exact URL from there. |
The generic verdict strings and the SSRF guard are explained in Test a connection and read the failure. Every connection status word is in the status and error reference.
Next steps
- Select Discover this connection in the success dialog to find the services and dependencies behind it: Launch a scan.
- Send Grafana alerts in through the workspace webhook: Alerts in.
- See what else each agent needs in Choose your connection.