{"id":1854,"date":"2026-09-05T09:25:12","date_gmt":"2026-09-05T03:55:12","guid":{"rendered":"https:\/\/cpanelfree.com\/blog\/how-to-setup-grafana-prometheus-server-monitoring-vps\/"},"modified":"2026-09-05T12:58:17","modified_gmt":"2026-09-05T07:28:17","slug":"how-to-setup-grafana-prometheus-server-monitoring-vps","status":"publish","type":"post","link":"https:\/\/cpanelfree.com\/blog\/how-to-setup-grafana-prometheus-server-monitoring-vps\/","title":{"rendered":"How to Set Up Prometheus and Grafana Server Monitoring on Ubuntu Linux VPS"},"content":{"rendered":"<h2>Why Real-Time Server Observability is Essential for Webmasters<\/h2>\n<p>Operating production web servers without continuous monitoring is like flying blind. Hardware failures, disk space exhaustion, memory leaks in PHP-FPM, or rogue MySQL queries can cause critical server outages hours before you receive an email complaint from frustrated customers. Relying on periodic manual SSH checks is insufficient for maintaining 99.99% service level agreements (SLAs).<\/p>\n<p>The industry-standard open-source observability stack combines **Prometheus** (a high-performance time-series metric collector and storage engine), **Node Exporter** (a lightweight kernel telemetry agent), and **Grafana** (a rich visual dashboard suite). Together, this stack gives you real-time visual insight into CPU loads, per-disk NVMe I\/O operations, network throughput, memory fragmentation, and automated alerting via Discord, Telegram, or email.<\/p>\n<p>In this technical observability tutorial, we will configure Prometheus, Node Exporter, and Grafana on Ubuntu 24.04\/22.04 LTS, create pre-built system dashboards, and protect the monitoring portal behind an Nginx reverse proxy with SSL.<\/p>\n<h2>Step 1: Installing Node Exporter Telemetry Agent<\/h2>\n<p>Node Exporter collects detailed hardware and OS metrics directly from the Linux kernel:<\/p>\n<pre><code># Create dedicated system user\nsudo useradd --no-create-home --shell \/bin\/false node_exporter\n\n# Download latest Node Exporter binary\ncd \/tmp\ncurl -LO https:\/\/github.com\/prometheus\/node_exporter\/releases\/download\/v1.8.1\/node_exporter-1.8.1.linux-amd64.tar.gz\ntar -xvf node_exporter-1.8.1.linux-amd64.tar.gz\nsudo mv node_exporter-1.8.1.linux-amd64\/node_exporter \/usr\/local\/bin\/\nsudo chown node_exporter:node_exporter \/usr\/local\/bin\/node_exporter<\/code><\/pre>\n<p>Create the systemd service file at <code>\/etc\/systemd\/system\/node_exporter.service<\/code>:<\/p>\n<pre><code>[Unit]\nDescription=Node Exporter Hardware Telemetry Agent\nAfter=network.target\n\n[Service]\nUser=node_exporter\nGroup=node_exporter\nType=simple\nExecStart=\/usr\/local\/bin\/node_exporter\n\n[Install]\nWantedBy=multi-user.target<\/code><\/pre>\n<p>Start and enable Node Exporter:<\/p>\n<pre><code>sudo systemctl daemon-reload\nsudo systemctl enable --now node_exporter\nsudo systemctl status node_exporter --no-pager<\/code><\/pre>\n<h2>Step 2: Installing and Configuring Prometheus TSDB<\/h2>\n<p>Prometheus periodically polls (scrapes) metrics from Node Exporter and stores them in a highly compressed time-series database:<\/p>\n<pre><code># Create dedicated user and directories\nsudo useradd --no-create-home --shell \/bin\/false prometheus\nsudo mkdir -p \/etc\/prometheus \/var\/lib\/prometheus\nsudo chown prometheus:prometheus \/etc\/prometheus \/var\/lib\/prometheus\n\n# Download Prometheus binary\ncd \/tmp\ncurl -LO https:\/\/github.com\/prometheus\/prometheus\/releases\/download\/v2.52.0\/prometheus-2.52.0.linux-amd64.tar.gz\ntar -xvf prometheus-2.52.0.linux-amd64.tar.gz\nsudo mv prometheus-2.52.0.linux-amd64\/prometheus \/usr\/local\/bin\/\nsudo mv prometheus-2.52.0.linux-amd64\/promtool \/usr\/local\/bin\/\nsudo chown prometheus:prometheus \/usr\/local\/bin\/prometheus \/usr\/local\/bin\/promtool<\/code><\/pre>\n<p>Create configuration file <code>\/etc\/prometheus\/prometheus.yml<\/code>:<\/p>\n<pre><code>global:\n  scrape_interval: 15s\n  evaluation_interval: 15s\n\nscrape_configs:\n  - job_name: 'prometheus'\n    static_configs:\n      - targets: ['localhost:9090']\n\n  - job_name: 'node_exporter'\n    static_configs:\n      - targets: ['localhost:9100']<\/code><\/pre>\n<p>Create systemd service <code>\/etc\/systemd\/system\/prometheus.service<\/code>:<\/p>\n<pre><code>[Unit]\nDescription=Prometheus Time-Series Monitoring Engine\nAfter=network.target\n\n[Service]\nUser=prometheus\nGroup=prometheus\nType=simple\nExecStart=\/usr\/local\/bin\/prometheus     --config.file=\/etc\/prometheus\/prometheus.yml     --storage.tsdb.path=\/var\/lib\/prometheus\/     --web.listen-address=127.0.0.1:9090\n\n[Install]\nWantedBy=multi-user.target<\/code><\/pre>\n<p>Start Prometheus:<\/p>\n<pre><code>sudo systemctl daemon-reload\nsudo systemctl enable --now prometheus<\/code><\/pre>\n<h2>Step 3: Installing Grafana Dashboard Portal<\/h2>\n<p>Install the official Grafana enterprise repository on Ubuntu:<\/p>\n<pre><code># Add Grafana GPG key and APT repository\nsudo apt install -y apt-transport-https software-properties-common wget\nsudo mkdir -p \/etc\/apt\/keyrings\/\nwget -q -O - https:\/\/apt.grafana.com\/gpg.key | gpg --dearmor | sudo tee \/etc\/apt\/keyrings\/grafana.gpg &gt; \/dev\/null\necho \"deb [signed-by=\/etc\/apt\/keyrings\/grafana.gpg] https:\/\/apt.grafana.com stable main\" | sudo tee \/etc\/apt\/sources.list.d\/grafana.list\n\nsudo apt update &amp;&amp; sudo apt install -y grafana\nsudo systemctl enable --now grafana-server<\/code><\/pre>\n<h2>Step 4: Nginx Reverse Proxy with SSL for Grafana<\/h2>\n<p>Create <code>\/etc\/nginx\/sites-available\/monitor.example.com<\/code>:<\/p>\n<pre><code>server {\n    listen 80;\n    server_name monitor.example.com;\n\n    location \/ {\n        proxy_pass http:\/\/127.0.0.1:3000;\n        proxy_set_header Host $host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_set_header X-Forwarded-Proto $scheme;\n    }\n}<\/code><\/pre>\n<p>Enable the virtual host and acquire an SSL certificate:<\/p>\n<pre><code>sudo ln -s \/etc\/nginx\/sites-available\/monitor.example.com \/etc\/nginx\/sites-enabled\/\nsudo nginx -t &amp;&amp; sudo systemctl reload nginx\nsudo certbot --nginx -d monitor.example.com<\/code><\/pre>\n<h2>Step 5: Importing Node Exporter Full Dashboard (ID: 1860)<\/h2>\n<p>Log in to your Grafana portal (default user: <code>admin<\/code>, password: <code>admin<\/code>), add Prometheus (<code>http:\/\/127.0.0.1:9090<\/code>) as a Data Source, and click <strong>Dashboards &gt; Import<\/strong>. Enter Dashboard ID <strong>1860<\/strong> (Node Exporter Full) to instantly unlock enterprise-grade real-time monitoring charts for CPU cores, RAM allocations, disk I\/O, network bandwidth, and system load.<\/p>\n<h2>Prometheus &amp; Grafana Observability Matrix<\/h2>\n<table style=\"width: 100%;border-collapse: collapse;margin: 20px 0;border: 1px solid #334155\">\n<thead>\n<tr style=\"background-color: #0f172a;color: #38bdf8\">\n<th style=\"padding: 12px;border: 1px solid #334155\">Observability Layer<\/th>\n<th style=\"padding: 12px;border: 1px solid #334155\">Component<\/th>\n<th style=\"padding: 12px;border: 1px solid #334155\">Port \/ Endpoint<\/th>\n<th style=\"padding: 12px;border: 1px solid #334155\">Resource Overhead<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr style=\"background-color: #1e293b;color: #f8fafc\">\n<td style=\"padding: 10px;border: 1px solid #334155\"><strong>Metrics Collector<\/strong><\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\">Node Exporter<\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\"><code>127.0.0.1:9100\/metrics<\/code><\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\">~12 MB RAM (&lt; 0.1% CPU)<\/td>\n<\/tr>\n<tr style=\"background-color: #0f172a;color: #f8fafc\">\n<td style=\"padding: 10px;border: 1px solid #334155\"><strong>Time-Series DB<\/strong><\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\">Prometheus Server<\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\"><code>127.0.0.1:9090<\/code><\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\">~45 MB RAM<\/td>\n<\/tr>\n<tr style=\"background-color: #1e293b;color: #f8fafc\">\n<td style=\"padding: 10px;border: 1px solid #334155\"><strong>Visualization Portal<\/strong><\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\">Grafana Server<\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\"><code>127.0.0.1:3000<\/code><\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\">~55 MB RAM<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Configuring Prometheus Alertmanager for Discord &amp; Email Alerts<\/h2>\n<p>Observability is incomplete without proactive alerting. <strong>Alertmanager<\/strong> intercepts metrics from Prometheus and routes real-time notifications to Discord webhooks, Slack channels, or email addresses whenever thresholds are breached (e.g., CPU &gt; 90% for 5 minutes, or disk space &lt; 10%):<\/p>\n<pre><code># Create Prometheus alert rules file (\/etc\/prometheus\/alert.rules.yml)\ngroups:\n  - name: ServerAlerts\n    rules:\n      - alert: HighCpuUsage\n        expr: 100 - (avg by (instance) (rate(node_cpu_seconds_total{mode=\"idle\"}[5m])) * 100) &gt; 85\n        for: 5m\n        labels:\n          severity: critical\n        annotations:\n          summary: \"High CPU Usage detected on {{ $labels.instance }}\"\n          description: \"CPU load is above 85% for more than 5 minutes.\"\n\n      - alert: LowDiskSpace\n        expr: (node_filesystem_avail_bytes{mountpoint=\"\/\"} \/ node_filesystem_size_bytes{mountpoint=\"\/\"}) * 100 &lt; 15\n        for: 2m\n        labels:\n          severity: warning\n        annotations:\n          summary: &quot;Disk space running low on {{ $labels.instance }}&quot;\n          description: &quot;Root partition free space is below 15%.&quot;<\/code><\/pre>\n<h2>Securing Prometheus &amp; Node Exporter Behind Internal Localhost<\/h2>\n<p>Never expose Prometheus port <code>9090<\/code> or Node Exporter port <code>9100<\/code> to the public internet without authentication. Always bind their listening sockets to <code>127.0.0.1<\/code> and access the monitoring UI exclusively through Grafana behind Nginx SSL.<\/p>\n<pre><code># Verify listening ports are restricted to loopback\nsudo ss -tulpn | grep -E \"(9090|9100)\"\n# Output should show 127.0.0.1:9090 and 127.0.0.1:9100 only<\/code><\/pre>\n<div style=\"background-color: #0f172a;border-left: 4px solid #38bdf8;padding: 18px 24px;margin: 30px 0;border-radius: 8px\">\n<h3 style=\"color: #38bdf8;margin-top: 0\">Recommended Related Technical Guides<\/h3>\n<ul style=\"margin-bottom: 0;color: #cbd5e1\">\n<li><a href=\"https:\/\/cpanelfree.com\/blog\/top-10-essential-linux-terminal-commands-webmasters-2026\/\" style=\"color: #38bdf8;text-decoration: underline\">Top 10 Essential Linux Terminal Commands for Webmasters<\/a><\/li>\n<li><a href=\"https:\/\/cpanelfree.com\/blog\/how-to-secure-linux-vps-fail2ban-ufw-ssh\/\" style=\"color: #38bdf8;text-decoration: underline\">Securing Linux Cloud VPS with UFW &amp; Fail2ban<\/a><\/li>\n<li><a href=\"https:\/\/cpanelfree.com\/blog\/how-to-optimize-mysql-mariadb-high-traffic-vps\/\" style=\"color: #38bdf8;text-decoration: underline\">Optimizing MySQL &amp; MariaDB for High-Traffic Workloads<\/a><\/li>\n<\/ul>\n<\/div>\n<div style=\"background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);color: #ffffff;padding: 28px;border-radius: 12px;margin: 35px 0;text-align: center\">\n<h3 style=\"color: #ffffff;margin-top: 0;font-size: 22px\">Deploy Monitored High-Performance Cloud VPS on CpanelFree<\/h3>\n<p style=\"color: #e0f2fe;font-size: 15px;max-width: 650px;margin: 0 auto 18px auto\">Gain complete visibility over your cloud infrastructure with dedicated enterprise compute, ultra-low latency NVMe storage, and 100% free hosting options.<\/p>\n<p>  <a href=\"https:\/\/cpanelfree.com\/\" style=\"background-color: #ffffff;color: #0284c7;font-weight: 700;padding: 12px 28px;border-radius: 8px;text-decoration: none;display: inline-block\">Get Free Cloud Hosting Today &rarr;<\/a>\n<\/div>\n<div style=\"border-left: 4px solid #38bdf8;border-radius: 8px;padding: 20px;margin: 30px 0\">\n<h3 style=\"margin-top: 0;color: #38bdf8;font-size: 18px;display: flex;align-items: center\">\n        <span style=\"margin-right: 8px\">\ud83d\udd17<\/span> Recommended Related Technical Guides:<br \/>\n    <\/h3>\n<ul style=\"margin: 10px 0 0 0;padding-left: 20px;line-height: 1.8\">\n<li><a href=\"https:\/\/cpanelfree.com\/blog\/how-to-host-website-free-forever-guide\/\" style=\"color: #38bdf8;text-decoration: none;font-weight: 600\">How to Host a Website for Free Forever: Complete Beginner Guide (2026)<\/a><\/li>\n<li><a href=\"https:\/\/cpanelfree.com\/blog\/free-wordpress-hosting-softaculous-installer\/\" style=\"color: #38bdf8;text-decoration: none;font-weight: 600\">Top 5 Free WordPress Hosting Services with 1-Click Softaculous Installer<\/a><\/li>\n<li><a href=\"https:\/\/cpanelfree.com\/blog\/how-to-backup-linux-vps-to-cloud-storage-s3-rclone\/\" style=\"color: #38bdf8;text-decoration: none;font-weight: 600\">How to Automatically Backup Your Linux VPS to Cloud Storage (S3 \/ Rclone Guide)<\/a><\/li>\n<li><a href=\"https:\/\/cpanelfree.com\/blog\/how-to-setup-crowdsec-waf-nginx-bouncer-web-security\/\" style=\"color: #38bdf8;text-decoration: none;font-weight: 600\">How to Set Up Crowdsec WAF and Nginx Bouncer for Web Application Security<\/a><\/li>\n<li><a href=\"https:\/\/cpanelfree.com\/#plans\" style=\"color: #10b981;text-decoration: none;font-weight: 600\">Explore $0 Free cPanel Web Hosting Plans (NVMe SSD, AutoSSL)<\/a><\/li>\n<\/ul>\n<\/div>\n<div style=\"background: linear-gradient(135deg, rgba(6, 182, 212, 0.15) 0%, rgba(59, 130, 246, 0.15) 100%);border-radius: 12px;padding: 25px;margin: 30px 0;text-align: center\">\n<h3 style=\"color: #38bdf8;margin-top: 0;font-size: 20px\">Deploy Fast, Reliable Web Hosting on CpanelFree<\/h3>\n<p style=\"color: #94a3b8;font-size: 14px;line-height: 1.6;max-width: 600px;margin: 0 auto 15px\">\n        Get genuine cPanel control, unmetered NVMe SSD storage, and free AutoSSL at $0 cost forever.\n    <\/p>\n<p>    <a href=\"https:\/\/cpanelfree.com\/#plans\" style=\"display: inline-block;background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);color: #ffffff;padding: 10px 22px;border-radius: 6px;text-decoration: none;font-weight: bold;font-size: 14px\">Claim Free Hosting Account<\/a>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Why Real-Time Server Observability is Essential for Webmasters Operating production web servers without continuous monitoring is like flying blind. Hardware failures, disk space exhaustion, memory leaks in PHP-FPM, or rogue MySQL queries can cause critical server outages hours before you receive an email complaint from frustrated customers. Relying on periodic manual SSH checks is insufficient [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2499,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[166],"tags":[],"class_list":["post-1854","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-developer-stacks"],"_links":{"self":[{"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/posts\/1854","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/comments?post=1854"}],"version-history":[{"count":2,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/posts\/1854\/revisions"}],"predecessor-version":[{"id":2299,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/posts\/1854\/revisions\/2299"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/media\/2499"}],"wp:attachment":[{"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/media?parent=1854"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/categories?post=1854"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/tags?post=1854"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}