From grafana
Avoid common Grafana mistakes — query pitfalls, variable templating, alerting traps, and provisioning gotchas. Also use for querying Grafana API and Loki directly via HTTP.
How this skill is triggered — by the user, by Claude, or both
Slash command
/grafana:grafanaThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
```bash
GRAFANA_URL="http://localhost:3000"
GRAFANA_AUTH="admin:${GRAFANA_PASSWORD}" # ou token
# Health check
curl -s "$GRAFANA_URL/api/health" | jq .
# List dashboards
curl -s -u "$GRAFANA_AUTH" "$GRAFANA_URL/api/search" | jq '.[] | {id, title, url}'
# Get dashboard by UID
curl -s -u "$GRAFANA_AUTH" "$GRAFANA_URL/api/dashboards/uid/UID" | jq '.dashboard.panels[].title'
# List datasources
curl -s -u "$GRAFANA_AUTH" "$GRAFANA_URL/api/datasources" | jq '.[] | {id, name, type}'
# Query datasource directly
curl -s -u "$GRAFANA_AUTH" -X POST "$GRAFANA_URL/api/ds/query" \
-H "Content-Type: application/json" \
-d '{"queries":[{"refId":"A","expr":"{job=\"nginx\"}","datasource":{"type":"loki"},"maxLines":100}],"from":"now-1h","to":"now"}'
LOKI_URL="http://localhost:3100"
# Query logs (últimos 100 de nginx)
curl -s "$LOKI_URL/loki/api/v1/query_range" \
--data-urlencode 'query={job="nginx"}' \
--data-urlencode 'start='"$(date -d '1 hour ago' +%s%N)" \
--data-urlencode 'end='"$(date +%s%N)" \
--data-urlencode 'limit=100' | jq '.data.result[].values[][1]'
# Query com filtro de texto
curl -s "$LOKI_URL/loki/api/v1/query_range" \
--data-urlencode 'query={job="nginx"} |= "error"' \
--data-urlencode 'limit=50' | jq '.data.result[].values[][1]'
# Labels disponíveis
curl -s "$LOKI_URL/loki/api/v1/labels" | jq '.data[]'
# Valores de um label
curl -s "$LOKI_URL/loki/api/v1/label/job/values" | jq '.data[]'
# Erros Laravel nas últimas 2h
{job="laravel"} |= "ERROR" | json
# Erros por app
sum by (app) (count_over_time({job="laravel"} |= "ERROR" [1h]))
# Nginx 5xx
{job="nginx"} | regexp `"(?P<status>\d{3})"` | status >= 500
# Timeout Next.js
{job="nginx"} |= "timed out" |= "myapp"
# Top IPs com erros
{job="nginx"} |= "error" | regexp `(?P<ip>[\d.]+)` | count by (ip) > 10
# SSH brute force attempts
{job="auth"} |= "Failed password" | count_over_time[5m] > 5
# OOM kills
{job="syslog"} |= "Out of memory"
# Queries lentas Laravel
{job="laravel"} |= "SLOW"
$__all no regex${var:csv} para comma-separated — ${var:pipe} para pipe-separated em regex$__interval se auto-ajusta ao range — use para aggregation windownetworkidle como waitUntil — SPAs podem nunca atingir idle# Dashboards em /etc/grafana/provisioning/dashboards/
# Datasources em /etc/grafana/provisioning/datasources/
# Reload após mudanças
curl -s -X POST -u admin:$GRAFANA_PASSWORD http://localhost:3000/api/admin/provisioning/dashboards/reload
curl -s -X POST -u admin:$GRAFANA_PASSWORD http://localhost:3000/api/admin/provisioning/datasources/reload
allowEditing: true no yamlnpx claudepluginhub billyfranklim1/claude-skills --plugin grafanaQuery and manage Grafana dashboards, alert rules, and data sources via HTTP API. Useful for viewing dashboards, troubleshooting alerts, checking metrics, or on mentions of Grafana, monitoring, observability.
Configures Grafana OSS including provisioning dashboards from YAML, setting up data sources (Prometheus, Loki, Tempo, Pyroscope), building dashboard JSON with template variables, managing users, roles, service account tokens, annotations, plugins, and server config via provisioning API.
Creates production-ready Grafana dashboards with reusable panels, template variables, and provisioning for version-controlled deployment of Prometheus, Loki, and other data source metrics.