Command Palette

Search for a command to run...

Назад к скиллам
скилл № 21198

grafana

Grafana is an open-source visualization and dashboarding platform that connects to dozens of data sources including Prometheus, PostgreSQL, ClickHouse, and…

БесплатноБез исполняемых скриптов
TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Установить grafana в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Grafana

Overview

Grafana is an open-source platform for dashboards, alerting and exploring metrics, logs and traces. It queries data sources (Prometheus, PostgreSQL, ClickHouse, Loki, Elasticsearch and dozens more) at view time and renders the results as panels. Everything can be kept as code: data sources, dashboards, alert rules and contact points are provisioned from YAML and JSON files on startup. The current release line is 13.x; this skill uses the open-source grafana/grafana image.

Instructions

Run Grafana with Docker

services:
  grafana:
    image: grafana/grafana:13.2.4   # pin a version; check hub.docker.com/r/grafana/grafana
    ports:
      - "127.0.0.1:3000:3000"
    environment:
      GF_SECURITY_ADMIN_USER: admin
      GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_ADMIN_PASSWORD}   # set in .env, not in git
      GF_PLUGINS_PREINSTALL: grafana-clickhouse-datasource
      PG_PASSWORD: ${PG_PASSWORD}
      CH_PASSWORD: ${CH_PASSWORD}
      SLACK_WEBHOOK_URL: ${SLACK_WEBHOOK_URL}
    volumes:
      - grafana-data:/var/lib/grafana
      - ./provisioning:/etc/grafana/provisioning

volumes:
  grafana-data:
echo "GRAFANA_ADMIN_PASSWORD=$(openssl rand -base64 18)" >> .env   # also set PG_PASSWORD, CH_PASSWORD, SLACK_WEBHOOK_URL
docker compose up -d

Open http://localhost:3000. GF_PLUGINS_PREINSTALL installs plugins at startup (comma-separated, name@version to pin). The old grafana-cli and grafana-server binaries were removed in Grafana 13; use grafana cli plugins install <id> and grafana server.

Provision data sources

Files in provisioning/datasources/ load at startup. Give each source a fixed uid: dashboards and alert rules refer to it, and an auto-generated uid breaks them when you rebuild.

# provisioning/datasources/datasources.yml
apiVersion: 1

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

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

  - name: ClickHouse
    uid: clickhouse
    type: grafana-clickhouse-datasource
    jsonData:
      host: clickhouse
      port: 9000
      protocol: native
      defaultDatabase: default
      username: grafana_reader
    secureJsonData:
      password: "${CH_PASSWORD}"

${VAR} is expanded from Grafana's environment. Use read-only database users.

Build panels

Time Series Panel with Prometheus

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

Template Variables

A query variable gives users a dropdown:

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

Reference it with $event_name and bound the time range with $__timeFilter:

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

Provision alert rules and contact points

Alert rules are a pipeline of refIds: a query (A), a reduce step (B) turns the series into a number, and a threshold (C) is the condition.

apiVersion: 1

groups:
  - orgId: 1
    name: production-alerts
    folder: Production
    interval: 1m
    rules:
      - uid: high-error-rate
        title: High Error Rate
        condition: C
        for: 5m
        noDataState: NoData
        execErrState: Error
        data:
          - refId: A
            relativeTimeRange: { from: 600, to: 0 }
            datasourceUid: prometheus
            model:
              refId: A
              expr: sum(rate(http_requests_total{status_code=~"5.."}[5m])) / sum(rate(http_requests_total[5m]))
              instant: false
              intervalMs: 1000
              maxDataPoints: 43200
          - refId: B
            datasourceUid: __expr__
            model:
              refId: B
              type: reduce
              expression: A
              reducer: last
          - refId: C
            datasourceUid: __expr__
            model:
              refId: C
              type: threshold
              expression: B
              conditions:
                - evaluator: { type: gt, params: [0.05] }
        labels:
          severity: critical
        annotations:
          summary: "Error rate is above 5%"
apiVersion: 1

contactPoints:
  - orgId: 1
    name: slack-engineering
    receivers:
      - uid: slack-eng
        type: slack
        settings:
          url: "${SLACK_WEBHOOK_URL}"
          recipient: "#engineering-alerts"
          title: '{{
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • _scores.json

FAQ

Что делает скилл grafana?

Grafana is an open-source visualization and dashboarding platform that connects to dozens of data sources including Prometheus, PostgreSQL, ClickHouse, and Elasticsearch. It lets you build interactive dashboards with panels, set up alerting rules, and manage everything as code through JSON dashboard definitions and provisioning configuration.

Как установить скилл grafana?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл grafana запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить grafana с