Setup Node Exporter for Centralized Monitoring

1. Run this on Linux 20 server(s)

I will provide ansible playbook in next post ( when you have a multiple severs, automation is the key)

docker run -d \
--name=node-exporter \
--restart=always \
--net="host" \
--pid="host" \
-v "/:/host:ro,rslave" \
quay.io/prometheus/node-exporter:latest \
--path.rootfs=/host

I would use :ro,rslave instead of only :ro, because the official Docker example for node_exporter uses bind mounting so the container can correctly see host mount points. Node Exporter is meant to monitor the host system, not just the container. (GitHub)

Check one server:

curl http://localhost:9100/metrics

From central Prometheus server:

curl http://SERVER_IP:9100/metrics

2. Open firewall only from Prometheus server

On each Linux host, allow port 9100 only from your central Prometheus server:

sudo ufw allow from PROMETHEUS_SERVER_IP to any port 9100 proto tcp

Do not expose 9100 publicly.


3. Central Prometheus config

On your central monitoring server, Prometheus scrapes all 20 Node Exporters.

prometheus.yml:

global:
scrape_interval: 15s
scrape_configs:
- job_name: "linux_servers"
static_configs:
- targets:
- "10.0.1.11:9100"
- "10.0.1.12:9100"
- "10.0.1.13:9100"
- "10.0.1.14:9100"
- "10.0.1.15:9100"
# add all 20 servers here

Prometheus uses scrape_configs and targets to pull metrics from exporters. (Prometheus)

Restart Prometheus:

docker restart prometheus

4. Add Prometheus to Grafana

In Grafana:

Connections → Data sources → Prometheus
URL: http://PROMETHEUS_SERVER_IP:9090
Save & Test

Then import dashboard:

Dashboard ID: 1860

That is the popular Node Exporter Full dashboard.


Final architecture

20 Linux Servers
↓ node-exporter :9100
Central Prometheus
Grafana Dashboard

Important: Node Exporter does not send data to Grafana directly.
It exposes metrics, Prometheus pulls them, and Grafana visualizes Prometheus data.

Leave a Reply