Generated banner for Grafana Oss
Generated logo for Grafana Oss

Grafana Oss

Grafana LabsOfficialPublished by Grafana Labs

  • Skill
  • Tool integration
  • Cloud and DevOps
  • Apache-2.0
  • Medium risk

From the author

Configure Grafana OSS — provisions dashboards from YAML, sets up data sources (Prometheus / Loki / Tempo / Pyroscope), writes dashboard JSON with template variables, builds panel queries, assigns built-in roles (Viewer / Editor / Admin / GrafanaAdmin), mints service-account tokens, edits grafana.ini server config, creates annotations, installs plugins via provisioning, and validates each step with a health-check curl. Use when building dashboards, configuring data sources, setting up provisioning YAML, picking a panel type, writing template variables, managing users and roles, configuring SMTP/OAuth in grafana.ini, creating annotations via API, troubleshooting why a provisioned dashboard isn't showing up, or running Grafana OSS locally — even when the user says "set up a Prometheus data source", "provision dashboards from git", "make a service account", or "configure SSO in OSS" without saying "Grafana OSS".
— the description by Grafana Labs

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

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/grafana/grafana-oss/download
  2. Unzip 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

Docs: https://grafana.com/docs/grafana/latest.md

Common Workflows

Provisioning dashboards from disk
  1. Drop dashboard JSON file(s) under /var/lib/grafana/dashboards/

  2. Add a provider in provisioning/dashboards/default.yaml (see § Dashboard provisioning below)

  3. Restart Grafana so the provider config is loaded

  4. 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
  1. Write provisioning/datasources/datasources.yaml (see § Data source provisioning below)

  2. Restart Grafana

  3. 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
  1. Provision via YAML or POST /api/serviceaccounts (full API in references/api.md § Users + service accounts)

  2. Mint a token via POST /api/serviceaccounts/{id}/tokens

  3. Verify 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: true

For 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:4040

RBAC (built-in roles)

RolePermissions
ViewerRead dashboards, alerts
EditorCreate/edit dashboards, alerts
AdminManage data sources, users, plugins
GrafanaAdminServer-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:4040

After 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-code

  • references/datasources.md — data source setup and query examples for Prometheus, Loki, Tempo, SQL, CloudWatch, and plugins

  • references/panel-types.md — panel-type table + decision guide for picking the right one

  • references/panels.md — panel editor, visualization options, field config, transformations, query options, inspection, and performance tips

  • references/alerting.md — alerting concepts, contact points, notification policies, templates, silences, and common rule examples

  • references/api.md — full Grafana OSS API reference (dashboards, data sources, users, service accounts, annotations) with verification curls and common failure modes

  • references/config.md — grafana.ini server / database / SMTP / auth / security / feature-toggle config + restart-required issues

Files

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
StateDescription
NormalQuery running; condition not met
PendingCondition met but pending period not yet elapsed
FiringCondition met + pending period elapsed; notifications sent
ResolvedPreviously firing alert returned to normal
No DataQuery returned no data (configurable behavior)
ErrorQuery 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 immediately

  • 5m = 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

  • 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 > 80 or ($A + $B) / 2

  • Reduce: 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
SettingDescription
FolderOrganize rules; folder is the RBAC boundary
Evaluation groupGroup name (all rules share this group's interval)
Evaluation intervalHow often the rule is evaluated (e.g., 1m)
Pending periodHow long condition must hold before firing (e.g., 5m)
Keep firing forHow 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=production

Annotations - 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-high

Notification 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
SituationOptions
No dataAlerting, OK, No Data state, Keep last state
Query errorAlerting, OK, Error state, Keep last state

Contact Points

Contact points are notification destinations.

Navigate to: Alerting > Contact points

Supported integrations
IntegrationNotes
EmailRequires SMTP config in grafana.ini
SlackWebhook URL or API token + channel
PagerDutyIntegration key
OpsGenieAPI key
VictorOps (Splunk)API key
Microsoft TeamsIncoming webhook URL
DiscordWebhook URL
TelegramBot token + chat ID
WebhookHTTP POST to custom URL
AlertmanagerForward to external Alertmanager
PushoverUser key + API token
LINELINE 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 Alerts
Webhook 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-dev
Policy settings
SettingDescription
Contact pointWhere to send matching alerts
Continue matchingIf true, also evaluate subsequent sibling policies
Group byLabels used for batching alerts into single notifications
Group waitWait before sending first notification for a new group (default: 30s)
Group intervalWait before sending updates for an existing group (default: 5m)
Repeat intervalWait 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 firing
Example 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
  1. Click Add silence

  2. Set start time and end time (or duration)

  3. Add label matchers:

    alertname = HighCPU
    instance =~ ".*staging.*"   # Regex match
    severity != critical         # Negative match
  4. Add a comment explaining why

  5. 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:00

Attach to notification policies in the policy settings.


RBAC for Alerting

Default permissions by role:

ActionViewerEditorAdmin
View alert rulesYesYesYes
Create/edit alert rulesNoYesYes
Delete alert rulesNoNoYes
Manage contact pointsNoNoYes
Manage notification policiesNoNoYes
Create silencesNoYesYes

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:587

Common 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=warning
Memory usage
# Query A
(1 - (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes)) * 100
# Threshold: A > 90
HTTP 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 > 5
Disk space
# Query A
(1 - (node_filesystem_free_bytes{fstype!="tmpfs"} / node_filesystem_size_bytes{fstype!="tmpfs"})) * 100
# Threshold: A > 85
Service 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 > 10

Connecting Alerts to Dashboards

Create alert from panel
  1. Open panel editor

  2. Click Alert tab

  3. Click Create alert rule from this panel

  4. Pre-populates query from the 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 = 60s

Multiple 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