grafana/skills

send-data

Sending telemetry data to Grafana Cloud — metrics via Prometheus remote write or OTLP, logs via Loki push or Alloy, traces via OTLP to Tempo, profiles via Pyroscope.

Voir la source
Document Skill original

Rendu depuis le dépôt source en conservant titres, exemples, code, tableaux, liens et images.

Sending Data to Grafana Cloud

Docs: https://grafana.com/docs/grafana-cloud/send-data/

Quick Start: Find Your Credentials

In Grafana Cloud portal → My AccountStackDetails:

SignalCredential Fields
MetricsPrometheus remote write URL, username, password/API key
LogsLoki URL, username, password/API key
TracesTempo OTLP endpoint, username, password/API key
ProfilesPyroscope URL, username, password/API key

Alloy (Recommended — All Signals)

alloy
// METRICS
prometheus.scrape "app" {
  targets    = [{"__address__" = "localhost:8080"}]
  forward_to = [prometheus.remote_write.cloud.receiver]
}

prometheus.remote_write "cloud" {
  endpoint {
    url = "https://prometheus-prod-xx.grafana.net/api/prom/push"
    basic_auth {
      username = sys.env("PROM_USER")
      password = sys.env("GRAFANA_CLOUD_API_KEY")
    }
  }
}

// LOGS
loki.source.file "app" {
  targets = [{__path__ = "/var/log/app/*.log", job = "app"}]
  forward_to = [loki.write.cloud.receiver]
}

loki.write "cloud" {
  endpoint {
    url = "https://logs-prod-xx.grafana.net/loki/api/v1/push"
    basic_auth {
      username = sys.env("LOKI_USER")
      password = sys.env("GRAFANA_CLOUD_API_KEY")
    }
  }
}

// TRACES (OTLP receive → forward)
otelcol.receiver.otlp "default" {
  grpc { endpoint = "0.0.0.0:4317" }
  http { endpoint = "0.0.0.0:4318" }
  output {
    traces = [otelcol.exporter.otlp.cloud.input]
  }
}

otelcol.exporter.otlp "cloud" {
  client {
    endpoint = "tempo-prod-xx.grafana.net:443"
    auth = otelcol.auth.basic.cloud.handler
  }
}

otelcol.auth.basic "cloud" {
  username = sys.env("TEMPO_USER")
  password = sys.env("GRAFANA_CLOUD_API_KEY")
}

Direct Prometheus Remote Write

yaml
# prometheus.yml
remote_write:
  - url: https://prometheus-prod-xx.grafana.net/api/prom/push
    basic_auth:
      username: "123456"
      password: "your-api-key"
    write_relabel_configs:
      - source_labels: [__name__]
        regex: "go_.*"
        action: drop   # optional: drop high-cardinality metrics

Direct Loki Push (curl)

bash
curl -X POST https://logs-prod-xx.grafana.net/loki/api/v1/push \
  -H "Content-Type: application/json" \
  -u "123456:your-api-key" \
  -d '{
    "streams": [{
      "stream": { "app": "myapp", "env": "prod" },
      "values": [
        ["1706745600000000000", "application started"]
      ]
    }]
  }'

OpenTelemetry SDK → Grafana Cloud

bash
# Environment variables for OTLP export
export OTEL_EXPORTER_OTLP_ENDPOINT="https://otlp-gateway-prod-xx.grafana.net/otlp"
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Basic $(echo -n '123456:your-api-key' | base64)"
export OTEL_SERVICE_NAME="my-service"

Python example:

python
from opentelemetry import trace
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor

provider = TracerProvider()
exporter = OTLPSpanExporter()  # reads OTEL_EXPORTER_OTLP_* env vars
provider.add_span_processor(BatchSpanProcessor(exporter))
trace.set_tracer_provider(provider)

Cloud Integrations

Pre-built integrations for common infrastructure (install from Grafana Cloud UI or API):

bash
# List available integrations
curl https://integrations-api-prod.grafana.net/api/v1/integrations \
  -H "Authorization: Bearer <api-key>"

# Install AWS CloudWatch integration
curl -X POST https://integrations-api-prod.grafana.net/api/v1/integrations/cloudwatch \
  -H "Authorization: Bearer <api-key>" \
  -H "Content-Type: application/json" \
  -d '{"name": "aws-prod", "config": {...}}'

Popular integrations: AWS CloudWatch, Azure Monitor, GCP, Kubernetes, Docker, MySQL, PostgreSQL, Redis, Nginx, Apache, JVM, Node.js, Python, .NET.

Kubernetes Agent Operator

yaml
# values.yaml for grafana/k8s-monitoring Helm chart
cluster:
  name: production

