grafana-util alert import
What this page covers
Import alerting resource JSON files through the Grafana API.
When to open this page
- Recreate an exported alert bundle in Grafana.
- Update existing alert resources with --replace-existing.
- Preview import actions before making changes.
Who this page is for
Best for operators who review alert rules, routes, contact points, and staged alert changes.
Purpose
Import alerting resource JSON files through the Grafana API.
When to use
- Recreate an exported alert bundle in Grafana.
- Update existing alert resources with
--replace-existing. - Preview import actions before making changes.
Key flags
--input-dirpoints at theraw/export directory.--replace-existingupdates resources with matching identities.--dry-runpreviews the import.--jsonrenders dry-run output as structured JSON.--dashboard-uid-mapand--panel-id-maprepair linked alert rules during import.
Before / After
- Before: recreate alert resources manually or paste JSON back into Grafana one object at a time.
- After: import one export bundle and let the command handle the resource set as a unit.
What success looks like
- Dry-run output matches the resources you intended to import.
- Live import restores the expected rules, contact points, mute timings, templates, and policies.
- Dashboard-linked alert rules still point at the right dashboards or panels after mapping.
Failure checks
- Make sure
--input-dirpoints at theraw/directory, not the parent export folder. - If dashboard-linked rules move, supply the dashboard and panel mapping flags before importing.
- Use
--replace-existingonly when you expect to overwrite matching live resources.
Examples
# Purpose: Import alerting resource JSON files through the Grafana API.
grafana-util alert import --url http://localhost:3000 --input-dir ./alerts/raw --replace-existing
# Purpose: Import alerting resource JSON files through the Grafana API.
grafana-util alert import --url http://localhost:3000 --input-dir ./alerts/raw --replace-existing --dry-run --json