Skip to content
grafana logo

Grafana

grafana

Grafana is an open-source tool for creating dashboards to visualize and query metrics, logs, and traces from various dat

SKILL.md

Full skill instructions

grafana

Purpose

Grafana is an open-source platform for visualizing and querying metrics, logs, and traces from various data sources. It enables users to create interactive dashboards, set up alerts, and explore data to monitor systems effectively.

When to Use

Use Grafana when you need to build custom dashboards for real-time monitoring of infrastructure, applications, or services. It's ideal for scenarios involving observability, such as tracking Kubernetes metrics, analyzing server logs, or correlating traces in distributed systems. Avoid it for simple static reporting; opt for it when dynamic querying and visualization are required.

Key Capabilities

  • Create and manage dashboards with panels for graphs, tables, and gauges.
  • Integrate with data sources like Prometheus, Loki, Elasticsearch via plugins.
  • Set up alerting rules based on thresholds for metrics or logs.
  • Support for ad-hoc queries and exploration using query languages like PromQL.
  • Role-based access control (RBAC) for securing dashboards and data.
  • Export/​import dashboards in JSON format for versioning.

Usage Patterns

To run Grafana as a server, start it with a configuration file: specify the config path and bind to a port. For automation, use the API to create dashboards programmatically. Common pattern: Ingest data from Prometheus, then query it via Grafana's UI or API. For CI/​CD, embed Grafana in workflows to generate dashboards on-the-fly. Always run it in a containerized environment for scalability, e.g., using Docker with the official image.

Common Commands/​API

Use the Grafana CLI for administrative tasks. To start the server: grafana-server --config /​etc/​grafana/​grafana.ini --homepath /​usr/​share/​grafana. For plugins, run grafana-cli plugins install <plugin-name>.

API endpoints require authentication via API keys. Set your key as an environment variable: export GRAFANA_API_KEY=$YOUR_API_KEY. Then, use curl for requests.

Example: Create a dashboard via API:

curl -H "Authorization: Bearer $GRAFANA_API_KEY" -X POST https://your-grafana-instance/​api/​dashboards/​db -d '{"dashboard": {"id": null, "uid": null, "title": "New Dashboard", "tags": ["example"], "timezone": "browser", "panels": []}, "folderId": 0, "overwrite": false}'

Query a data source: GET https://your-grafana-instance/​api/​datasources/​1. Config files are in INI format, e.g.:

[server]
http_port = 3000

Integration Notes

Integrate Grafana with data sources by adding them via the UI or configuration. For Prometheus, add a data source with URL: http://prometheus:9090 and enable basic auth if needed. Use environment variables for secrets, e.g., GF_SECURITY_ADMIN_PASSWORD=$ADMIN_PASSWORD. For alerting, link to notification channels like Slack or PagerDuty in the config: add under [alerting] section in grafana.ini.

To embed in other tools, use the iframe embed option for dashboards. For code integrations, import Grafana dashboards in Terraform: define a resource like resource "grafana_dashboard" "example" { config_json = file("dashboard.json") }. Ensure data sources are provisioned first via Grafana's provisioning YAML files, e.g.:

apiVersion: 1
datasources:
  - name: Prometheus
    type: prometheus
    url: http://prometheus:9090

Error Handling

Common errors include connection failures to data sources; check logs with journalctl -u grafana-server or view in the UI under Server Admin > Logs. For API errors (e.g., 401 Unauthorized), verify the API key with echo $GRAFANA_API_KEY and ensure it's not expired. Handle query errors by wrapping API calls in try-catch blocks, e.g., in Python:

import requests
try:
    response = requests.post('https://your-grafana-instance/​api/​dashboards/​db', headers={'Authorization': f'Bearer {os.environ["GRAFANA_API_KEY"]}'}, json=data)
    response.raise_for_status()
except requests.exceptions.HTTPError as err:
    print(f"Error: {err.response.status_code} - {err.response.text}")

For configuration issues, validate grafana.ini with grafana-server --config /​path/​to/​config.ini --verify-config.

Concrete Usage Examples

Example 1: Set up a basic Prometheus dashboard. First, start Grafana: docker run -d -p 3000:3000 grafana/​grafana. Log in (default user: admin, password: admin), add a data source via UI: Go to Configuration > Data Sources > Add Prometheus with URL http://your-prometheus-url:9090. Create a dashboard: Add a panel with query up{job="prometheus"}, save it.

Example 2: Automate alert creation via API. Export your API key to env: export GRAFANA_API_KEY=your_key. Send a request to create an alert rule:

curl -H "Authorization: Bearer $GRAFANA_API_KEY" -X POST https://your-grafana-instance/​api/​ruler/​grafana/​default -d '{"name": "High CPU Alert", "condition": "A", "for": "5m", "query": {"params": ["avg", "up", "{job=\"node\"}"], "model": {}}}'

This sets up an alert for high CPU usage based on your metrics.

Graph Relationships

  • Related to: Prometheus (provides metrics data), Loki (handles logs), as part of devops-sre cluster.
  • Connects with: Elasticsearch (for log visualization), Jaeger/​Zipkin (for traces).
  • Dependencies: Often paired with monitoring tools like Alertmanager for full observability workflows.

More DevOps & CI/CD skills

Project scaffolding, deployment configuration, and CI/CD setup for Google ADK agents.

6K 472.6K
View

Set up tracing, logging, and monitoring for deployed ADK agents across Cloud Trace, BigQuery, and third-party platforms.

6K 472.6K
View

Enterprise Azure infrastructure architect generating Bicep or Terraform from workload descriptions.

1.5K 454.3K
View
azure-kubernetes logo
DevOps & CI/CD

azure-kubernetes

Plan and configure production-ready Azure Kubernetes Service clusters with Day-0 and Day-1 best practices.

1.5K 447.1K
View

Raw mechanical interfaces fusing Swiss typographic print with military terminal aesthetics. Rigid grids, extreme type scale contrast, utilitarian color, analog degradation effects. For data-heavy dashboards, portfolios, or editorial sites that need to feel like declassified blueprints.

92.7K 354.9K
View
just-scrape logo
DevOps & CI/CD

just-scrape

Web search, scraping, extraction, crawling, and monitoring via ScrapeGraph AI CLI.

69 245K
View

Skill for working with Firebase Hosting (Classic). Use this when you want to deploy static web apps, Single Page Apps (SPAs), or simple microservices. Do NOT use for Firebase App Hosting.

462 159.7K
View

Deploy and manage web apps with Firebase App Hosting. Use this skill when deploying Next.js/Angular apps with backends.

462 159.1K
View
deploy-to-vercel logo
DevOps & CI/CD

deploy-to-vercel

Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".

31.9K 146.6K
View
programmatic-seo logo
DevOps & CI/CD

programmatic-seo

Build SEO-optimized pages at scale using templates, data, and proven playbook patterns.

53.3K 140.1K
View

Design and build isolated, reusable Convex backend components with clear boundaries and app-facing wrappers.

63 123.5K
View

Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".

31.9K 116.1K
View

Coding & apps AI tools

Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View
I
Coding & apps

Imagica

Build a no-code AI app in minutes.

Freemium
View
E
Coding & apps

Emergent.sh

An IDE for code migration from legacy to modern frameworks through coding agents.

Freemium
View
Wonder Dynamics logo
Coding & apps

Wonder Dynamics

Automate CGI animation in live-action scenes

Paid
View
M
Coding & apps

Mixo

Launch a website in seconds with AI.

Paid
View
AI Code Convert logo
Coding & apps

AI Code Convert

Streamline Your Coding Experience with AI Code Helper

Free
View