Monitoring your VPS is like giving it a set of health sensors — CPU, RAM, disk, network traffic, and more. With Prometheus and Grafana, you can see real-time stats and historical trends from a clean web interface.
Step 1: Prepare Your VPS
-
Make sure your VPS is updated:
-
Install essential tools:
-
Open firewall ports for Prometheus (9090) and Grafana (3000):
Step 2: Install Prometheus
-
Download Prometheus:
-
Start Prometheus:
-
Access Prometheus in your browser:
-
Add a simple node exporter to collect system metrics:
Step 3: Install Grafana
-
Add Grafana repository and install:
-
Start Grafana:
-
Access Grafana:
-
Default login:
admin/admin -
You’ll be prompted to change your password.
Step 4: Connect Prometheus to Grafana
-
In Grafana, go to Configuration → Data Sources → Add Data Source
-
Choose Prometheus
-
Set URL to:
-
Click Save & Test
Step 5: Create Dashboards
-
Go to Create → Dashboard → Add Panel
-
Use Prometheus queries, e.g.:
-
CPU Usage:
-
Memory Usage:
-
Disk Usage:
-
Save dashboard and enjoy real-time monitoring of your VPS.
✅ Tips & Best Practices
-
Use alerts in Grafana to notify you when CPU, RAM, or disk usage is high.
-
Run Prometheus and Grafana behind a reverse proxy like Nginx for secure HTTPS access.
-
Combine node exporters with cAdvisor to monitor Docker containers if you run them.
-
Set retention rules in Prometheus to save historical data without overloading your VPS.
Your VPS now has a robust monitoring system. You can track performance trends, detect issues early, and optimize resource usage efficiently.