Grafana Monitoring Stack on a Linux VPS: Prometheus, Node Exporter & systemd

Deploy a production-ready metrics and observability stack using Prometheus, Node Exporter, and Grafana on a Linux KVM VPS with secure service configuration.

Maintaining high availability across distributed application backends, API servers, and database clusters requires real-time visibility into infrastructure metrics. Deploying an open-source monitoring stack combining Prometheus for time-series data collection, Node Exporter for hardware and kernel telemetry, and Grafana for visual dashboards on a dedicated Linux KVM VPS provides engineering teams with an independent observability platform that does not rely on third-party SaaS monitoring vendors.

Architecture of the Prometheus and Grafana Observability Stack

The monitoring pipeline operates on a pull-based architecture consisting of three coordinated components:

  • Node Exporter: A lightweight daemon written in Go that runs on the target host. It queries the Linux kernel's /proc and /sys pseudo-filesystems to expose CPU utilization, memory distribution, disk I/O throughput, network interface traffic, and systemd service states as raw HTTP metrics on port 9100.
  • Prometheus Server: The central time-series engine that scrapes metric endpoints at defined intervals, stores data points in an optimized on-disk time-series database (TSDB), evaluates alert rules, and processes PromQL queries.
  • Grafana: The visualization layer that connects to Prometheus as a data source, rendering real-time dashboards, alerting thresholds, and multi-host performance graphs.

Hosting this stack on an unmanaged KVM VPS with RAID NVMe storage ensures high disk write throughput for metric ingestion and allows complete control over data retention policies and security boundaries.

Step 1: Installing and Configuring Node Exporter

To ensure security, execute Node Exporter under a dedicated system user without login capabilities or home directory permissions:

# Create dedicated system user for Node Exporter
sudo useradd --system --no-create-home --shell /bin/false node_exporter

# Download and install the latest Node Exporter binary
cd /tmp
wget https://github.com/prometheus/node_exporter/releases/download/v1.8.2/node_exporter-1.8.2.linux-amd64.tar.gz
tar -xvf node_exporter-1.8.2.linux-amd64.tar.gz
sudo mv node_exporter-1.8.2.linux-amd64/node_exporter /usr/local/bin/
sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter

Create a dedicated systemd service unit file at /etc/systemd/system/node_exporter.service:

[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 --collector.systemd

[Install]
WantedBy=multi-user.target

Reload systemd, enable the daemon on system boot, and start the service:

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

Step 2: Installing and Configuring Prometheus

Similarly, create a dedicated system account and storage directories for the Prometheus TSDB:

# Create user and required directories
sudo useradd --system --no-create-home --shell /bin/false prometheus
sudo mkdir -p /etc/prometheus /var/lib/prometheus
sudo chown prometheus:prometheus /etc/prometheus /var/lib/prometheus

# Download and install Prometheus
cd /tmp
wget https://github.com/prometheus/prometheus/releases/download/v2.54.1/prometheus-2.54.1.linux-amd64.tar.gz
tar -xvf prometheus-2.54.1.linux-amd64.tar.gz
cd prometheus-2.54.1.linux-amd64
sudo mv prometheus promtool /usr/local/bin/
sudo chown prometheus:prometheus /usr/local/bin/prometheus /usr/local/bin/promtool
sudo mv consoles console_libraries /etc/prometheus/

Configure Prometheus to scrape the local Node Exporter instance in /etc/prometheus/prometheus.yml:

global:
  scrape_interval: 15s
  evaluation_interval: 15s

scrape_configs:
  - job_name: "node_metrics"
    static_configs:
      - targets: ["127.0.0.1:9100"]

Create the systemd service file at /etc/systemd/system/prometheus.service, configuring data retention to 30 days:

[Unit]
Description=Prometheus Time Series Monitoring
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/ \
  --storage.tsdb.retention.time=30d \
  --web.listen-address=127.0.0.1:9090

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now prometheus

Step 3: Installing Grafana and Connecting Data Sources

Install the official Grafana package on Debian/Ubuntu systems:

sudo apt-get install -y apt-transport-https software-properties-common wget
sudo mkdir -p /etc/apt/keyrings/
wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg > /dev/null
echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee /etc/apt/sources.list.d/grafana.list
sudo apt-get update
sudo apt-get install -y grafana
sudo systemctl enable --now grafana-server

Once Grafana is active on port 3000, log in via your browser, navigate to Connections > Data Sources > Add Data Source, choose Prometheus, set the server URL to http://127.0.0.1:9090, and click Save & Test.

Next, import community Dashboard ID 1860 (Node Exporter Full). This dashboard delivers immediate visibility into CPU core saturation, memory swap pressure, disk I/O utilization, and network interface packet rates.

Security Hardening and VPS Resource Sizing

A monitoring server contains sensitive operational telemetry and must be properly secured against unauthorized network access:

  • Localhost Binding: As shown in the service configurations, bind Prometheus (port 9090) and Node Exporter (port 9100) to 127.0.0.1 so that raw scrapers are never directly exposed to the public internet.
  • Reverse Proxy with SSL: Place an Nginx reverse proxy in front of Grafana (port 3000) configured with an SSL certificate to ensure encrypted browser sessions and role-based access control.
  • VPS Sizing: For monitoring clusters of 5 to 25 remote hosts with a 15-second scraping interval, allocate a KVM VPS instance with at least 4 GB of RAM, 2 vCPUs, and high-performance RAID NVMe storage to manage concurrent TSDB compaction and index searches.

StreamData Networks offers flexible KVM VPS plans equipped with RAID NVMe storage and fast network connectivity across Mumbai, Noida, and Jaipur nodes, providing the ideal hardware foundation for self-hosted monitoring stacks.

Explore StreamData KVM VPS hosting for scalable cloud instances, review bare-metal servers on StreamData Dedicated Servers, or consult platform features via StreamData Company.


Sources