Grafana Installation
Simple Docker installtion of Grafana
If you’ve ever set up a monitoring stack and found yourself staring at a list of tools wondering “wait, why do I need all of these?” — you’re not alone. The Grafana ecosystem is powerful, but it can feel like a lot of moving parts at first glance.
This post breaks down each component, what it does, and why it exists in your stack.
The Big Picture
Before diving in, here’s the mental model: data flows from your systems → through collectors → into storage → and finally into dashboards. Each tool owns one part of that pipeline.
Your Systems → [ Exporters / Agents ] → [ Storage ] → [ Grafana ]
Component Breakdown
🟠 Grafana — The Dashboard Layer
Role: Visualization and dashboards
Grafana is the face of your observability stack — the UI you actually look at. It doesn’t collect or store any data itself; it connects to data sources (like Prometheus or Loki) and renders charts, graphs, alerts, and dashboards from whatever those sources return.
Think of Grafana as the display screen in a control room. All the real work happens behind the scenes; Grafana just makes it human-readable.
Key features:
- Connects to dozens of data sources (Prometheus, Loki, InfluxDB, Postgres, and more)
- Supports alerting rules and notification channels
- Provides a drag-and-drop dashboard builder
🔴 Prometheus — The Metrics Database
Role: Collect and store time-series metrics
Prometheus is a pull-based metrics system. On a schedule, it scrapes HTTP endpoints (called /metrics) exposed by your services and stores the data as time-series values. It has its own query language called PromQL, which Grafana uses to pull data for your dashboards.
How it works:
- Your services expose a
/metricsendpoint - Prometheus scrapes those endpoints every N seconds
- Data is stored locally in a time-series database
- Grafana queries Prometheus using PromQL
Prometheus answers questions like: “What was my CPU usage over the last 6 hours?” or “How many HTTP 500 errors per minute is my app throwing?”
⚙️ Node Exporter — Linux System Metrics
Role: Expose host-level metrics (CPU, RAM, disk, network)
Prometheus can only scrape what is exposed to it. Node Exporter is a small agent you run on each Linux machine that reads system-level stats from the kernel and exposes them in Prometheus format.
Without Node Exporter, Prometheus knows nothing about the machine it’s running on. With it, you get rich hardware and OS metrics automatically.
What it exposes:
- CPU usage (per core, idle, iowait, etc.)
- RAM and swap usage
- Disk I/O and filesystem usage
- Network traffic (bytes in/out, errors, drops)
- System load averages
One per host. Run one Node Exporter instance on each Linux machine you want to monitor.
🟡 Loki — The Log Database
Role: Collect and store logs
Loki is Prometheus, but for logs. It stores log lines indexed by labels (not full-text), which makes it lightweight and cost-effective compared to alternatives like Elasticsearch. Grafana queries Loki using LogQL, a language very similar to PromQL.
The key design philosophy: Loki doesn’t index the content of your logs — only the metadata (labels like app, host, env). This keeps storage costs low while still making logs searchable.
Loki answers questions like: “Show me all error logs from the payment-service in the last 30 minutes.”
🟣 Alloy — The Modern Collector (Recommended)
Role: Gather metrics, logs, and traces — and ship them to the right backends
Alloy is Grafana’s modern, unified collector agent. It replaces Promtail (and partially replaces other agents) with a single, composable pipeline tool. You define components that connect to sources, transform data, and forward it to destinations.
Alloy can:
- Tail log files and send them to Loki
- Scrape Prometheus metrics
- Collect traces and send to Tempo
- Transform, filter, and enrich data along the way
It uses a configuration language called River (Alloy syntax), which makes complex pipelines readable and maintainable.
New stacks should use Alloy. It’s actively developed and the strategic direction for the Grafana agent ecosystem.
🔵 Promtail — The Legacy Log Shipper
Role: Gather logs from files/systemd and send to Loki
Promtail is the older, simpler agent specifically designed to ship logs to Loki. It watches log files (or systemd journal) and forwards new lines to Loki with labels attached.
It works well and is stable, but it’s single-purpose — it only ships logs. Alloy can do everything Promtail does, plus much more.
When to use Promtail: If you’re maintaining an existing setup that already uses it, there’s no urgent need to migrate. For new deployments, prefer Alloy.
| Promtail | Alloy | |
|---|---|---|
| Ships logs to Loki | ✅ | ✅ |
| Scrapes Prometheus metrics | ❌ | ✅ |
| Collects traces | ❌ | ✅ |
| Actively developed | ⚠️ Maintenance mode | ✅ |
🐳 cAdvisor — Docker Container Metrics
Role: Expose resource usage metrics for Docker containers
Node Exporter tells you about the host machine. cAdvisor tells you about the containers running on it. It monitors Docker containers in real time and exposes per-container CPU, memory, network, and disk metrics in Prometheus format.
What cAdvisor exposes:
- CPU usage per container
- Memory usage and limits
- Network I/O per container
- Container uptime and restart counts
Works alongside Node Exporter, not instead of it. You typically run both on any host running Docker containers.
How It All Fits Together
Here’s the complete picture of a typical stack:
┌─────────────────────────────────────────────┐
│ Grafana │ ← You look at this
│ (Dashboards & Alerts) │
└──────────────┬──────────────────────────────┘
│ queries
┌───────┴───────┐
│ │
Prometheus Loki
(metrics DB) (log DB)
│ │
│ scrapes receives logs
│ │
┌────┴────┐ ┌────┴────┐
│ Node │ │ Alloy │
│Exporter │ │(or │
│cAdvisor │ │Promtail)│
└─────────┘ └─────────┘
Host & container Log shipper
metrics
Quick Reference
| Tool | Type | Role | Ships Data To |
|---|---|---|---|
| Grafana | Visualization | Dashboards and alerts | — |
| Prometheus | Database | Stores time-series metrics | Grafana |
| Node Exporter | Exporter | Linux host metrics | Prometheus |
| Loki | Database | Stores logs | Grafana |
| Alloy | Agent | Collects & ships metrics/logs/traces | Prometheus, Loki, Tempo |
| Promtail | Agent (legacy) | Ships logs | Loki |
| cAdvisor | Exporter | Docker container metrics | Prometheus |
Summary
Each tool in the Grafana stack has a focused, well-defined job:
- Grafana shows you everything
- Prometheus and Loki store your metrics and logs
- Node Exporter and cAdvisor expose what’s happening on your machines and containers
- Alloy (or Promtail) moves log data into Loki
Once you understand what each piece owns, the stack stops feeling complicated and starts feeling elegant — every component does exactly one thing, and they all plug together cleanly.
Installation Link
Grafana on docker:
Links: Grafana
Questions / idea? Open an issue on GitHub.