Back to articles
Technology Insight

Build a Free All-in-One Monitoring System: Prometheus + Grafana + Alertmanager on a 1GB RAM VPS

May 18, 2026

Introduction: The Need for Cost-Effective Monitoring

In today's digital landscape, system monitoring is no longer a luxury—it's a necessity. Whether you're running a small startup, a personal project, or managing infrastructure for a growing business, visibility into your systems' health is crucial. However, enterprise monitoring solutions often come with significant costs and complexity that can be prohibitive for smaller operations.

This is where open-source tools like Prometheus, Grafana, and Alertmanager shine. Together, they form a powerful, flexible monitoring stack that rivals commercial solutions. The best part? You can run this entire system on a modest virtual private server (VPS) with just 1GB of RAM, making professional-grade monitoring accessible to everyone.

Understanding the Monitoring Stack Components

Before we dive into implementation, let's understand what each component brings to our monitoring ecosystem:

Prometheus: The Metrics Collector

Prometheus is a time-series database and monitoring system designed for reliability and scalability. It works on a pull model, periodically scraping metrics from configured targets. Key features include:

  • Multi-dimensional data model with time series identified by metric name and key/value pairs
  • Powerful query language (PromQL) for slicing and dicing collected time series data
  • No reliance on distributed storage; single server nodes are autonomous
  • Service discovery or static configuration for target discovery
  • Multiple modes of graphing and dashboarding support

Grafana: The Visualization Layer

Grafana is the leading open-source platform for monitoring and observability. It allows you to query, visualize, alert on, and understand your metrics no matter where they are stored. With Grafana, you can:

  • Create, explore, and share beautiful dashboards
  • Query and visualize data from Prometheus and other data sources
  • Set up alert rules with notifications to various channels
  • Use templates and variables to create dynamic, reusable dashboards

Alertmanager: The Notification Engine

Alertmanager handles alerts sent by client applications such as Prometheus. It takes care of deduplicating, grouping, and routing them to the correct receiver integrations such as email, Slack, or PagerDuty. Its key capabilities include:

  • Grouping of alerts into single notifications to reduce noise
  • Inhibition and silencing of alerts during maintenance windows
  • Deduplication of alerts to prevent notification storms
  • Routing to different receivers based on alert labels

System Requirements and Preparation

For this implementation, we'll use a VPS with the following minimum specifications:

  • 1GB RAM (minimum, 2GB recommended for production)
  • 20GB SSD storage (for metrics retention)
  • Ubuntu 22.04 LTS or similar Linux distribution
  • Root or sudo access to the server

Before installation, ensure your system is up to date:

  1. Update package lists: sudo apt update
  2. Upgrade existing packages: sudo apt upgrade -y
  3. Install essential utilities: sudo apt install -y curl wget git vim

Step-by-Step Installation Guide

1. Installing Prometheus

We'll install Prometheus from the official binaries for better control and version management:

First, create a dedicated user for Prometheus:

sudo useradd --no-create-home --shell /bin/false prometheus
sudo mkdir /etc/prometheus
sudo mkdir /var/lib/prometheus
sudo chown prometheus:prometheus /etc/prometheus
sudo chown prometheus:prometheus /var/lib/prometheus

Download and install the latest stable version:

cd /tmp
wget https://github.com/prometheus/prometheus/releases/download/v2.47.0/prometheus-2.47.0.linux-amd64.tar.gz
tar xvf prometheus-2.47.0.linux-amd64.tar.gz
cd prometheus-2.47.0.linux-amd64
sudo cp prometheus promtool /usr/local/bin/
sudo cp -r consoles/ console_libraries/ /etc/prometheus/
sudo chown prometheus:prometheus /usr/local/bin/prometheus
sudo chown prometheus:prometheus /usr/local/bin/promtool
sudo chown -R prometheus:prometheus /etc/prometheus

2. Configuring Prometheus

Create a basic configuration file at /etc/prometheus/prometheus.yml:

global:
  scrape_interval: 15s
  evaluation_interval: 15s

alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093

rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']

  - job_name: 'node'
    static_configs:
      - targets: ['localhost:9100']

3. Setting Up Prometheus as a Service

Create a systemd service file at /etc/systemd/system/prometheus.service:

[Unit]
Description=Prometheus
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.console.templates=/etc/prometheus/consoles \
    --web.console.libraries=/etc/prometheus/console_libraries \
    --web.listen-address=0.0.0.0:9090 \
    --web.external-url=

[Install]
WantedBy=multi-user.target

Start and enable the service:

sudo systemctl daemon-reload
sudo systemctl start prometheus
sudo systemctl enable prometheus

4. Installing Node Exporter

Node Exporter collects system metrics from the host machine:

cd /tmp
wget https://github.com/prometheus/node_exporter/releases/download/v1.6.0/node_exporter-1.6.0.linux-amd64.tar.gz
tar xvf node_exporter-1.6.0.linux-amd64.tar.gz
cd node_exporter-1.6.0.linux-amd64
sudo cp node_exporter /usr/local/bin/
sudo chown prometheus:prometheus /usr/local/bin/node_exporter

Create a systemd service for Node Exporter:

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

