Grafana

Grafana turns your data into dashboards. It connects to time-series databases, SQL databases, log stores, and cloud services, then lets you build panels that visualize metrics, logs, and traces in a single pane of glass. With alerting built in and dashboard-as-code workflows, it scales from a developer's local setup to a company-wide observability platform.

25 stars

Best use case

Grafana is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Grafana turns your data into dashboards. It connects to time-series databases, SQL databases, log stores, and cloud services, then lets you build panels that visualize metrics, logs, and traces in a single pane of glass. With alerting built in and dashboard-as-code workflows, it scales from a developer's local setup to a company-wide observability platform.

Teams using Grafana should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/grafana/SKILL.md --create-dirs "https://raw.githubusercontent.com/ComeOnOliver/skillshub/main/skills/TerminalSkills/skills/grafana/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/grafana/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How Grafana Compares

Feature / AgentGrafanaStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Grafana turns your data into dashboards. It connects to time-series databases, SQL databases, log stores, and cloud services, then lets you build panels that visualize metrics, logs, and traces in a single pane of glass. With alerting built in and dashboard-as-code workflows, it scales from a developer's local setup to a company-wide observability platform.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Grafana

Grafana turns your data into dashboards. It connects to time-series databases, SQL databases, log stores, and cloud services, then lets you build panels that visualize metrics, logs, and traces in a single pane of glass. With alerting built in and dashboard-as-code workflows, it scales from a developer's local setup to a company-wide observability platform.

This skill covers Docker deployment, configuring data sources, building panels, setting up alerts, and managing dashboards as code with JSON.

## Docker Setup

The simplest way to run Grafana is the official Docker image. This starts Grafana with persistent storage so your dashboards survive restarts.

```yaml
# docker-compose.yml — Grafana with persistent storage and default admin credentials
version: "3.8"

services:
  grafana:
    image: grafana/grafana:latest
    ports:
      - "3000:3000"
    environment:
      - GF_SECURITY_ADMIN_USER=admin
      - GF_SECURITY_ADMIN_PASSWORD=admin
    volumes:
      - grafana-data:/var/lib/grafana
      - ./provisioning:/etc/grafana/provisioning

volumes:
  grafana-data:
```

```bash
# CLI — start Grafana
docker compose up -d
```

Open `http://localhost:3000` and log in with admin/admin. Grafana will prompt you to change the password on first login.

## Data Sources

Data sources are connections to the backends that hold your data. Grafana queries them when rendering panels. You can add them through the UI or provision them with YAML files.

### Provisioning Data Sources

Place YAML files in `provisioning/datasources/` and Grafana loads them automatically on startup. This is the foundation of infrastructure-as-code for Grafana.

```yaml
# provisioning/datasources/datasources.yml — data source provisioning
# Configures Prometheus, PostgreSQL, and ClickHouse connections

apiVersion: 1

datasources:
  - name: Prometheus
    type: prometheus
    access: proxy
    url: http://prometheus:9090
    isDefault: true
    editable: false

  - name: PostgreSQL
    type: postgres
    access: proxy
    url: postgres:5432
    database: app_production
    user: grafana_reader
    secureJsonData:
      password: "${PG_PASSWORD}"
    jsonData:
      sslmode: disable
      maxOpenConns: 10
      postgresVersion: 1500

  - name: ClickHouse
    type: grafana-clickhouse-datasource
    access: proxy
    jsonData:
      host: clickhouse
      port: 9000
      defaultDatabase: default
      protocol: native
    secureJsonData:
      password: ""
```

### Installing Data Source Plugins

Some data sources like ClickHouse require installing a plugin first:

```bash
# CLI — install the ClickHouse data source plugin
docker exec -it grafana grafana-cli plugins install grafana-clickhouse-datasource
docker compose restart grafana
```

## Building Panels

Panels are the building blocks of dashboards. Each panel runs a query against a data source and renders the result as a graph, table, stat, gauge, or other visualization.

### Time Series Panel with Prometheus

A common first panel is a time-series graph showing request rate:

```
# Prometheus query — HTTP request rate per second by status code
sum by (status_code) (rate(http_requests_total[5m]))
```

### Table Panel with ClickHouse

For tabular data, use a ClickHouse query that returns named columns:

