Skip to main content
This guide walks you through starting the stack, verifying all five containers, connecting Grafana to Prometheus and Loki, and cleaning up when you’re done.
1

Clone the repository

git clone https://github.com/dev-ugo/learning-observability-plg.git
cd learning-observability-plg
2

Start the stack

Start all five containers in detached mode:
docker compose up -d
Docker pulls any missing images on the first run, so this may take a minute or two depending on your connection speed.
3

Verify all containers are running

docker compose ps
You should see five containers with a running status:
ContainerRole
prometheusMetrics collection and storage
node-exporterExposes system metrics (CPU, RAM, disk)
lokiLog storage
promtailLog collection and forwarding to Loki
grafanaUnified dashboard for metrics and logs
If any container is not running, check its logs with docker compose logs <container-name>.
4

Open Grafana

Go to http://localhost:3000 in your browser.
The default credentials are admin / admin. Grafana will prompt you to change the password after your first login. The password is also set via the GF_SECURITY_ADMIN_PASSWORD environment variable in docker-compose.yml.
5

Add the Prometheus datasource

  1. In Grafana, go to Connections → Data sources → Add new data source.
  2. Select Prometheus.
  3. Set the URL field to:
http://prometheus:9090
  1. Click Save & test. Grafana should confirm that the datasource is working.
6

Add the Loki datasource

  1. Go to Connections → Data sources → Add new data source.
  2. Select Loki.
  3. Set the URL field to:
http://loki:3100
  1. Click Save & test.
Both datasource URLs use Docker’s internal service names, which resolve correctly because all containers share the same Compose network.
DatasourceURL
Prometheushttp://prometheus:9090
Lokihttp://loki:3100
7

Create or import a dashboard

With both datasources connected, you can build a dashboard or import an existing one:
  • Create a dashboard: go to Dashboards → New → New dashboard and add panels using PromQL for metrics and LogQL for logs.
  • Import a dashboard: go to Dashboards → New → Import and enter a Grafana dashboard ID from grafana.com/grafana/dashboards (for example, ID 1860 for the Node Exporter Full dashboard).
Example PromQL queries to get started:
# CPU usage %
100 - (avg(rate(node_cpu_seconds_total{mode="idle"}[1m])) * 100)

# RAM used (GB)
(node_memory_MemTotal_bytes - node_memory_MemAvailable_bytes) / 1024 / 1024 / 1024
Example LogQL queries:
# All system logs
{job="varlogs"}

# Filter errors only
{job="varlogs"} |= "error"
8

Clean up

When you’re done, stop and remove all containers:
docker compose down
This stops all running containers and removes the networks created by Compose. Your configuration files are not affected.