externalServices:
  prometheus:
    host: https://prometheus-prod-xx.grafana.net
    basicAuth:
      username: "123456"
      password:
        secretName: grafana-cloud-secret
        secretKey: api-key

  loki:
    host: https://logs-prod-xx.grafana.net
    basicAuth:
      username: "234567"
      password:
        secretName: grafana-cloud-secret
        secretKey: api-key

metrics:
  enabled: true
  podMonitors:
    enabled: true
  serviceMonitors:
    enabled: true

logs:
  pod_logs:
    enabled: true

traces:
  enabled: true
bash
helm install k8s-monitoring grafana/k8s-monitoring \
  --version 4.1.4 \
  -n monitoring --create-namespace \
  -f values.yaml

API Key Management

bash
# Create API key via Grafana API
curl -X POST https://yourstack.grafana.net/api/auth/keys \
  -H "Content-Type: application/json" \
  -u "admin:adminpassword" \
  -d '{"name": "alloy-writer", "role": "MetricsPublisher", "secondsToLive": 0}'

Roles for data ingestion: MetricsPublisher, LogsPublisher, TracesPublisher, ProfilesPublisher

du même dépôt

Autres Skills

Tous les Skills
grafana
Communauté

alerting-irm

Configure Grafana Alerting, Incident Response Management (IRM), and SLOs end-to-end — provisions Grafana-managed and data-source-managed alert rules, contact points (Slack/PagerDuty/email/webhook), notification policies with hierarchical matchers, silences, mute timings, on-call schedules and escalation chains, incident-management integrations, and SLOs with multi-window burn-rate alerts. Use when configuring alerts, debugging notification routing, setting up on-call rotations, declaring or managing incidents, defining SLOs, provisioning alerting via YAML or API, picking matchers for a notification policy, building a PagerDuty/Slack webhook receiver, or troubleshooting why an alert isn't firing — even when the user says "page me on errors", "alert me when X happens", "route this to the platform team", or "set up an SLO" without naming Alerting or IRM.

installations
5
GitHub Stars
246
Mis à jour
8 sept.
grafana
Communauté

alloy

Build a unified telemetry pipeline with Grafana Alloy — one OpenTelemetry-compatible binary that collects metrics, logs, traces, and profiles and ships to Grafana Cloud / Prometheus / Loki / Tempo / Pyroscope. Covers the Alloy config language (blocks, sys.env, component refs), prometheus.scrape → remotewrite, loki.source.file + loki.process → loki.write, otelcol.receiver.otlp → otelcol.exporter.otlp, pyroscope.scrape, K8s / Docker / EC2 discovery, relabeling, modules (import.file/git/http), clustering, Fleet Management remotecfg, the Alloy UI at :12345, and alloy fmt / alloy validate. Use when writing a config.alloy, replacing Grafana Agent / OTel Collector, scraping K8s pods, parsing logs, ingesting OTLP, or debugging "Alloy isn't sending anything" — even when the user says "set up the agent", "write me a scrape config", "drop these logs before sending", or "OTel collector config" without naming Alloy.

installations
5
GitHub Stars
246
Mis à jour
8 sept.
grafana
Communauté

beyla

Auto-instrument an application's HTTP / gRPC / DB traffic with Grafana Beyla eBPF — no code changes, no SDK, no restart. Covers requirements (Linux 5.8+ with BTF, CAPSYSADMIN, host PID), language matrix (Go / Java / Python / Ruby / Node / .NET / Rust / C++ / PHP), Docker + Helm + DaemonSet install, port- / process- / Kubernetes-metadata discovery, OTLP traces + Prometheus metrics export, routes decorator (cardinality control), trace sampling, and Grafana Cloud via Alloy. Use when adding observability to a service you can't recompile, instrumenting a closed-source binary, getting RED metrics + spans onto Tempo/Mimir without touching the app, or rolling Beyla as a cluster-wide DaemonSet — even when the user says "zero-code APM", "instrument legacy app", "trace this binary", "eBPF observability", or "no SDK" without naming Beyla.

installations
5
GitHub Stars
246
Mis à jour
8 sept.
grafana
Communauté

dashboarding

Build, modify, and ship Grafana dashboards as JSON via the HTTP API — panel types (timeseries / stat / gauge / table / heatmap / logs / traces / node-graph), gridPos 24-column layout, units, thresholds, template + datasource + chained variables, transformations (organize / calculateField / filterByValue), panel + dashboard links with ${field.labels.x} / ${from}, and Loki/Prometheus annotations. Use when scripting dashboard creation, writing the dashboard JSON for a new service, adding a $job dropdown variable, computing an "Error %" column with a transformation, overlaying deploys as annotations, or pushing a dashboard via POST /api/dashboards/db — even when the user says "create a dashboard for this metric", "add a service dropdown", "show errors as percentage", "overlay our deploys", or "export the dashboard JSON" without naming the API or schema. After every API push, verify with the returned version plus a GET on the dashboard UID.

installations
5
GitHub Stars
246
Mis à jour
8 sept.