Skip to content
Dorian FINKEL
PrometheusMonitoringLinuxTutorial · 2026 · 3 min read · Updated 9 October 2026
Level · IntermediateDuration · 30 min

Monitor a Linux server with Prometheus and node_exporter

node_exporter exposes system metrics, Prometheus scrapes and keeps their history, PromQL queries them, and a first alerting rule warns you when a target stops answering.

Prerequisites

  • A Linux server to monitor
  • Prometheus installed (on the same machine or elsewhere)

01Install node_exporter

Downloaded from the Prometheus site and unpacked, it runs as is and listens on port 9100. Debian and Ubuntu also ship it as a package (prometheus-node-exporter), already set up as a service.

Port 9100 should only be reachable by the Prometheus server: the metrics say a lot about the machine.

Example · /etc/systemd/system/node_exporter.service
[Unit]
Description=Prometheus node_exporter
After=network-online.target

[Service]
User=node_exporter
ExecStart=/usr/local/bin/node_exporter
Restart=on-failure

[Install]
WantedBy=multi-user.target

02Declare it in Prometheus

Example · prometheus.yml
global:
  scrape_interval: 15s

rule_files:
  - rules/*.yml

scrape_configs:
  - job_name: node
    static_configs:
      - targets: ['192.168.20.12:9100']

03Query

In the Prometheus interface, the up metric tells you for each target whether the last scrape succeeded (1) or not (0).

Two useful queries: CPU usage as a percentage, and remaining disk space.

Example · PromQL
# CPU used, in %, averaged over 5 minutes
100 * (1 - avg by (instance) (rate(node_cpu_seconds_total{mode="idle"}[5m])))

# Free space on the root filesystem, in %
100 * node_filesystem_avail_bytes{mountpoint="/"} / node_filesystem_size_bytes{mountpoint="/"}

04The first alert

for: 2m avoids alerting on a single missed scrape. promtool checks the file before reloading Prometheus; Alertmanager then takes care of sending the notification.

Example · rules/availability.yml
groups:
  - name: availability
    rules:
      - alert: TargetDown
        expr: up == 0
        for: 2m
        labels:
          severity: critical
        annotations:
          summary: "{{ $labels.instance }} is not responding"

05Next steps

Grafana for dashboards, Alertmanager to route alerts, and snmp_exporter for network equipment that can’t run an agent.

Example · Shell
promtool check rules rules/availability.yml
curl -X POST http://localhost:9090/-/reload   # if --web.enable-lifecycle

Key takeaways

  • node_exporter: port 9100, reachable by Prometheus only.
  • One target per job in prometheus.yml.
  • up == 0 for 2 minutes: the first alert to write.
  • promtool check before every reload.

Example addresses.

Official sources