Lorixen.
EN

Monitor your Linux servers with Prometheus and Node Exporter

Short answer: To see what's happening inside a Linux server, rather than only whether the website responds, run Prometheus with the Node Exporter. Node Exporter exposes CPU, memory, disk and network figures on port 9100; Prometheus scrapes them on a schedule and stores them as time series you can graph and alert on. A basic setup takes an afternoon. Keep the exporter's port private, and add alert rules for the handful of problems that actually take sites down.

Why uptime checks aren't enough

An uptime checker tells you the site is down after it's down. It can't tell you the disk has been filling for a week, memory climbs every night until the database is killed, or CPU sits at maximum every Monday morning when reports run. Those slow trends are what Prometheus is good at catching.

Prometheus is an open-source monitoring system. Its overview explains that it collects and stores metrics as time series data, meaning each value is recorded with a timestamp and optional labels, and that collection happens via a pull model over HTTP: Prometheus calls out to each target and asks for its current numbers.

The two pieces

  • Node Exporter runs on each server you want to watch. It reads hardware and operating system statistics and publishes them as plain text at /metrics.
  • Prometheus runs on one machine (often a small separate server). Every few seconds it fetches /metrics from each exporter, stores the results and evaluates alert rules.

You'll usually add Grafana for dashboards and Alertmanager, Prometheus's companion for alerts, which handles grouping and sends notifications by email, chat or on-call tools.

Step 1: run Node Exporter

Download the release for your system from the Prometheus project, unpack it and start the node_exporter binary, ideally as a system service so it restarts on boot. The official guide shows it listening on port 9100; you can check it with:

curl http://localhost:9100/metrics

You'll see lines of metrics prefixed with node_, such as node_cpu_seconds_total, along with help text describing each one.

Before you go further, protect that port. Metrics reveal a lot about your server. Allow port 9100 only from your Prometheus machine using your firewall or cloud security group, or bind the exporter to a private network address.

Step 2: point Prometheus at it

Prometheus reads a file called prometheus.yml. A minimal version needs a global scrape interval and a job listing your targets. The getting-started guide uses a 15-second default interval. A small configuration might define a job named node with targets like 10.0.0.5:9100 and 10.0.0.6:9100.

Start Prometheus, then open its web interface (port 9090 by default) and check the Targets page. Each server should show as up. If one is down, the page usually says why: connection refused, timeout or a wrong address.

Step 3: learn five useful queries

Prometheus uses its own query language, PromQL. You don't need much of it to get value:

  • CPU busy: the rate of node_cpu_seconds_total for non-idle modes over five minutes.
  • Memory available: node_memory_MemAvailable_bytes divided by node_memory_MemTotal_bytes.
  • Disk space left: node_filesystem_avail_bytes divided by node_filesystem_size_bytes, filtered to real filesystems.
  • Disk time to full: predict_linear on available bytes, to estimate when a disk will fill at the current rate.
  • Network traffic: the rate of node_network_receive_bytes_total and node_network_transmit_bytes_total.

Put these on a Grafana dashboard so you can see a week of history at a glance. Community dashboards for Node Exporter exist and save time, but review them before trusting their thresholds.

Step 4: alert on what matters

Too many alerts and people stop reading them. Start with a short list:

  • A target has been down for more than a few minutes.
  • A filesystem is predicted to fill within a day or two.
  • Available memory has stayed very low for a sustained period.
  • CPU has been fully used for longer than your normal peak lasts.

Write these as alert rules in Prometheus, send them to Alertmanager, and route them to one place the team actually watches. Tune thresholds after a couple of weeks, once you know what normal looks like for your servers.

Running it sensibly

  • Retention: Prometheus keeps local data for a limited period by default. Decide how much history you need and size the disk for it.
  • Placement: Run Prometheus somewhere other than the servers it watches, so it can still alert when they fail.
  • Watch the watcher: add a simple external check that Prometheus itself is up.
  • Application metrics: once the basics work, many frameworks can expose request counts and response times in the same format, so you can graph your app alongside the server.

A worked example

Take a hypothetical Brisbane property-listing site on two cloud servers. Twice in a month the site went down overnight with no warning. After installing Node Exporter on both servers and Prometheus on a small third one, the team saw memory on the main server climb each night during an image-processing job until the system ran out. They moved the job to off-peak hours with a memory cap and added an alert for low available memory, which has since fired once, early enough to act.

FAQ

Is Prometheus overkill for one server?

For a single small site, a hosted monitoring service may be simpler. Prometheus earns its keep once you have a few servers or want long-term history you control.

Does Node Exporter slow my server down?

It's lightweight and mostly reads statistics the operating system already keeps. Disable collectors you don't need if you want it leaner.

Can I monitor Windows servers the same way?

Node Exporter targets Unix-like systems. A separate community exporter exists for Windows.

Do I need Grafana?

No, Prometheus has a basic graph view. Grafana makes dashboards far easier to read and share.

If you'd like help setting up server monitoring that warns you before customers notice, tell us about your servers.

Sources

WhatsAppBook a call