Skip to content
Back to Series Homelab from Scratch
Homelab

Server Monitoring with Grafana & Prometheus

A homelab monitoring guide with Grafana and Prometheus. Install node_exporter, scrape metrics, build dashboards, and set alerts so problems surface early.

A
Alif Afriza Author
· · 5 min read
Server Monitoring with Grafana & Prometheus

A homelab server that has been running for a few months usually goes down for the first time because of something boring: full disk, exhausted RAM, or a hung process. Monitoring does not prevent that from happening, but it lets you know before everything stops working.

Choosing Tools: Why Grafana and Prometheus

The Prometheus + Grafana pairing is the de facto standard for homelabs and production:

  • Prometheus collects and stores metrics as time series. It is lightweight, pull-based, and does not require a specific agent on client servers.
  • Grafana displays those metrics in dashboards that can be configured and shared.

The basic workflow: each server runs node_exporter, which exposes metrics over HTTP. Prometheus pulls those metrics periodically, then Grafana reads from Prometheus to display them.

[Server 1: node_exporter :9100]
[Server 2: node_exporter :9100]  ->  [Prometheus :9090]  ->  [Grafana :3000]

1. Install node_exporter on Every Server

node_exporter is a small daemon that opens port 9100 and exposes CPU, memory, disk, and network metrics in a text format Prometheus understands.

# Download the latest version (check the official release page)
wget https://github.com/prometheus/node_exporter/releases/download/v1.8.2/node_exporter-1.8.2.linux-amd64.tar.gz
tar xzf node_exporter-1.8.2.linux-amd64.tar.gz
sudo mv node_exporter-1.8.2.linux-amd64/node_exporter /usr/local/bin/

# Run as a service
systemctl start node_exporter

Do not forget to open the port in the firewall for access only from the Prometheus server, for example ufw allow from 192.168.1.10 to any port 9100.

2. Set Up Prometheus

Prometheus can be run via Docker, but make sure its storage is on a volume so metrics are not lost when the container is updated.

# docker-compose.yml (prometheus + grafana)
version: "3.8"
services:
  prometheus:
    image: prom/prometheus:v2.53.0
    container_name: prometheus
    ports:
      - "9090:9090"
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
      - prometheus-data:/prometheus
    restart: unless-stopped

  grafana:
    image: grafana/grafana:11.1.0
    container_name: grafana
    ports:
      - "3000:3000"
    volumes:
      - grafana-data:/var/lib/grafana
    environment:
      - GF_SECURITY_ADMIN_PASSWORD=replace-with-strong-password
    restart: unless-stopped

volumes:
  prometheus-data:
  grafana-data:

Then create prometheus.yml. In the scrape_configs section you register targets: Prometheus itself and each node_exporter on the network.

global:
  scrape_interval: 15s

scrape_configs:
  - job_name: "prometheus"
    static_configs:
      - targets: ["localhost:9090"]

  - job_name: "node"
    static_configs:
      - targets:
          - "192.168.1.13:9100"
          - "192.168.1.14:9100"

3. Install Grafana and Connect It to Prometheus

Run Docker Compose, wait until the containers are healthy, then access http://<server-ip>:3000. The first login uses admin and the password set in the environment.

  1. Go to Configuration > Data Sources
  2. Select Prometheus
  3. Fill in the URL with http://prometheus:9090 (the service name in compose)
  4. Click Save & test
  5. Import a dashboard: Dashboards > Import, enter the official ID node-exporter-full (searchable on grafana.com), and select the Prometheus data source

The default imported dashboard already shows CPU, RAM, disk, network, and temperature for all registered nodes.

4. Verify Scraped Targets

Empty metrics are usually not Grafana’s fault, but rather Prometheus cannot reach the target.

# From the server where Prometheus runs
curl http://localhost:9090/api/v1/targets | head

# Check a simple metric directly
curl http://localhost:9090/api/v1/query --data-urlencode 'query=up'

An up output with a value of 1 means the target is healthy, while 0 means down. The problem here is immediately visible in the dashboard.

5. Simple Alerts Without Alertmanager

For initial notifications, you can use Grafana’s built-in Alerting feature and send them directly to chat or email, without complicating things with Alertmanager first.

An example of a simple rule in Grafana: create a new alert on the disk usage dashboard, with a condition of a value above 85% for 5 minutes, then set the notification channel to a chat app or notification web service.

An alert works if two things are present: a clear condition (a value > threshold for a certain duration), and a channel that actually fires. Test it first with a deliberately violated threshold, for example set the threshold to 1% temporarily, then restore it.

6. Optional Monitoring Options

  • Prometheus blackbox_exporter to check whether web services and TCP ports respond.
  • Grafana Loki to aggregate logs from multiple servers in one place.
  • Uptime Kuma as a lightweight alternative if you only need periodic URL checks.

Things to Watch Out For

  • Do not expose Grafana/alert channels to the internet without authentication. Homelab dashboards contain network details that should stay private, or secure them behind a VPN/tunnel.
  • node_exporter binds to 0.0.0.0:9100 by default. Restrict access in the firewall so only the Prometheus server can pull metrics.
  • Prometheus and Grafana volumes can fill up if data is allowed to accumulate. Set retention_time in Prometheus, for example 15 days, and monitor the volume size.

Summary

Good monitoring is what lets you know about a problem before users (or you yourself) notice it. Start with one node, add a new scrape target whenever a new server joins, and make sure the alerts you set up have actually been tested.

With server metrics monitored, the next step is to lock the door: make sure the services and accounts running in the homelab are truly secure. Continue to Part 11: Hardening Homelab Server Security.

Open for Contributors

Your ideas deserve to be read by thousands of people.

ByteNesia is built for everyone. If you have experience, tutorials, or opinions about technology, write and share them here. Your name will be credited as a contributor.

Write anything: tool reviews, homelab tutorials, security tips, or your tech stories.

Discussion & Comments