ALBANIA

ARGENTINA

AUSTRALIA

AUSTRIA

AZERBAIJAN

BANGLADESH

BELGIUM

BOSNIA AND HERZEGOVINA

BRAZIL

BULGARIA

CANADA

CHILE

CHINA

COLOMBIA

COSTA RICA

CROATIA

CYPRUS

CZECH REPUBLIC

DENMARK

ECUADOR

EGYPT

EL SALVADOR

ESTONIA

FINLAND

FRANCE

GEORGIA

GERMANY

GREECE

GUATEMALA

HUNGARY

ICELAND

INDIA

INDONESIA

IRELAND

ISRAEL

ITALY

JAPAN

KAZAKHSTAN

KENYA

KOSOVO

LATVIA

LIBYA

LITHUANIA

LUXEMBOURG

MALAYSIA

MALTA

MEXICO

MOLDOVA

MONTENEGRO

MOROCCO

NETHERLANDS

NEW ZEALAND

NIGERIA

NORWAY

PAKISTAN

PANAMA

PARAGUAY

PERU

PHILIPPINES

POLAND

PORTUGAL

QATAR

ROMANIA

RUSSIA

SAUDI ARABIA

SERBIA

SINGAPORE

SLOVAKIA

SLOVENIA

SOUTH AFRICA

SOUTH KOREA

SPAIN

SWEDEN

SWITZERLAND

TAIWAN

THAILAND

TUNISIA

TURKEY

UKRAINE

UNITED ARAB EMIRATES

UNITED KINGDOM

URUGUAY

USA

UZBEKISTAN

VIETNAM

How to Install Prometheus and Grafana to Monitor a Linux Dedicated Server

Monitoring a dedicated server is essential for maintaining consistent performance, identifying resource bottlenecks and preventing unexpected service interruptions. Without continuous monitoring, administrators may not notice increasing CPU utilization, memory pressure, insufficient disk space or unusual network activity until these issues begin affecting applications and users.

Although Linux provides built-in utilities such as top, htop, free, df and iostat, these tools generally require administrators to inspect the server manually. They are useful for troubleshooting individual problems, but they do not provide the same centralized visibility as a dedicated monitoring platform.

This is where Prometheus and Grafana become useful.

Prometheus is an open-source monitoring and time-series database system that collects, stores and queries performance metrics from servers and applications. Prometheus Node Exporter extends this functionality by exposing Linux operating system and hardware statistics, including CPU activity, memory consumption, filesystem capacity and network traffic.

Grafana connects to Prometheus and converts the collected metrics into interactive dashboards, allowing administrators to monitor server performance through visual charts, graphs and configurable alerts.

In this tutorial, you will learn how to install Prometheus, Node Exporter and Grafana on an Ubuntu 24.04 dedicated server. You will also configure metric collection, connect Grafana to Prometheus, import a Linux monitoring dashboard and create alerts for critical server conditions.

What You Will Build

By the end of this tutorial, you will have:

  • Prometheus installed and configured to collect time-series performance metrics.

  • Node Exporter running to expose Linux server hardware and operating-system data.

  • Grafana connected to Prometheus to visualize server performance via interactive dashboards.

  • Alerting rules configured to notify you of critical resource conditions, such as high disk usage.

Note: For this tutorial, all three components will run on the same dedicated server. This is suitable for a basic single-server deployment. Larger infrastructures can use a separate monitoring server to collect metrics from multiple dedicated servers.

1. Understand How Prometheus and Grafana Work Together

Before installing the monitoring software, it is important to understand the role of each component.

Prometheus, Node Exporter and Grafana perform different functions but work together to provide a complete server monitoring solution.

Prometheus

Prometheus is responsible for collecting and storing time-series metrics. It periodically requests information from configured monitoring endpoints, stores the returned data and makes it available through PromQL (Prometheus Query Language). For example, it can collect information about:

  • CPU utilization and system load.

  • Available and used memory.

  • Disk capacity and filesystem usage.

  • Network traffic and interface statistics.

Prometheus Node Exporter

Node Exporter collects hardware and operating-system metrics from Linux servers and exposes them through an HTTP endpoint. Prometheus retrieves these metrics by scraping the Node Exporter endpoint. Some important metrics include:

  • node_cpu_seconds_total – CPU time categorized by operating mode.

  • node_memory_MemAvailable_bytes – Available system memory.

  • node_filesystem_avail_bytes – Available filesystem space.

Grafana

Grafana provides the visualization layer. It connects to Prometheus and uses its metrics to create dashboards, charts and monitoring panels. Administrators can use Grafana to identify resource utilization trends, compare server performance over time and configure notifications when monitored conditions require attention.

2. Prepare Your Ubuntu Dedicated Server