[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/node_exporter

[Install]
WantedBy=multi-user.target

5. Installing Grafana

Add the Grafana repository and install:

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 -y grafana

Start and enable Grafana:

sudo systemctl daemon-reload
sudo systemctl start grafana-server
sudo systemctl enable grafana-server

6. Installing Alertmanager

Download and install Alertmanager:

cd /tmp
wget https://github.com/prometheus/alertmanager/releases/download/v0.25.0/alertmanager-0.25.0.linux-amd64.tar.gz
tar xvf alertmanager-0.25.0.linux-amd64.tar.gz
cd alertmanager-0.25.0.linux-amd64
sudo cp alertmanager amtool /usr/local/bin/
sudo mkdir /etc/alertmanager
sudo cp alertmanager.yml /etc/alertmanager/
sudo chown -R prometheus:prometheus /etc/alertmanager
sudo chown prometheus:prometheus /usr/local/bin/alertmanager
sudo chown prometheus:prometheus /usr/local/bin/amtool

Configuration and Optimization for 1GB RAM

Running all three components on limited memory requires careful configuration:

Memory Optimization Tips

  • Reduce retention period: Adjust Prometheus retention to 15-30 days instead of default 15 days
  • Limit scrape targets: Only monitor essential services
  • Adjust chunk sizes: Modify Prometheus storage settings for smaller memory footprint
  • Use swap space: Configure 1-2GB of swap as emergency buffer

Updated Prometheus Configuration for Low Memory

global:
  scrape_interval: 30s  # Increased from 15s
  evaluation_interval: 30s
  scrape_timeout: 10s

storage:
  tsdb:
    retention.time: 15d  # Reduced from default
    max-block-duration: 2h  # Smaller blocks for less memory
    min-block-duration: 2h

# Rest of configuration remains similar

Integrating the Components

Connecting Grafana to Prometheus

  1. Access Grafana at http://your-server-ip:3000 (default credentials: admin/admin)
  2. Navigate to Configuration → Data Sources → Add data source
  3. Select Prometheus
  4. Set URL to http://localhost:9090
  5. Click Save & Test

Configuring Alertmanager with Prometheus

Update /etc/prometheus/prometheus.yml to include Alertmanager:

alerting:
  alertmanagers:
    - static_configs:
        - targets:
          - localhost:9093

Create basic alert rules at /etc/prometheus/rules.yml:

groups:
  - name: host_alerts
    rules:
      - alert: HighMemoryUsage
        expr: (node_memory_MemTotal_bytes - node_memory_MemAvailable_bytes) / node_memory_MemTotal_bytes * 100 > 85
        for: 5m
        labels:
          severity: warning
        annotations:
          summary: "High memory usage on {{ $labels.instance }}"
          description: "Memory usage is above 85% for 5 minutes"

Creating Your First Dashboard

Grafana makes dashboard creation intuitive. Here's how to create a basic system monitoring dashboard:

  1. Click the + icon → Create → Dashboard
  2. Add a new panel
  3. Set data source to Prometheus
  4. Use PromQL queries like:
    • CPU usage: 100 - (avg by (instance) (rate(node_cpu_seconds_total{mode="idle"}[5m])) * 100)
    • Memory usage: (node_memory_MemTotal_bytes - node_memory_MemAvailable_bytes) / node_memory_MemTotal_bytes * 100
    • Disk usage: 100 - (node_filesystem_avail_bytes{mountpoint="/"} / node_filesystem_size_bytes{mountpoint="/"} * 100)
  5. Customize visualization types and thresholds
  6. Set up alerts directly from panel settings

Security Considerations

When exposing monitoring interfaces to the internet, security is paramount:

  • Use reverse proxy: Configure Nginx or Apache as a reverse proxy with SSL
  • Implement authentication: Use Grafana's built-in auth or integrate with OAuth providers
  • Restrict access: Use firewall rules to limit access to specific IPs
  • Regular updates: Keep all components updated with security patches
  • Separate networks: Consider running monitoring on a separate VLAN if possible

Maintenance and Best Practices

Regular Maintenance Tasks

  • Monitor disk usage of Prometheus data directory
  • Review and prune old dashboards and alert rules
  • Test alert notifications regularly
  • Backup Grafana dashboards and Prometheus rules
  • Update components during maintenance windows

Performance Monitoring

Monitor the monitoring stack itself using these metrics:

  • Prometheus memory usage: process_resident_memory_bytes
  • Scrape durations: prometheus_target_interval_length_seconds
  • Grafana performance: Use built-in metrics endpoint
  • Alertmanager queue: alertmanager_alerts_queued

Scaling Beyond 1GB RAM

As your monitoring needs grow, consider these scaling strategies:

  • Upgrade VPS: Move to 2GB or 4GB RAM instances
  • Separate components: Run Prometheus, Grafana, and Alertmanager on different servers
  • Implement federation: Use Prometheus federation for multi-server environments
  • Add caching: Implement Redis or similar for Grafana dashboard caching
  • Use remote storage: Offload long-term metrics to object storage

Conclusion: Enterprise Monitoring on a Budget

Building a complete monitoring system with Prometheus, Grafana, and Alertmanager on a 1GB RAM VPS demonstrates that powerful observability doesn't require massive infrastructure investments. This stack provides:

  • Comprehensive monitoring of systems, applications, and services
  • Beautiful visualizations that make data actionable
  • Proactive alerting to prevent issues before they affect users
  • Complete control over your monitoring infrastructure
  • Zero licensing costs with full enterprise capabilities

The flexibility of this open-source stack means you can start small and scale as needed. Whether you're monitoring a single server or building the foundation for a larger infrastructure, this solution provides professional-grade monitoring that grows with your needs.

Remember that monitoring is not a set-and-forget system. Regularly review your metrics, refine your dashboards, and adjust alert thresholds based on actual usage patterns. With this foundation in place, you'll have the visibility needed to make informed decisions and maintain system reliability.