Back to articles
Technology Insight

VPS Monitoring Stack 2026: A Beginner's Guide to Prometheus, Grafana, and Loki

May 14, 2026

Introduction to Modern VPS Monitoring

In 2026, monitoring your Virtual Private Server (VPS) infrastructure has become more critical than ever. As applications grow in complexity and user expectations for uptime increase, having a robust monitoring stack is no longer optional—it's essential. The combination of Prometheus, Grafana, and Loki has emerged as the industry-standard open-source solution for comprehensive observability.

This guide will walk you through building a complete monitoring stack from scratch, even if you're new to infrastructure monitoring. By the end, you'll have a production-ready system that collects metrics, visualizes data, and aggregates logs—all running on your VPS.

Why Prometheus, Grafana, and Loki?

Before diving into implementation, it's important to understand why this particular stack has become the go-to choice for DevOps teams worldwide.

Prometheus: The Metrics Powerhouse

Prometheus is a time-series database designed specifically for monitoring. It excels at:

  • Pull-based architecture: Prometheus scrapes metrics from your services at regular intervals, making it reliable and predictable
  • Powerful query language: PromQL allows you to slice and dice your metrics data with precision
  • Service discovery: Automatically discovers and monitors new services as your infrastructure scales
  • Alerting capabilities: Built-in alert manager for proactive incident response

Grafana: Visualization Excellence

Grafana transforms raw metrics into actionable insights through:

  • Beautiful dashboards: Create stunning, customizable visualizations of your data
  • Multi-source support: Connect to Prometheus, Loki, and dozens of other data sources simultaneously
  • Alerting integration: Send notifications to Slack, PagerDuty, email, and more
  • Template variables: Build dynamic dashboards that adapt to your infrastructure

Loki: Log Aggregation Made Simple

Loki completes the observability picture by handling logs:

  • Prometheus-inspired design: Uses labels for indexing, keeping storage costs low
  • Native Grafana integration: Query logs alongside metrics in the same interface
  • Efficient storage: Stores only metadata, not full-text indexes, reducing resource requirements
  • LogQL query language: Familiar syntax for anyone who knows PromQL

Prerequisites and System Requirements

Before beginning the installation, ensure your VPS meets these minimum requirements:

  • Operating System: Ubuntu 22.04 LTS or later (this guide uses Ubuntu)
  • RAM: Minimum 2GB, recommended 4GB or more
  • CPU: 2 cores minimum
  • Storage: At least 20GB free space for metrics and logs
  • Root or sudo access: Required for installation and configuration

You should also have basic familiarity with:

  • Linux command line operations
  • SSH access to your VPS
  • Basic networking concepts
  • Text editing with nano or vim

Step 1: Installing Prometheus

Prometheus will serve as the foundation of our monitoring stack, collecting and storing metrics from various sources.

Download and Install Prometheus

First, create a dedicated user for Prometheus and download the latest version:

sudo useradd --no-create-home --shell /bin/false prometheus

Download Prometheus (check the official website for the latest version in 2026):

wget https://github.com/prometheus/prometheus/releases/download/v2.50.0/prometheus-2.50.0.linux-amd64.tar.gz

Extract and move the files to appropriate directories:

tar xvf prometheus-2.50.0.linux-amd64.tar.gz
sudo cp prometheus-2.50.0.linux-amd64/prometheus /usr/local/bin/
sudo cp prometheus-2.50.0.linux-amd64/promtool /usr/local/bin/

Configure Prometheus

Create the necessary directories and configuration file:

sudo mkdir /etc/prometheus
sudo mkdir /var/lib/prometheus

Create a basic prometheus.yml configuration file that monitors the Prometheus server itself. This serves as your starting point, which you'll expand as you add more services to monitor.

Create a Systemd Service

To ensure Prometheus starts automatically and runs reliably, create a systemd service file at /etc/systemd/system/prometheus.service. This allows you to manage Prometheus like any other system service with commands like systemctl start prometheus and systemctl status prometheus.

After creating the service file, enable and start Prometheus. You can then access the Prometheus web interface at http://your-vps-ip:9090.

Step 2: Installing Grafana

Grafana will provide the visualization layer for your monitoring stack, turning raw metrics into meaningful dashboards.

Add Grafana Repository

Grafana maintains official APT repositories for Ubuntu. Add the repository and install Grafana:

sudo apt-get install -y software-properties-common
sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install grafana

Start and Enable Grafana

Enable Grafana to start on boot and launch the service:

sudo systemctl enable grafana-server
sudo systemctl start grafana-server

Grafana will be accessible at http://your-vps-ip:3000. The default login credentials are admin/admin, which you should change immediately upon first login.

Connect Grafana to Prometheus