Before installing Prometheus and Grafana, make sure your server meets the basic requirements.

You will need:

  • Ubuntu 24.04 LTS installed on your dedicated server.

  • A user account with sudo privileges and SSH access.

  • Sufficient disk space for monitoring data and dashboard storage (2 CPU cores and 2–4 GB RAM is a reasonable start).

Check the Ubuntu version and architecture

Connect to your dedicated server through SSH:

ssh username@YOUR_SERVER_IP

Check the operating system version:

lsb_release -a

Check the server architecture (the commands in this guide use amd64):

dpkg --print-architecture

Update the operating system

Update the package repositories and install available updates:

sudo apt update
sudo apt upgrade -y

Install the required utilities for downloading software and verifying files:

sudo apt install -y curl wget tar ca-certificates gnupg

3. Create Dedicated System Users

For better security, Prometheus and Node Exporter should run under separate unprivileged system accounts instead of using the root account.

Create the required users:

sudo useradd --no-create-home --shell /usr/sbin/nologin prometheus
sudo useradd --no-create-home --shell /usr/sbin/nologin node_exporter

Create the Prometheus configuration and storage directories:

sudo mkdir -p /etc/prometheus
sudo mkdir -p /var/lib/prometheus

Assign the appropriate ownership so these directories can store configuration files and collected time-series data:

sudo chown prometheus:prometheus /etc/prometheus
sudo chown prometheus:prometheus /var/lib/prometheus

4. Install Prometheus on Ubuntu 24.04

Prometheus is available as a precompiled Linux binary. Installing it manually provides control over the software version and its system configuration.

Download Prometheus

Move to the temporary directory, set the version, and download the archive:

cd /tmp
PROM_VERSION="3.16.0"
wget https://github.com/prometheus/prometheus/releases/download/v${PROM_VERSION}/prometheus-${PROM_VERSION}.linux-amd64.tar.gz

Verify the SHA-256 checksum (a successful verification should display OK) and extract the archive:

echo "68727009472a2c02e1ff7f062fd5b3e637285bffc8fc2d340c76fb449d6e0f34  prometheus-${PROM_VERSION}.linux-amd64.tar.gz" | sha256sum -c -
tar -xzf prometheus-${PROM_VERSION}.linux-amd64.tar.gz
cd prometheus-${PROM_VERSION}.linux-amd64

Install Prometheus binaries

Copy the Prometheus executable and configuration utility into the system binary directory, and ensure ownership is correct:

sudo install -m 0755 prometheus /usr/local/bin/prometheus
sudo install -m 0755 promtool /usr/local/bin/promtool
sudo mkdir -p /etc/prometheus
sudo chown -R prometheus:prometheus /etc/prometheus /var/lib/prometheus

Create a Prometheus systemd service

To make Prometheus start automatically after server reboots, configure it as a systemd service.

Create the service file:

sudo nano /etc/systemd/system/prometheus.service

Add the following configuration, then save the file:

[Unit]
Description=Prometheus Monitoring System
Wants=network-online.target
After=network-online.target

[Service]
User=prometheus
Group=prometheus
Type=simple

ExecStart=/usr/local/bin/prometheus \
  --config.file=/etc/prometheus/prometheus.yml \
  --storage.tsdb.path=/var/lib/prometheus \
  --web.listen-address=127.0.0.1:9090

Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target

Notice that Prometheus listens on 127.0.0.1:9090. This prevents direct public access to its web interface.

5. Install Prometheus Node Exporter

After installing Prometheus, configure Node Exporter to collect operating-system and hardware metrics.

Download Node Exporter

cd /tmp
NODE_VERSION="1.12.1"
wget https://github.com/prometheus/node_exporter/releases/download/v${NODE_VERSION}/node_exporter-${NODE_VERSION}.linux-amd64.tar.gz
echo "b51d8a76aa2a9156a55d501aca6276fae09e262259a5e4e831d2c2222f084e63  node_exporter-${NODE_VERSION}.linux-amd64.tar.gz" | sha256sum -c -
tar -xzf node_exporter-${NODE_VERSION}.linux-amd64.tar.gz
sudo install -m 0755 node_exporter-${NODE_VERSION}.linux-amd64/node_exporter /usr/local/bin/node_exporter

Configure Node Exporter as a systemd service

Create the systemd service file:

sudo nano /etc/systemd/system/node_exporter.service

Add the following configuration, then save the file:

[Unit]
Description=Prometheus Node Exporter
Wants=network-online.target
After=network-online.target

[Service]
User=node_exporter
Group=node_exporter
Type=simple

ExecStart=/usr/local/bin/node_exporter \
  --web.listen-address=127.0.0.1:9100

Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target

Start both services

Reload systemd, start the services, and verify their status:

