Skip to main content

imbi-plugin-grafana

The Grafana plugin for the Imbi platform, distributed as a single Python package (imbi.plugins.grafana) exposing one Integration (grafana) with four capabilities:

  • lifecycle — writes the project's EXISTS_IN edge, whose identifier ({slug}-{id} by default) the project's alert rules carry in a label (service by default), and a project link to the alert rules list searched by that label. The link key is the integration slug. Removes both on delete.
  • webhook-actions — receives deliveries from a Grafana Alerting webhook contact point. imbi-gateway finds the project by the label value and records each delivery as an event. It verifies the signature only when the webhook has a secret. The capability advertises no custom actions.
  • analysis — Project Doctor checks that the edge and link exist and match the integration options, with a one-click repair. With the api_token, it also checks that Grafana accepts the token, that alert rules carry the label, and that a dashboard has the <label>:<value> tag (for example service:my-api-V1StGXR8_Z5jdHi6B-myT).
  • workflow-steps — gather_metrics and metric_threshold run PromQL through a Prometheus data source. When the workflow gives the step a project, $project in the query is the project identifier, for example sum(rate(http_requests_total{service="$project"}[5m])). The metric label name can differ from the alert rule label.

Options: service_url (the Grafana URL, required), org_id (the Grafana organization ID, required; the token must belong to it), and label (the alert rule label that names the project, default service).

The Imbi host discovers the package by scanning imbi.plugins.* and reads the module-level PLUGIN attribute; there are no entry points. All plugin base classes come from imbi.common.plugins.

The delivery

A Grafana webhook contact point sends its default JSON payload, one request for each notification group:

{
  "receiver": "imbi",
  "status": "firing",
  "alerts": [
    {
      "status": "firing",
      "labels": {"alertname": "5xx rate high", "service": "webform"},
      "annotations": {"runbook_url": "https://imbi.example.com/..."},
      "startsAt": "...",
      "endsAt": "0001-01-01T00:00:00Z",
      "values": {"B": 12.5},
      "generatorURL": "...",
      "fingerprint": "...",
      "silenceURL": "..."
    }
  ],
  "groupLabels": {},
  "commonLabels": {},
  "commonAnnotations": {},
  "externalURL": "https://grafana.example.com/",
  "groupKey": "...",
  "title": "...",
  "state": "alerting",
  "message": "..."
}

Signature

Turn on HMAC signature on the contact point. Grafana then sends the hex HMAC-SHA256 of the raw body, keyed by the shared secret, in the X-Grafana-Alerting-Signature header. Put the same secret in the Secret field of the Imbi webhook. Leave the contact point's Timestamp Header empty: with it set, Grafana signs <timestamp>:<body> instead, which the gateway does not compute. When the webhook has a secret, the gateway drops a delivery whose signature is missing or does not match. When it has no secret, the gateway processes each delivery unverified and logs a warning one time for each webhook in each process. The header name and prefix are the SIGNATURE_HEADER and SIGNATURE_PREFIX constants in imbi.plugins.grafana.plugin.

Development

moon run root:setup     # uv sync + pre-commit hooks
moon run grafana:test   # coverage (fails under 85%)
moon run grafana:lint grafana:typecheck grafana:format   # ruff + basedpyright + format check

Only the workflow steps and the live doctor checks call Grafana. They need the optional api_token credential (a service account token with the Viewer role) and send requests only to service_url. They use these Grafana APIs:

License

BSD-3-Clause.

Metadata

Release files for imbi-plugin-grafana 2.66.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for imbi-plugin-grafana 2.66.0
File Size Uploaded Provenance Actions
imbi_plugin_grafana-2.66.0.tar.gz 18.8 kB With provenance Details for imbi_plugin_grafana-2.66.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for imbi-plugin-grafana 2.66.0
File Interpreter ABI Platform Actions
imbi_plugin_grafana-2.66.0-py3-none-any.whl Python 3 none any Details for imbi_plugin_grafana-2.66.0-py3-none-any.whl

Total release size: 34.9 kB

Release files / imbi_plugin_grafana-2.66.0.tar.gz

Download URL imbi_plugin_grafana-2.66.0.tar.gz
Size 18.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d9d65fb7ed2e206be0bec949dd38bcd85e232750477a730e0361ac15868ed73b
BLAKE2b-256 checksum
How to use checksums
dc7040b688820595eece58fd40db861ce78be7d38baa46e8878192a424e37f61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / imbi_plugin_grafana-2.66.0-py3-none-any.whl

Download URL imbi_plugin_grafana-2.66.0-py3-none-any.whl
Size 16.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b3f1dd36d783e9f5194abfcfdd762f6003a82b23f9e18c0026b9fc8c954bc50
BLAKE2b-256 checksum
How to use checksums
72a56cadd8958f82c4b99dbb289d11d8c20031e2bbebfaf041540d14e9611ea1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for imbi-plugin-grafana 2.66.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for imbi_plugin_grafana-2.66.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page