Aller au contenu
EN English versionDemander une démo

Connect a Grafana stack to the observability plugin

For an organisation administrator. Procedure connector.mcp.observability-grafana, version 1, reviewed 2026-11-25 against the vendor’s own pages. It applies to the connector type mcp/observability-grafana.

It ships with the plugin observability-grafana 0.1.0: its source. In the console, once the plugin is installed, it opens with How to set this up on the connector of the plugin’s server, and on Library › Plugins.

Addresses are written <api_url>, <public_url> and <org> here: the console shows the same text with your deployment’s own.

  • A Grafana (OSS, Enterprise or Cloud) you administer, with Grafana-managed alerting, a Prometheus or Mimir datasource and, for logs, a Loki datasource.
  • The observability plugin (the agent, the template) and the observability-grafana plugin (this server) installed in your organisation (Catalogue, Plugins); the second requires the first. The server runs in the platform; there is nothing to host. A plugin that brings a server needs a second person’s approval.
  • A Grafana the platform can reach. See Reaching the system below.
  • A project from the template alert-triage, and a person of the on-call group to review its work items.
  • What this procedure has not been run against. The plugin was written from Grafana’s documentation and checked on a seeded fake, not on a live stack. Its live suite (server/tests/live) is skipped until you set TRANIBOR_LIVE_GRAFANA_URL and TRANIBOR_LIVE_GRAFANA_TOKEN: run it against a test stack before you trust the plugin in production. See What is not confirmed.
  • A public Grafana works now: a Grafana URL that the platform’s servers can reach over the internet (https://grafana.example.com), with base_url as the one allowed host.
  • A private Grafana does not, yet. Today a plugin server cannot reach a private address (ADR 0096 section 8). It needs ADR 0224 section 6 (private CIDRs or an outpost), which is not available. This plugin does not work around it: no tunnel, no proxy to host, no relaxed check on the URL. If your Grafana is private, wait for that, or expose it deliberately (with its own access control) before you install the plugin.
  1. The service account. Administration, Users and access, Service accounts, Add service account: name tranibor-observability, role Viewer. Viewer reads alert rules, alerts, silences, datasources, dashboards and annotations, and may run queries.
  2. Writes, only if you want them. The plugin creates silences and adds annotations. Viewer cannot. Either give the service account the Editor role, or (Grafana Enterprise and Cloud, custom roles) a custom role with exactly: alert.instances:read, alert.instances:create, alert.instances:write (silences), and annotations:create + annotations:read scoped to organization annotations. Without them the server returns forbidden on those three tools and everything else keeps working. The rights of the silence routes come from Grafana’s own permission checks (the authorization.go page above), not from a documentation page.
  3. The token. On the service account, Add service account token; set an expiry (90 days or less) and copy it once. It is typed in Tranibor below and sealed there.
  4. The organization. If the service account lives in another organization than the one you want to read, note its numeric id (sent as X-Grafana-Org-Id).
  5. The webhook contact point. Alerting, Contact points, Add contact point, integration Webhook: URL = the trigger URL of In Tranibor step 3, HTTP method POST, Authorization header scheme Bearer and credentials = the trigger’s token. Then point a notification policy at it (for instance for severity=~"critical|warning"), grouped by alertname so one work item covers one alert. Set Max alerts to a small number; the trigger reads the first alert and the group’s common labels.
Tool Grafana route Needs
get_provider (no call), list_firing_alerts, list_silences GET /api/alertmanager/grafana/api/v2/alerts, /silences Viewer (alert.instances:read)
get_alert_rule GET /api/v1/provisioning/alert-rules/{rule_id} Viewer (alert.rules:read)
list_sources, query_metrics, query_logs GET /api/datasources, POST /api/ds/query Viewer (datasources:query)
list_dashboards, get_dashboard GET /api/search, /api/dashboards/uid/{uid} Viewer (dashboards:read)
list_annotations GET /api/annotations Viewer (annotations:read)
create_silence, expire_silence POST /api/alertmanager/grafana/api/v2/silences, DELETE …/silence/{id} Editor (alert.instances:create, :write)
add_annotation POST /api/annotations Editor (annotations:create)

The server never creates, edits or deletes a rule, a contact point, a dashboard or a datasource, and it expires only silences it created itself (createdBy tranibor-observability-grafana).

Everything below is in a code comment of server/src/tranibor_observability_grafana/client.py too.

  • /api/ds/query bodies and frames. The route and its queries[] shape (datasource.uid, refId, from/to, expr, intervalMs, maxDataPoints) come from the data source API page; the frame layout the server reads for Prometheus (time and value columns, a __name__-less label set) and Loki (time and line columns) is from the documented response shape and Grafana’s source, and was not checked on a live stack. If a datasource answers a different layout, the metric and log tools return empty series: the live suite fails on it.
  • Alerts, silences and their routes (/api/alertmanager/grafana/api/v2/alerts, /silences, /silence/{id}) follow the Alertmanager v2 API, which Grafana implements; no narrative page of the docs describes them (the one we tried answers 404), the route and its rights are read from Grafana’s source (authorization.go).
  • The alert rule route (/api/v1/provisioning/alert-rules/{rule_id}) is documented, and marked deprecated in favour of the App Platform rules.alerting.grafana.app API. A future Grafana may remove it.
  • The dashboard route (/api/dashboards/uid/{uid}) is the legacy one; the current docs describe the newer /apis route. The legacy route is in Grafana’s merged OpenAPI document.
  • The rule id of an alert (rule_id in list_firing_alerts). The server reads, in this order, the __alert_rule_uid__ label, a rule_uid annotation, then the rule uid in the generator URL (/alerting/grafana/<uid>/view). Which of the three a live Grafana carries on every alert was not confirmed; an alert with none has an empty rule_id, and the agent says so rather than guess.
  • get_provider’s sources come from GRAFANA_DATASOURCES, or, when it is empty, from the datasources the token sees whose type is Prometheus-like or Loki (the type names are in server/src/tranibor_observability_grafana/tools.py); they were not checked against every datasource plugin.
  • The narrower custom role of step 2 is inferred from the permissions in Grafana’s source, not from a documentation page. If a write fails with forbidden, use Editor.
  1. Catalogue, Plugins, observability-grafana, Configure: type the fields above. base_url is the only host the server may reach. Set datasources to the uids it may query if you want a narrower list than “every Prometheus-type and Loki datasource the token sees”.

  2. Create a project from the template alert-triage of the observability plugin (workflow alert-triage, internal tracker). Name the connector instance after the Grafana it serves (grafana-prod): get_provider says that name to the agent.

  3. The trigger (a template cannot ship one; ADR 0113 of the core). In the project’s configuration:

    triggers:
    - name: grafana-alert
    title: "{/commonLabels/alertname}: {/commonAnnotations/summary}"
    body: "Triage the firing alert {/commonLabels/alertname} (severity {/commonLabels/severity}). Started at {/alerts/0/startsAt}. Rule: {/alerts/0/generatorURL}"
    key: /groupKey
    fields:
    alertname: /commonLabels/alertname
    severity: /commonLabels/severity
    starts_at: /alerts/0/startsAt
    when: { /status: ["firing"] }
    workflow: alert-triage

    when ignores resolved notifications; key gives one work item per Grafana group while it runs. Mint the trigger’s token (Settings, the project’s triggers; shown once) and give Grafana the URL https://<your tranibor>/api/v1/webhooks/triggers/<org>/<project>/grafana-alert.

  4. Fire it once by hand with a payload you type (the console’s fire box) before Grafana sends one.

  1. In Grafana, on the contact point, Test: a work item opens and the agent runs.
  2. The report cites the rule, a metric value with its time, and the annotations. Read it: a claim without a number or a time behind it is a defect, report it.
  3. A silence the agent proposes opens an approval for a person. Approve a short silence on a test alert; check it in Grafana (Alerting, Silences) under createdBy tranibor-observability-grafana, then expire it there (or let it end).
  • unauthorized: the token is wrong or expired. Issue another and type it again.
  • forbidden on create_silence, expire_silence or add_annotation: the service account is a Viewer. See step 2.
  • not_found on a rule or dashboard: the id is from another organization; set org_id.
  • A query is refused as outside the allow-list: add the datasource’s uid to datasources, or empty it (the error says source ... allow-list).
  • A silence is refused: its matchers must be exact, include alertname, match at least one firing alert and at most 25, and last no longer than max_silence_minutes. The agent proposes it again, or you decide it in Approvals.
  • No work item opens: check the trigger’s token, that the notification policy reaches the contact point, and the project’s Received events card, which records each delivery and why it was ignored.
Field What to put in it
base_url https://grafana.example.com, without a trailing slash (https is required)
datasources optional: the uids of the Prometheus, Mimir and Loki datasources the agent may query (they are the sources get_provider lists)
max_lines the most log lines one query returns (default 200, at most 1000)
max_range_hours the widest window of one metric or log query (default 6, at most 24)
max_silence_minutes the longest silence the plugin may create (default 120, at most 1440)
org_id the organization id, only if the service account is not in the organization you want to read
token the service account’s token, typed once

Hosts the platform must be allowed to reach:

  • <your Grafana host>