sudo systemctl daemon-reload
sudo systemctl enable --now prometheus
sudo systemctl enable --now node_exporter
sudo systemctl status prometheus
sudo systemctl status node_exporter

You can verify that Node Exporter is exposing metrics locally:

curl http://127.0.0.1:9100/metrics | head

6. Configure Prometheus to Collect Linux Server Metrics

Prometheus must know which monitoring endpoints it should collect information from. This process is called metric scraping.

Open the Prometheus configuration file:

sudo nano /etc/prometheus/prometheus.yml

Add the following YAML configuration:

global:
  scrape_interval: 15s
  evaluation_interval: 15s

scrape_configs:

  - job_name: "prometheus"
    static_configs:
      - targets: ["127.0.0.1:9090"]

  - job_name: "linux-server"
    static_configs:
      - targets: ["127.0.0.1:9100"]
        labels:
          server: "colobird-linux-server"

Validate and Restart

Check whether the YAML configuration is valid, then restart the service:

sudo promtool check config /etc/prometheus/prometheus.yml
sudo systemctl restart prometheus
sudo systemctl status prometheus

Verify Prometheus targets

Create an SSH tunnel from your local computer to access the Prometheus dashboard:

ssh -L 9090:127.0.0.1:9090 username@YOUR_SERVER_IP

Open http://127.0.0.1:9090 in your browser and navigate to Status → Targets. You should see two monitoring jobs:

Job Target Expected status
prometheus 127.0.0.1:9090 UP
linux-server 127.0.0.1:9100 UP

7. Install Grafana on Ubuntu 24.04

Grafana provides the visual interface for monitoring server performance. For Ubuntu 24.04, the recommended installation method is Grafana's official APT repository.

Add the Grafana APT repository

sudo apt-get install -y apt-transport-https wget gnupg
sudo mkdir -p /etc/apt/keyrings
sudo wget -O /etc/apt/keyrings/grafana.asc https://apt.grafana.com/gpg-full.key
sudo chmod 644 /etc/apt/keyrings/grafana.asc
echo "deb [signed-by=/etc/apt/keyrings/grafana.asc] https://apt.grafana.com stable main" | sudo tee /etc/apt/sources.list.d/grafana.list
sudo apt-get update

Install Grafana

sudo apt-get install -y grafana
sudo systemctl daemon-reload
sudo systemctl enable --now grafana-server
sudo systemctl status grafana-server

Access the Grafana web interface

Grafana uses TCP port 3000 by default. Create an SSH tunnel from your workstation:

ssh -L 3000:127.0.0.1:3000 username@YOUR_SERVER_IP

Open your browser and visit http://127.0.0.1:3000. Log in using the default credentials (Username: admin, Password: admin) and set a secure new password when prompted.

8. Connect Prometheus to Grafana

Grafana needs a data source to retrieve the metrics collected by Prometheus. Follow these steps to establish the connection:

  1. Sign in to the Grafana web interface.
  2. Open Connections → Data sources.
  3. Select Add data source.
  4. Search for and select Prometheus.
  5. Enter the server URL: http://127.0.0.1:9090
  6. Scroll down and select Save & test.

If the connection is successful, Grafana will display a confirmation message indicating that the data source is working.

9. Import a Linux Server Monitoring Dashboard

For a faster setup, you can import an existing community dashboard designed for Prometheus Node Exporter. The "Node Exporter Full" dashboard is a popular option.

  1. Open Grafana and navigate to Dashboards.
  2. Select New → Import.
  3. Enter the dashboard ID: 1860
  4. Select Load.
  5. Choose the Prometheus data source configured earlier.
  6. Select Import.

Once imported, Grafana should display a collection of monitoring panels containing server performance information. Allow a few scrape intervals for metrics to populate.

10. Monitor CPU, RAM, Disk and Network Usage

A monitoring dashboard provides a convenient overview, but understanding individual metrics is equally important. Prometheus uses PromQL to retrieve monitoring data.

Monitor CPU utilization

Use the following PromQL query to calculate the percentage of CPU time spent outside the idle state over a five-minute period:

100 * (
  1 - avg by (instance) (
    rate(node_cpu_seconds_total{mode="idle"}[5m])
  )
)

Monitor RAM and memory consumption

Use this expression to calculate memory utilization based on unavailable memory:

100 * (
  1 - (
    node_memory_MemAvailable_bytes
    /
    node_memory_MemTotal_bytes
  )
)

Monitor disk space and filesystem usage

Calculate the percentage of filesystem capacity currently in use:

100 * (
  1 - (
    node_filesystem_avail_bytes{
      fstype!~"tmpfs|devtmpfs|squashfs",
      mountpoint!=""
    }
    /
    node_filesystem_size_bytes{
      fstype!~"tmpfs|devtmpfs|squashfs",
      mountpoint!=""
    }
  )
)