```sql
-- ClickHouse query — top 10 features by usage this week
-- Used in a Grafana Table panel
SELECT
    event_name AS feature,
    count() AS total_events,
    uniq(user_id) AS unique_users
FROM events
WHERE created_at >= toStartOfWeek(now())
GROUP BY event_name
ORDER BY total_events DESC
LIMIT 10
```

### Stat Panel with PostgreSQL

Stat panels show a single number. They work well for KPIs:

```sql
-- PostgreSQL query — monthly recurring revenue
-- Used in a Grafana Stat panel with unit set to currency (USD)
SELECT sum(amount) AS mrr
FROM subscriptions
WHERE status = 'active'
  AND period_start <= now()
  AND period_end >= now()
```

### Template Variables

Variables make dashboards interactive. Define a variable from a query, and users can filter panels with a dropdown:

```sql
-- ClickHouse query — variable definition for event names
-- Create as a "Query" type variable named "event_name"
SELECT DISTINCT event_name FROM events ORDER BY event_name
```

Then reference it in panel queries with `$event_name`:

```sql
-- ClickHouse query — filtered event count using template variable
SELECT
    toStartOfHour(created_at) AS time,
    count() AS events
FROM events
WHERE event_name = '$event_name'
    AND $__timeFilter(created_at)
GROUP BY time
ORDER BY time
```

## Alerts

Grafana Alerting evaluates rules on a schedule and fires notifications through contact points like Slack, PagerDuty, or email.

### Provisioning Alert Rules

```yaml
# provisioning/alerting/rules.yml — alert rule provisioning
# Fires when error rate exceeds 5% for 5 minutes

apiVersion: 1

groups:
  - orgId: 1
    name: production-alerts
    folder: Production
    interval: 60s
    rules:
      - uid: high-error-rate
        title: High Error Rate
        condition: C
        data:
          - refId: A
            datasourceUid: prometheus
            model:
              expr: sum(rate(http_requests_total{status_code=~"5.."}[5m]))
          - refId: B
            datasourceUid: prometheus
            model:
              expr: sum(rate(http_requests_total[5m]))
          - refId: C
            datasourceUid: __expr__
            model:
              type: math
              expression: $A / $B
              conditions:
                - evaluator:
                    type: gt
                    params: [0.05]
        for: 5m
        labels:
          severity: critical
        annotations:
          summary: "Error rate is above 5%"
```

### Contact Points

```yaml
# provisioning/alerting/contactpoints.yml — Slack notification channel
apiVersion: 1

contactPoints:
  - orgId: 1
    name: slack-engineering
    receivers:
      - uid: slack-eng
        type: slack
        settings:
          url: "${SLACK_WEBHOOK_URL}"
          channel: "#engineering-alerts"
          title: '{{ .CommonLabels.alertname }}'
          text: '{{ .CommonAnnotations.summary }}'
```

## Dashboard as Code

Grafana dashboards are JSON documents. You can export them from the UI, version control them, and provision them automatically. This is essential for reproducible infrastructure.

### Provisioning Dashboards

Tell Grafana where to find dashboard JSON files:

```yaml
# provisioning/dashboards/dashboards.yml — dashboard provisioning config
apiVersion: 1

providers:
  - name: default
    orgId: 1
    type: file
    disableDeletion: false
    updateIntervalSeconds: 30
    options:
      path: /etc/grafana/provisioning/dashboards/json
      foldersFromFilesStructure: true
```

### Dashboard JSON

A minimal dashboard with one panel:

```json
{
  "__comment": "provisioning/dashboards/json/overview.json — application overview dashboard",
  "uid": "app-overview",
  "title": "Application Overview",
  "timezone": "utc",
  "refresh": "30s",
  "time": { "from": "now-24h", "to": "now" },
  "panels": [
    {
      "id": 1,
      "type": "timeseries",
      "title": "Request Rate",
      "gridPos": { "h": 8, "w": 12, "x": 0, "y": 0 },
      "datasource": { "type": "prometheus", "uid": "prometheus" },
      "targets": [
        {
          "expr": "sum(rate(http_requests_total[5m]))",
          "legendFormat": "requests/s"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "reqps",
          "custom": { "lineWidth": 2, "fillOpacity": 10 }
        }
      }
    },
    {
      "id": 2,
      "type": "stat",
      "title": "Active Users (24h)",
      "gridPos": { "h": 4, "w": 6, "x": 12, "y": 0 },
      "datasource": { "type": "grafana-clickhouse-datasource", "uid": "clickhouse" },
      "targets": [
        {
          "rawSql": "SELECT uniq(user_id) AS value FROM events WHERE created_at >= now() - INTERVAL 1 DAY"
        }
      ]
    }
  ],
  "templating": {
    "list": []
  },
  "schemaVersion": 39
}
```