Once logged into Grafana:

  1. Navigate to Configuration → Data Sources
  2. Click Add data source
  3. Select Prometheus
  4. Enter the URL: http://localhost:9090
  5. Click Save & Test to verify the connection

You now have Prometheus feeding data into Grafana. You can import pre-built dashboards from the Grafana community or create custom ones tailored to your needs.

Step 3: Installing Loki and Promtail

Loki will handle log aggregation, while Promtail acts as the agent that ships logs from your VPS to Loki.

Install Loki

Download and install Loki similar to how you installed Prometheus:

wget https://github.com/grafana/loki/releases/download/v2.9.0/loki-linux-amd64.zip
unzip loki-linux-amd64.zip
sudo mv loki-linux-amd64 /usr/local/bin/loki

Create a configuration file at /etc/loki/config.yml with basic settings for local storage and retention policies. Loki's configuration determines how logs are stored, indexed, and retained.

Install Promtail

Promtail is the agent that reads log files and sends them to Loki:

wget https://github.com/grafana/loki/releases/download/v2.9.0/promtail-linux-amd64.zip
unzip promtail-linux-amd64.zip
sudo mv promtail-linux-amd64 /usr/local/bin/promtail

Configure Promtail to monitor system logs like /var/log/syslog and /var/log/auth.log. You can expand this later to include application-specific logs.

Create Systemd Services

Create systemd service files for both Loki and Promtail, then enable and start them. This ensures your log aggregation pipeline runs continuously and survives server reboots.

Add Loki to Grafana

In Grafana, add Loki as a data source:

  1. Go to Configuration → Data Sources
  2. Click Add data source
  3. Select Loki
  4. Enter the URL: http://localhost:3100
  5. Click Save & Test

You can now explore logs directly in Grafana and correlate them with metrics from Prometheus.

Step 4: Setting Up Essential Dashboards

With all components installed, it's time to create dashboards that provide actionable insights.

System Metrics Dashboard

Create a dashboard that monitors:

  • CPU usage: Track processor utilization across cores
  • Memory consumption: Monitor RAM usage and swap activity
  • Disk I/O: Watch read/write operations and latency
  • Network traffic: Measure bandwidth usage and packet rates

Grafana's community library offers excellent pre-built dashboards like the Node Exporter Full dashboard (ID: 1860) that you can import and customize.

Application Metrics Dashboard

If you're running web applications, create dashboards for:

  • HTTP request rates and response times
  • Error rates and status code distributions
  • Database query performance
  • Application-specific business metrics

Log Analysis Dashboard

Build a dashboard that combines Loki logs with Prometheus metrics:

  • Recent error logs with severity filtering
  • Authentication attempts and failures
  • Application error patterns over time
  • Correlation between metric spikes and log events

Best Practices for 2026

As you operate your monitoring stack, follow these best practices:

Security Considerations

  • Enable authentication: Never expose Prometheus, Grafana, or Loki to the internet without authentication
  • Use reverse proxy: Place Nginx or Caddy in front of your services with SSL/TLS certificates
  • Implement RBAC: Use Grafana's role-based access control to limit user permissions
  • Regular updates: Keep all components updated to patch security vulnerabilities

Performance Optimization

  • Retention policies: Configure appropriate data retention to balance storage and historical analysis needs
  • Scrape intervals: Adjust Prometheus scrape intervals based on your monitoring requirements (15-60 seconds is typical)
  • Resource limits: Set memory and CPU limits to prevent monitoring from impacting application performance
  • Query optimization: Use recording rules in Prometheus for frequently-used complex queries

Alerting Strategy

  • Define SLOs: Establish Service Level Objectives before creating alerts
  • Avoid alert fatigue: Only alert on actionable issues that require human intervention
  • Use severity levels: Categorize alerts as critical, warning, or informational
  • Test alert rules: Regularly verify that alerts fire correctly and reach the right people

Conclusion

You've now built a complete, production-ready monitoring stack on your VPS using Prometheus, Grafana, and Loki. This foundation provides comprehensive observability into your infrastructure and applications, enabling you to:

  • Detect and diagnose issues before they impact users
  • Understand system behavior and performance trends
  • Make data-driven decisions about capacity and scaling
  • Maintain detailed audit trails through centralized logging

As you become more comfortable with these tools, explore advanced features like Prometheus federation for multi-cluster monitoring, Grafana alerting for sophisticated notification workflows, and Loki's LogQL for powerful log analysis.

The monitoring stack you've built today will scale with your infrastructure, providing visibility and insights as your systems grow in complexity. Remember that monitoring is not a one-time setup—it's an ongoing practice that evolves with your infrastructure and organizational needs.

Start simple, monitor what matters, and iterate based on what you learn from your data.