Monitor network traffic

To monitor incoming network traffic (in bytes per second):

rate(
  node_network_receive_bytes_total{device!="lo"}[5m]
)

To convert the results into bits per second, multiply the expression by eight.

11. Configure Alerts for Critical Server Conditions

Grafana alerting allows you to receive notifications when monitored conditions exceed predefined thresholds. Let's create an alert for high filesystem usage.

Create a disk usage alert

Open Grafana and navigate to Alerting → Alert rules → New alert rule. Use the following details:

Setting Configuration
Rule name Linux Server Disk Usage High
Query Filesystem usage PromQL expression
Condition Above 85%
Evaluation period 10 minutes
Severity Warning

Configure notification delivery

You must also configure a notification destination (contact point):

  1. Navigate to Alerting → Contact points.
  2. Create a contact point.
  3. Select a supported notification integration, such as email.
  4. Enter the required destination details.
  5. Configure the notification policy or associate the contact point with your alert rule.
  6. Save the configuration and test notification delivery.

12. Secure and Maintain Your Monitoring Environment

Consider the following recommendations when deploying the monitoring stack on a production dedicated server.

Restrict monitoring ports

Component Port Purpose
Prometheus 9090 Metrics collection and queries
Node Exporter 9100 Linux host metrics
Grafana 3000 Monitoring dashboard

Do not expose Prometheus and Node Exporter directly to the public internet. Keep their endpoints bound to localhost or a trusted private network.

Expand monitoring across multiple dedicated servers

You can extend Prometheus to monitor additional Linux servers. Install Node Exporter on each machine and configure Prometheus to scrape them through a private network:

scrape_configs:

  - job_name: "linux-servers"

    static_configs:
      - targets:
          - "10.0.0.11:9100"
        labels:
          server: "server-01"

      - targets:
          - "10.0.0.12:9100"
        labels:
          server: "server-02"

13. Troubleshoot Common Prometheus and Grafana Problems

Prometheus target shows DOWN

Check whether the exporter service is running and view its logs:

sudo systemctl status node_exporter
sudo journalctl -u node_exporter -n 50 --no-pager

Grafana cannot connect to Prometheus

Test the Prometheus local endpoint to ensure it's healthy:

curl http://127.0.0.1:9090/-/healthy

Grafana dashboard displays no metrics

Confirm that the Prometheus target status is UP, the correct data source is selected, and allow sufficient time for Prometheus to collect new samples.

Conclusion

Continuous monitoring is an important part of maintaining reliable dedicated server infrastructure. Instead of relying entirely on manual system checks, administrators can use Prometheus, Node Exporter and Grafana to collect and visualize performance metrics continuously.

In this tutorial, we covered how to install Prometheus and Grafana on Ubuntu 24.04, configure Node Exporter, connect the monitoring components, import a Linux server dashboard and create alerts for critical resource conditions.

With this monitoring environment in place, you can identify CPU bottlenecks, track memory consumption, monitor disk capacity and observe network traffic before resource-related problems affect your applications.

Frequently Asked Questions

What is Prometheus Grafana server monitoring?

Prometheus Grafana server monitoring is an approach to collecting, storing and visualizing server performance metrics. Prometheus collects time-series data from monitoring endpoints, Node Exporter exposes Linux hardware and operating-system metrics, and Grafana displays the information through interactive dashboards and alerts.

Can Prometheus and Grafana monitor a Linux dedicated server?

Yes. Prometheus and Grafana can monitor Linux dedicated servers using Node Exporter. This setup is suitable for monitoring physical dedicated servers, virtual machines and other supported Linux environments.

What is the difference between Prometheus and Node Exporter?

Prometheus is a monitoring and time-series database system that collects and stores metrics. Node Exporter is an exporter that exposes Linux system and hardware metrics through an HTTP endpoint, which Prometheus periodically scrapes.

Can Grafana monitor CPU, RAM and disk usage?

Yes. Grafana can display CPU utilization, memory consumption, filesystem usage and network traffic when connected to a suitable metrics data source such as Prometheus.

Can I monitor multiple dedicated servers with Prometheus?

Yes. You can install Node Exporter on multiple Linux dedicated servers and configure a central Prometheus instance to collect metrics from each machine.

Does Prometheus support server alerts?

Yes. Prometheus supports alerting rules that evaluate metric conditions. Grafana also includes its own alerting functionality, allowing administrators to create alert rules and configure notification contact points.

Is Prometheus suitable for production server monitoring?

Yes. Prometheus is widely used for infrastructure and application monitoring. For production deployments, administrators should configure appropriate storage retention, secure monitoring endpoints, and maintain regular software updates.