### Exporting Dashboards

To capture a dashboard you built in the UI as code, use the Grafana HTTP API:

```bash
# CLI — export a dashboard JSON by UID for version control
curl -s -H "Authorization: Bearer $GRAFANA_API_KEY" \
  'http://localhost:3000/api/dashboards/uid/app-overview' \
  | jq '.dashboard' > dashboards/app-overview.json
```

This workflow lets you iterate in the UI, export to JSON, commit to git, and deploy via provisioning — giving you the best of both visual editing and infrastructure-as-code.

Related Skills

grafana-dashboards

25
from ComeOnOliver/skillshub

Create and manage production Grafana dashboards for real-time visualization of system and application metrics. Use when building monitoring dashboards, visualizing metrics, or creating operational observability interfaces.

Azure Managed Grafana Skill

25
from ComeOnOliver/skillshub

This skill provides expert guidance for Azure Managed Grafana. Covers troubleshooting, decision making, limits & quotas, security, configuration, integrations & coding patterns, and deployment. It combines local quick-reference content with remote documentation fetching capabilities.

my-issues

25
from ComeOnOliver/skillshub

List my issues in the current repository

multi-stage-dockerfile

25
from ComeOnOliver/skillshub

Create optimized multi-stage Dockerfiles for any language or framework

msstore-cli

25
from ComeOnOliver/skillshub

Microsoft Store Developer CLI (msstore) for publishing Windows applications to the Microsoft Store. Use when asked to configure Store credentials, list Store apps, check submission status, publish submissions, manage package flights, set up CI/CD for Store publishing, or integrate with Partner Center. Supports Windows App SDK/WinUI, UWP, .NET MAUI, Flutter, Electron, React Native, and PWA applications.

model-recommendation

25
from ComeOnOliver/skillshub

Analyze chatmode or prompt files and recommend optimal AI models based on task complexity, required capabilities, and cost-efficiency

mkdocs-translations

25
from ComeOnOliver/skillshub

Generate a language translation for a mkdocs documentation stack.

migrating-oracle-to-postgres-stored-procedures

25
from ComeOnOliver/skillshub

Migrates Oracle PL/SQL stored procedures to PostgreSQL PL/pgSQL. Translates Oracle-specific syntax, preserves method signatures and type-anchored parameters, leverages orafce where appropriate, and applies COLLATE "C" for Oracle-compatible text sorting. Use when converting Oracle stored procedures or functions to PostgreSQL equivalents during a database migration.

microsoft-skill-creator

25
from ComeOnOliver/skillshub

Create agent skills for Microsoft technologies using Learn MCP tools. Use when users want to create a skill that teaches agents about any Microsoft technology, library, framework, or service (Azure, .NET, M365, VS Code, Bicep, etc.). Investigates topics deeply, then generates a hybrid skill storing essential knowledge locally while enabling dynamic deeper investigation.

microsoft-docs

25
from ComeOnOliver/skillshub

Query official Microsoft documentation to find concepts, tutorials, and code examples across Azure, .NET, Agent Framework, Aspire, VS Code, GitHub, and more. Uses Microsoft Learn MCP as the default, with Context7 and Aspire MCP for content that lives outside learn.microsoft.com.

microsoft-code-reference

25
from ComeOnOliver/skillshub

Look up Microsoft API references, find working code samples, and verify SDK code is correct. Use when working with Azure SDKs, .NET libraries, or Microsoft APIs—to find the right method, check parameters, get working examples, or troubleshoot errors. Catches hallucinated methods, wrong signatures, and deprecated patterns by querying official docs.

microsoft-agent-framework

25
from ComeOnOliver/skillshub

Create, update, refactor, explain, or review Microsoft Agent Framework solutions using shared guidance plus language-specific references for .NET and Python.