Skip to main content
To monitor a Linux server with Prometheus and Grafana, install prometheus and prometheus-node-exporter with sudo apt install (Ubuntu/Debian), add Grafana from Grafana’s APT repository, then in Grafana add a Prometheus data source at http://localhost:9090 and import dashboard ID 1860 (Node Exporter Full). node_exporter exposes system metrics on port 9100, Prometheus stores them, and Grafana draws the charts on port 3000.

Before you start

  • Connect with SSH as a user with sudo. Root users can leave out sudo.
  • How the parts fit together:
  • All three listen on every network interface by default. This guide binds them to localhost and reaches them through an SSH tunnel, so nothing is exposed.
  • On AlmaLinux or Rocky Linux, Grafana installs from Grafana’s RPM repository, but Prometheus and node_exporter are not in the base repositories. Use the official release binaries from prometheus.io/download or run them with Docker.

How to install Prometheus and node_exporter

1

Install the packages

Both services start automatically. Ubuntu 24.04 ships Prometheus 2.45 and node_exporter 1.7.
2

Check the scrape config

The packaged /etc/prometheus/prometheus.yml already scrapes Prometheus itself and node_exporter:
After any edit, validate the file:
3

Keep both on localhost

Edit /etc/default/prometheus and set:
Edit /etc/default/prometheus-node-exporter and set:
4

Restart

Check node_exporter answers:

How to install Grafana

1

Add Grafana's signing key and repository

2

Install Grafana OSS

3

Bind Grafana to localhost

Open /etc/grafana/grafana.ini, find the [server] section and set:
Remove the ; in front of the line if there is one; a leading ; means the line is a comment.
4

Start Grafana and enable it at boot

How to connect Grafana to Prometheus

1

Open an SSH tunnel

On your own computer:
Leave it open and browse to http://localhost:3000.
2

Sign in and change the password

Sign in with username admin and password admin. Grafana asks you to set a new password straight away. Do it.
3

Add the Prometheus data source

Go to Connections, add a new connection, search for Prometheus and select Prometheus data source, then add a new data source. Set Prometheus server URL to http://localhost:9090 and click Save & test. You should see Successfully queried the Prometheus API.
4

Import the Node Exporter Full dashboard

Click Dashboards, then New > Import dashboard. Enter 1860, click Load, select your Prometheus data source and click Import.
The dashboard shows CPU, load, memory, disk space, disk I/O and network traffic for the node job. Some panels (systemd units, process counts) stay empty unless node_exporter runs with --collector.systemd --collector.processes; add them to ARGS in /etc/default/prometheus-node-exporter if you want those panels.
Don’t open ports 9090, 9100 or 3000 to the whole internet. Prometheus and node_exporter have no login by default, and an exposed Grafana with the default password is taken over quickly. If you need remote access without a tunnel, put Grafana behind Nginx with HTTPS and allow only your IP in UFW.

How to monitor more servers

Install prometheus-node-exporter on each extra server, let it listen on its private or public address, and allow port 9100 only from your Prometheus server’s IP in that server’s firewall. Then add the target to /etc/prometheus/prometheus.yml on the Prometheus server:
Validate with promtool check config and run sudo systemctl reload prometheus.

How to check it worked

All three lines should show 127.0.0.1. In Prometheus (tunnel port 9090, then http://localhost:9090), open Status > Targets: both jobs should be UP.

Frequently asked questions

How long does Prometheus keep data?

15 days unless you change it. Set --storage.tsdb.retention.time=30d in ARGS in /etc/default/prometheus to keep 30 days, and check you have the disk space.

Can Prometheus send alerts?

Yes, through Alertmanager (sudo apt install prometheus-alertmanager) and alerting rules. Grafana also has its own alerting. For a simple “server is down” email, an external checker is easier: see email alerts when your server goes down.

Should I run Prometheus on the server I monitor?

It is fine for one server. If that server goes down, so does your monitoring, so for several servers run Prometheus and Grafana on a separate small server.

Is there a simpler option?

Netdata gives live dashboards with one install script and no configuration.

VPS and dedicated server guides

Every server guide in one place.

Set up Netdata

One-script real-time dashboards.

Email alerts when your server goes down

Uptime checks from outside.

Nginx as a reverse proxy

Publish Grafana with HTTPS.

Set up a firewall with UFW

Keep metric ports closed.

Checked against the official Prometheus and Grafana installation documentation and the Node Exporter Full dashboard page on 4 November 2026; Prometheus and node_exporter packages, config check and listen flags tested on Ubuntu 24.04 LTS. The Grafana steps follow Grafana’s documentation and were not run. Commands can differ on other distributions or releases.

Need Extra Help?

If you encounter any issues, our support team is ready to assist:

Save on Your Hosting

Ready to upgrade your hosting? Use code KB20 at checkout for 20% off your first order!

Last Updated: November 2026