Grafana Oss
Grafana LabsOfficialPublished by Grafana Labs
- Skill
- Tool integration
- Cloud and DevOps
- Apache-2.0
- Medium risk
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides comprehensive guidance for managing Grafana OSS instances. It covers the full lifecycle of configuration, from setting up data sources like Prometheus, Loki, and Tempo to automating dashboard provisioning via YAML files. It also details user and service account management, RBAC role assignments, plugin installation, and server-level configuration via grafana.ini. The skill emphasizes validation through health-check API calls to ensure that provisioned resources are correctly integrated and operational.
What it does
- Provisions dashboards and data sources using YAML configuration files.
- Manages service accounts and mints authentication tokens for API access.
- Configures server settings, including SMTP and OAuth, via grafana.ini.
- Assigns built-in roles such as Viewer, Editor, Admin, and GrafanaAdmin.
- Installs and configures plugins through provisioning workflows.
- Validates configuration success using API-based health checks.
When to use it
- When setting up a new Grafana OSS instance or automating environment configuration.
- When you need to provision dashboards or data sources as code.
- When managing user access, roles, or service account tokens.
- When troubleshooting why a provisioned dashboard or data source is not appearing.
- When configuring server-level settings like authentication or SMTP.
Advantages
- Enables infrastructure-as-code practices for Grafana configuration.
- Provides clear, repeatable steps for common administrative tasks.
- Includes built-in verification steps to confirm configuration success.
- Centralizes documentation for API interactions and YAML schemas.
Usage examples
- “How do I set up a Prometheus data source using a YAML file?”
- The agent provides the specific YAML structure for a Prometheus data source, including the required fields like name, type, and URL, and explains how to verify it via the health-check API.
- “Create a service account for CI/CD with read-only access.”
- The agent provides the YAML configuration for the service account with the 'Viewer' role and the subsequent API commands to mint a token for that account.
- “My provisioned dashboard isn't showing up in Grafana. How do I debug it?”
- The agent guides you through checking the provisioning logs, verifying the file path, and using the API to confirm if the dashboard UID exists in the system.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/grafana/grafana-oss/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip grafana-oss.zip -d .agents/skills
Documentation by Grafana Labs
Grafana OSS
Common Workflows
Provisioning dashboards from disk
Drop dashboard JSON file(s) under
/var/lib/grafana/dashboards/Add a provider in
provisioning/dashboards/default.yaml(see § Dashboard provisioning below)Restart Grafana so the provider config is loaded
Verify the dashboard landed:
curl https://grafana.example.com/api/dashboards/uid/<uid> \ -H "Authorization: Bearer <token>" | jq '.dashboard.title'Returns the title → success. 404 → provisioning didn't pick it up; check Grafana server logs (
journalctl -u grafana-server | grep -i provisioning) for parse errors.
Provisioning data sources
Write
provisioning/datasources/datasources.yaml(see § Data source provisioning below)Restart Grafana
Health-check the data source via API:
curl https://grafana.example.com/api/datasources/uid/<uid>/health \ -H "Authorization: Bearer <token>" # { "status": "OK", "message": "..." } → working # { "status": "ERROR", ... } → URL unreachable or auth misconfigured
Creating a service account + token
Provision via YAML or
POST /api/serviceaccounts(full API in references/api.md § Users + service accounts)Mint a token via
POST /api/serviceaccounts/{id}/tokensVerify the token works:
curl https://grafana.example.com/api/org \ -H "Authorization: Bearer <new-token>" # 200 + org JSON → token + role assignment work # 401 → token wrong; 403 → role wrong
Dashboard provisioning
# provisioning/dashboards/default.yaml
apiVersion: 1
providers:
- name: default
folder: MyFolder
type: file
disableDeletion: false
updateIntervalSeconds: 30
options:
path: /var/lib/grafana/dashboards
foldersFromFilesStructure: trueFor the dashboard JSON shape itself (panels, queries, template variables), see references/dashboard-json.md.
Data source provisioning
# provisioning/datasources/datasources.yaml
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
url: http://prometheus:9090
isDefault: true
jsonData:
timeInterval: 15s
httpMethod: POST
- name: Loki
type: loki
access: proxy
url: http://loki:3100
- name: Tempo
type: tempo
access: proxy
url: http://tempo:3200
jsonData:
tracesToLogsV2:
datasourceUid: loki_uid
tags: [{ key: "service.name", value: "app" }]
serviceMap:
datasourceUid: prometheus_uid
nodeGraph:
enabled: true
- name: Pyroscope
type: grafana-pyroscope-datasource
url: http://pyroscope:4040RBAC (built-in roles)
| Role | Permissions |
|---|---|
| Viewer | Read dashboards, alerts |
| Editor | Create/edit dashboards, alerts |
| Admin | Manage data sources, users, plugins |
| GrafanaAdmin | Server-wide admin (superuser) |
Service-account provisioning:
# provisioning/access-control/service_accounts.yaml
apiVersion: 1
serviceAccounts:
- name: ci-reader
orgId: 1
role: Viewer
tokens:
- name: ci-token
# expires: optional ISO 8601 timestamp; omit for no-expiry tokens(Custom RBAC roles with fine-grained permissions are Enterprise / Cloud only — see the grafana-cloud/admin skill if you need those.)
Plugin provisioning
# provisioning/plugins/plugins.yaml
apiVersion: 1
apps:
- type: grafana-pyroscope-app
disabled: false
jsonData:
backendUrl: http://pyroscope:4040After restart, verify via GET /api/plugins/<plugin-id>/health.
References
references/dashboard-json.md— full dashboard JSON model + template variables + common problems (uid uniqueness, gridPos arithmetic, datasource uid matching)references/dashboards.md— dashboard workflows, settings, variables, annotations, sharing, versions, playlists, and provisioning-as-codereferences/datasources.md— data source setup and query examples for Prometheus, Loki, Tempo, SQL, CloudWatch, and pluginsreferences/panel-types.md— panel-type table + decision guide for picking the right onereferences/panels.md— panel editor, visualization options, field config, transformations, query options, inspection, and performance tipsreferences/alerting.md— alerting concepts, contact points, notification policies, templates, silences, and common rule examplesreferences/api.md— full Grafana OSS API reference (dashboards, data sources, users, service accounts, annotations) with verification curls and common failure modesreferences/config.md—grafana.iniserver / database / SMTP / auth / security / feature-toggle config + restart-required issues
Files
- ATTRIBUTION.mdAdded by AutoGineer842 B
- LICENSELicence file added by AutoGineer11.1 KiB
- SKILL.md6.0 KiB
- references/alerting.md11.2 KiB
- references/api.md2.7 KiB
- references/config.md2.3 KiB
- references/dashboard-json.md2.1 KiB
- references/dashboards.md6.1 KiB
- references/datasources.md9.8 KiB
- references/panel-types.md1.2 KiB
- references/panels.md10.3 KiB
references/alerting.md
Grafana Alerting - Detailed Reference
Overview
Grafana Alerting is a unified alerting system for monitoring metrics and logs across multiple data sources. It fires notifications when conditions are breached.
Key capabilities:
Query multiple data sources in a single alert rule
Multi-dimensional alerts (one rule creates many alert instances)
Flexible notification routing via policies
Silences and mute timings for planned maintenance
Alert history and state tracking
Core Concepts
Alert Rule
Defines what to monitor and when to fire. Contains: queries, a condition (threshold), an evaluation interval, and a pending period.
Alert Instance
When a rule produces multi-dimensional data, it creates one alert instance per unique label combination. Example: an alert on cpu_usage{host=~".*"} creates one instance per host.
Alert States
| State | Description |
|---|---|
| Normal | Query running; condition not met |
| Pending | Condition met but pending period not yet elapsed |
| Firing | Condition met + pending period elapsed; notifications sent |
| Resolved | Previously firing alert returned to normal |
| No Data | Query returned no data (configurable behavior) |
| Error | Query failed with an error (configurable behavior) |
Evaluation Group
Alert rules are organized into evaluation groups. All rules in a group share the same evaluation interval and are evaluated sequentially.
Pending Period
How long the condition must be continuously met before firing.
0s= fire immediately5m= must be in breach for 5 continuous minutes
Keep Firing For
How long an alert continues firing after the condition resolves (prevents brief recovery from clearing the alert).
Alert Rule Types
Grafana-Managed Rules (Recommended)
Stored in Grafana's database
Can query any data source
Support multi-dimensional alerting
Support expressions (math, reduce, threshold)
Data Source-Managed Rules (Prometheus/Mimir/Loki)
Rules stored in the external system
Evaluated by the external system
Grafana provides UI to manage them
Useful when migrating from Prometheus alerting
Creating Grafana-Managed Alert Rules
Navigate to: Alerting > Alert rules > New alert rule
Step 1: Define query and condition
Write one or more queries (labeled A, B, C...).
Example with Prometheus:
# Query A: CPU usage per host
100 - (avg by(instance) (rate(node_cpu_seconds_total{mode="idle"}[5m])) * 100)Expression types you can add after queries:
Math:
$A > 80or($A + $B) / 2Reduce: Collapse time series to single value (Last, Mean, Sum, Max, Min)
Resample: Change time resolution
Classic conditions: Multiple threshold conditions with AND/OR
Threshold: Set the firing threshold
Step 2: Set evaluation behavior
| Setting | Description |
|---|---|
| Folder | Organize rules; folder is the RBAC boundary |
| Evaluation group | Group name (all rules share this group's interval) |
| Evaluation interval | How often the rule is evaluated (e.g., 1m) |
| Pending period | How long condition must hold before firing (e.g., 5m) |
| Keep firing for | How long alert stays firing after recovery |
Step 3: Configure labels and notifications
Labels - Key-value pairs attached to alert instances. Used for routing and grouping:
severity=critical
team=infrastructure
service=database
environment=productionAnnotations - Context included in notification messages:
Summary: CPU usage above 80% on {{ $labels.instance }}
Description: CPU usage is {{ $values.A.Value | humanize }}% on {{ $labels.instance }}
Runbook URL: https://runbooks.company.com/cpu-highNotification settings:
Set a Contact point to send directly, bypassing the routing policy tree
Or leave empty to use the notification policy routing tree
Step 4: No data and error handling
| Situation | Options |
|---|---|
| No data | Alerting, OK, No Data state, Keep last state |
| Query error | Alerting, OK, Error state, Keep last state |
Contact Points
Contact points are notification destinations.
Navigate to: Alerting > Contact points
Supported integrations
| Integration | Notes |
|---|---|
| Requires SMTP config in grafana.ini | |
| Slack | Webhook URL or API token + channel |
| PagerDuty | Integration key |
| OpsGenie | API key |
| VictorOps (Splunk) | API key |
| Microsoft Teams | Incoming webhook URL |
| Discord | Webhook URL |
| Telegram | Bot token + chat ID |
| Webhook | HTTP POST to custom URL |
| Alertmanager | Forward to external Alertmanager |
| Pushover | User key + API token |
| LINE | LINE Notify token |
Email configuration in grafana.ini
[smtp]
enabled = true
host = smtp.gmail.com:587
user = [email protected]
password = app-password
from_address = [email protected]
from_name = Grafana AlertsWebhook payload format
Grafana POSTs a JSON payload to webhook endpoints:
{
"receiver": "webhook-receiver",
"status": "firing",
"alerts": [
{
"status": "firing",
"labels": { "alertname": "HighCPU", "instance": "server1" },
"annotations": { "summary": "CPU above 80%" },
"startsAt": "2024-01-15T10:00:00Z",
"generatorURL": "http://grafana/alerting/..."
}
],
"groupLabels": { "alertname": "HighCPU" },
"externalURL": "http://grafana"
}Notification Policies
Notification policies route alerts to contact points based on label matchers.
Navigate to: Alerting > Notification policies
Default policy
The root policy - all alerts reach here if no specific policy matches.
Child policies
Add policies that match specific labels:
Match labels:
severity = critical -> contact: pagerduty
team = infrastructure -> contact: slack-infra
environment = staging -> contact: email-devPolicy settings
| Setting | Description |
|---|---|
| Contact point | Where to send matching alerts |
| Continue matching | If true, also evaluate subsequent sibling policies |
| Group by | Labels used for batching alerts into single notifications |
| Group wait | Wait before sending first notification for a new group (default: 30s) |
| Group interval | Wait before sending updates for an existing group (default: 5m) |
| Repeat interval | Wait before re-sending for still-firing alerts (default: 4h) |
Grouping
When multiple alerts have the same "group by" labels, they are batched into a single notification. This prevents notification storms.
Example:
50 hosts alert on HighCPU simultaneously
Group by:
[alertname, datacenter]Result: 1 notification per datacenter containing all affected hosts
Notification Templates
Customize notification message format using Go templating.
Navigate to: Alerting > Contact points > Notification templates
Built-in variables
{{ $labels }} # Alert labels as map
{{ $values }} # Query values map
{{ $labels.instance }} # Specific label value
{{ $values.A.Value }} # Specific query value
{{ $status }} # firing or resolved
{{ $startsAt }} # When alert started firingExample Slack template
{{ define "slack_message" }}
{{ if eq .Status "firing" }}:red_circle:{{ else }}:large_green_circle:{{ end }} *{{ .Labels.alertname }}*
*Status:* {{ .Status }}
*Severity:* {{ .Labels.severity }}
{{ range .Alerts }}
*Instance:* {{ .Labels.instance }}
*Value:* {{ .Values.A.Value | humanize }}
*Summary:* {{ .Annotations.summary }}
{{ end }}
{{ end }}Humanize functions
{{ $value | humanize }} # "12.3k"
{{ $value | humanize1024 }} # "12.3Ki"
{{ $value | humanizeBytes }} # "12.3 kB"
{{ $value | humanizeDuration }} # "3h 2m 1s"
{{ $value | humanizePercentage }} # "12.3%"Silences
Silences temporarily suppress alert notifications without stopping alert evaluation.
Navigate to: Alerting > Silences
Create a silence
Click Add silence
Set start time and end time (or duration)
Add label matchers:
alertname = HighCPU instance =~ ".*staging.*" # Regex match severity != critical # Negative matchAdd a comment explaining why
Save
Use cases
Planned maintenance windows
Known issues being investigated
Silencing noisy alerts during deploys
From a firing alert detail view: click Silence to pre-populate label matchers.
Mute Timings
Recurring schedules when notifications are suppressed (unlike silences which are one-time).
Navigate to: Alerting > Mute timings
Example mute timings
Name: no-alerts-weekends
Weekdays: Saturday, Sunday
Name: business-hours-only
Weekdays: Monday-Friday
Times: 09:00-17:00Attach to notification policies in the policy settings.
RBAC for Alerting
Default permissions by role:
| Action | Viewer | Editor | Admin |
|---|---|---|---|
| View alert rules | Yes | Yes | Yes |
| Create/edit alert rules | No | Yes | Yes |
| Delete alert rules | No | No | Yes |
| Manage contact points | No | No | Yes |
| Manage notification policies | No | No | Yes |
| Create silences | No | Yes | Yes |
grafana.ini Alerting Configuration
[unified_alerting]
# Enable unified alerting (default: true since Grafana 9)
enabled = true
# Maximum alert instances a single rule can produce
max_annotations_to_keep = 100
# Evaluation timeout
evaluation_timeout = 30s
# Minimum evaluation interval (prevent too-frequent evaluation)
min_interval = 10s
[smtp]
# Required for email contact points
enabled = true
host = smtp.example.com:587Common Alert Rule Examples
CPU usage above threshold
# Query A
100 - (avg by(instance) (rate(node_cpu_seconds_total{mode="idle"}[5m])) * 100)
# Threshold: A > 80
# Pending: 5m
# Labels: severity=warningMemory usage
# Query A
(1 - (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes)) * 100
# Threshold: A > 90HTTP error rate
# Query A: error requests
sum(rate(http_requests_total{status=~"5.."}[5m]))
# Query B: total requests
sum(rate(http_requests_total[5m]))
# Expression C (Math): $A / $B * 100
# Threshold: C > 5Disk space
# Query A
(1 - (node_filesystem_free_bytes{fstype!="tmpfs"} / node_filesystem_size_bytes{fstype!="tmpfs"})) * 100
# Threshold: A > 85Service down (no data = firing)
# Query A
up{job="my-service"}
# Threshold: A < 1
# No data handling: Alerting (treat absence as firing)Loki log error rate
# Query A
sum(rate({job="api"} |= "ERROR" [5m]))
# Threshold: A > 10Connecting Alerts to Dashboards
Create alert from panel
Open panel editor
Click Alert tab
Click Create alert rule from this panel
Pre-populates query from the panel
Link alert to dashboard panel
In the alert rule definition, set Dashboard and Panel to link to a specific visualization. The alert state badge appears on the panel and clicking it goes to the alert rule.
High Availability (HA) Alerting
[unified_alerting]
ha_peers = grafana-1:9094,grafana-2:9094,grafana-3:9094
ha_advertise_address = ${POD_IP}:9094
ha_peer_timeout = 15s
ha_gossip_interval = 200ms
ha_push_pull_interval = 60sMultiple Grafana instances share state to avoid duplicate notifications.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs network access
Security
What our scanner noticed· Medium risk
- References to credential files
- Instructions that use the network
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Grafana Labs
- Publisher
- Grafana Labs (Official)
- Source
- grafana/skills · skills/grafana-core/grafana-oss · commit 8fb72a5
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Grafana Labs or Grafana Labs.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download grafana-oss.zip