Agent Skillsgrafana/skills › grafana-oss

grafana-oss

GitHub

用于配置Grafana OSS,支持通过YAML自动化配置数据源、仪表盘及插件,管理RBAC角色与服务账户令牌,调整服务器配置,并提供API健康检查以验证配置生效。

skills/grafana-core/grafana-oss/SKILL.md grafana/skills

Trigger Scenarios

配置Prometheus/Loki等数据源 从Git或磁盘自动预置仪表盘 创建服务账户并生成访问令牌 配置SSO/OAuth或SMTP 排查仪表盘未显示问题

Install

npx skills add grafana/skills --skill grafana-oss -g -y
More Options

Non-standard path

npx skills add https://github.com/grafana/skills/tree/main/skills/grafana-core/grafana-oss -g -y

Use without installing

npx skills use grafana/skills@grafana-oss

指定 Agent (Claude Code)

npx skills add grafana/skills --skill grafana-oss -a claude-code -g -y

安装 repo 全部 skill

npx skills add grafana/skills --all -g -y

预览 repo 内 skill

npx skills add grafana/skills --list

SKILL.md

Frontmatter
{
    "name": "grafana-oss",
    "license": "Apache-2.0",
    "description": "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\"."
}

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)

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: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.mdgrafana.ini server / database / SMTP / auth / security / feature-toggle config + restart-required issues

Version History

  • b583762 Current 2026-07-06 00:35

Same Skill Collection

skills/grafana-app-sdk/admission-control/SKILL.md
skills/grafana-cloud/loki-label-analyzer/SKILL.md
skills/grafana-cloud/send-data/SKILL.md
skills/grafana-datasources/datasources-provisioning/SKILL.md
skills/grafana-lgtm/loki/SKILL.md
skills/grafana-lgtm/prometheus/SKILL.md
skills/grafana-plugins/audit-and-reduce-dependencies/SKILL.md
skills/grafana-plugins/check-npm/SKILL.md
template/SKILL.md
skills/grafana-app-sdk/app-sdk-concepts/SKILL.md
skills/grafana-app-sdk/cue-kind-definition/SKILL.md
skills/grafana-app-sdk/reconciler-logic/SKILL.md
skills/grafana-cloud/adaptive-metrics/SKILL.md
skills/grafana-cloud/admin/SKILL.md
skills/grafana-cloud/app-observability/SKILL.md
skills/grafana-cloud/assistant-mcp/SKILL.md
skills/grafana-cloud/cloud-integrations/SKILL.md
skills/grafana-cloud/cost-management/SKILL.md
skills/grafana-cloud/database-observability/SKILL.md
skills/grafana-cloud/dpm-finder/SKILL.md
skills/grafana-cloud/fleet-management/SKILL.md
skills/grafana-cloud/infrastructure/SKILL.md
skills/grafana-cloud/ml-ai/SKILL.md
skills/grafana-cloud/oncall-irm/SKILL.md
skills/grafana-cloud/private-connectivity/SKILL.md
skills/grafana-cloud/prometheus-cardinality-troubleshooter/SKILL.md
skills/grafana-cloud/prometheus-label-strategy/SKILL.md
skills/grafana-cloud/synthetic-monitoring-checks/SKILL.md
skills/grafana-cloud/testing/SKILL.md
skills/grafana-core/alerting-irm/SKILL.md
skills/grafana-core/alloy/SKILL.md
skills/grafana-core/beyla/SKILL.md
skills/grafana-core/dashboarding/SKILL.md
skills/grafana-core/opentelemetry/SKILL.md
skills/grafana-core/promql/SKILL.md
skills/grafana-core/skill-authoring/SKILL.md
skills/grafana-k6/k6-cloud-investigate-test/SKILL.md
skills/grafana-k6/k6-docs/SKILL.md
skills/grafana-k6/k6-manage/SKILL.md
skills/grafana-k6/k6-perf-test-website/SKILL.md
skills/grafana-k6/k6-test-maintenance/SKILL.md
skills/grafana-k6/k6-trend-analysis/SKILL.md
skills/grafana-k6/k6/SKILL.md
skills/grafana-lgtm/mimir/SKILL.md
skills/grafana-lgtm/pyroscope/SKILL.md
skills/grafana-lgtm/tempo/SKILL.md
skills/grafana-plugins/grafana-scenes/SKILL.md
skills/grafana-plugins/plugin-bundle-size/SKILL.md
skills/grafana-plugins/react-19-plugin-migration/SKILL.md

Metadata

Files
0
Version
80bb293
Hash
16170b5e
Indexed
2026-07-06 00:35

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-04 04:01
浙ICP备14020137号-1 $Гость$