{"id":1373,"date":"2025-11-05T20:59:41","date_gmt":"2025-11-05T17:59:41","guid":{"rendered":"https:\/\/www.dchost.com\/blog\/the-playbook-i-use-to-keep-a-vps-calm-prometheus-grafana-node-exporter-for-alerts-that-actually-help\/"},"modified":"2026-11-04T10:35:36","modified_gmt":"2026-11-04T07:35:36","slug":"vps-monitoring-prometheus-grafana","status":"publish","type":"post","link":"https:\/\/www.dchost.com\/blog\/en\/vps-monitoring-prometheus-grafana\/","title":{"rendered":"VPS Monitoring: Prometheus, Grafana and Node Exporter"},"content":{"rendered":"<div class=\"dchost-blog-content-wrapper\"><p>When a <a href=\"https:\/\/www.dchost.com\/vps\">VPS<\/a> slows down, a current process list cannot show what changed an hour earlier. Prometheus metrics let you compare CPU time, available memory, filesystem space and device activity on a shared timeline. Alert rules can prompt an investigation when a defined condition persists. Monitoring does not prevent failures or guarantee detection before users are affected.<\/p>\n<p>This guide builds a new, native systemd installation on one Linux amd64 VPS using <strong>Node Exporter 1.12.1, Prometheus 3.15.1 and Alertmanager 0.34.2<\/strong>, checked on 4 November 2026. Grafana is installed separately on the same host. Metrics and management listeners bind to loopback. Prepare all files before starting services; keep target labels, thresholds and notification routes consistent throughout the installation.<\/p>\n<div id=\"toc_container\" role=\"navigation\" aria-label=\"Table of Contents\" data-nosnippet class=\"toc_transparent no_bullets toc_numbered toc_title_center\"><p class=\"toc_title\">\u0130\u00e7indekiler<\/p><ul class=\"toc_list\"><li><a href=\"#Choose_Signals_That_Support_an_Investigation\"><span class=\"toc_number toc_depth_1\">1.<\/span> Choose Signals That Support an Investigation<\/a><\/li><li><a href=\"#Architecture_One_Host_with_Local_Access\"><span class=\"toc_number toc_depth_1\">2.<\/span> Architecture: One Host with Local Access<\/a><\/li><li><a href=\"#Install_Official_Binaries_and_Node_Exporter\"><span class=\"toc_number toc_depth_1\">3.<\/span> Install Official Binaries and Node Exporter<\/a><ul><li><a href=\"#Step_1_Verify_Downloads_and_Create_Accounts\"><span class=\"toc_number toc_depth_2\">3.1.<\/span> Step 1: Verify Downloads and Create Accounts<\/a><\/li><li><a href=\"#Step_2_Define_the_Node_Exporter_Service\"><span class=\"toc_number toc_depth_2\">3.2.<\/span> Step 2: Define the Node Exporter Service<\/a><\/li><li><a href=\"#Step_3_Verify_the_Intended_Listener\"><span class=\"toc_number toc_depth_2\">3.3.<\/span> Step 3: Verify the Intended Listener<\/a><\/li><\/ul><\/li><li><a href=\"#Configure_Prometheus_Rules_and_Alertmanager\"><span class=\"toc_number toc_depth_1\">4.<\/span> Configure Prometheus, Rules and Alertmanager<\/a><ul><li><a href=\"#Step_1_Set_the_Target_and_Alertmanager_Address\"><span class=\"toc_number toc_depth_2\">4.1.<\/span> Step 1: Set the Target and Alertmanager Address<\/a><\/li><li><a href=\"#Step_2_Write_Valid_Host_Alert_Rules\"><span class=\"toc_number toc_depth_2\">4.2.<\/span> Step 2: Write Valid Host Alert Rules<\/a><\/li><li><a href=\"#Step_3_Configure_the_SMTP_Receiver_and_Service\"><span class=\"toc_number toc_depth_2\">4.3.<\/span> Step 3: Configure the SMTP Receiver and Service<\/a><\/li><\/ul><\/li><li><a href=\"#Set_Up_Grafana_and_Read_the_Right_Units\"><span class=\"toc_number toc_depth_1\">5.<\/span> Set Up Grafana and Read the Right Units<\/a><ul><li><a href=\"#Step_1_Install_Native_Grafana_and_Add_Prometheus\"><span class=\"toc_number toc_depth_2\">5.1.<\/span> Step 1: Install Native Grafana and Add Prometheus<\/a><\/li><li><a href=\"#Step_2_Create_a_Server_Overview\"><span class=\"toc_number toc_depth_2\">5.2.<\/span> Step 2: Create a Server Overview<\/a><\/li><\/ul><\/li><li><a href=\"#Handle_Failed_Scrapes_Missing_Targets_and_Reboots\"><span class=\"toc_number toc_depth_1\">6.<\/span> Handle Failed Scrapes, Missing Targets and Reboots<\/a><\/li><li><a href=\"#Protect_Access_and_Plan_Recovery\"><span class=\"toc_number toc_depth_1\">7.<\/span> Protect Access and Plan Recovery<\/a><\/li><li><a href=\"#Tune_Thresholds_Against_Workload_and_User_Impact\"><span class=\"toc_number toc_depth_1\">8.<\/span> Tune Thresholds Against Workload and User Impact<\/a><\/li><li><a href=\"#Verify_the_Full_Path_and_Troubleshoot_Missing_Data\"><span class=\"toc_number toc_depth_1\">9.<\/span> Verify the Full Path and Troubleshoot Missing Data<\/a><\/li><li><a href=\"#Extend_Collection_and_Retention_Deliberately\"><span class=\"toc_number toc_depth_1\">10.<\/span> Extend Collection and Retention Deliberately<\/a><\/li><li><a href=\"#Accept_the_Installation_with_Recorded_Checks\"><span class=\"toc_number toc_depth_1\">11.<\/span> Accept the Installation with Recorded Checks<\/a><\/li><\/ul><\/div>\n<h2 id='section-1'><span id=\"Choose_Signals_That_Support_an_Investigation\">Choose Signals That Support an Investigation<\/span><\/h2>\n<p>Resource use, latency and customer impact are different signals. High non-idle CPU includes iowait and steal; CPU ready is a separate hypervisor metric, not a standard Node Exporter metric. Low available memory warrants checking workload, swap and limits. High device activity or reported iowait warrants investigating storage latency and queueing. None identifies a particular process, database query or endpoint by itself.<\/p>\n<p>Collect representative quiet and busy periods and annotate deployments and maintenance. Application request latency, errors, order outcomes and queue depth require suitable instrumentation or an additional exporter. Host measurements provide context for these signals. Alerting delay also depends on scrape frequency, evaluation, the rule\u2019s pending duration and delivery; it is not instantaneous.<\/p>\n<h2 id='section-2'><span id=\"Architecture_One_Host_with_Local_Access\">Architecture: One Host with Local Access<\/span><\/h2>\n<p>Node Exporter exposes host metrics at 127.0.0.1:9100. Prometheus scrapes and evaluates rules every 15 seconds, stores the data and sends firing alerts to Alertmanager at 127.0.0.1:9093. Native Grafana queries Prometheus at 127.0.0.1:9090. Prometheus owns the alerts in this guide; creating identical Grafana rules would require an explicit plan to avoid duplicate notifications.<\/p>\n<p>A single host is an accessible starting point, but its failure also stops local collection and alert delivery. Use monitoring or a probe in an independent location for host and service availability. Moving components to another host requires corresponding network, TLS\/authentication and target changes. In separate containers, localhost refers to each container\u2019s own network namespace; the native addresses below are not a Compose configuration.<\/p>\n<p>The <a href=\"https:\/\/prometheus.io\/docs\/alerting\/latest\/overview\/\" rel=\"nofollow noopener\" target=\"_blank\">Prometheus alerting documentation<\/a>, <a href=\"https:\/\/grafana.com\/docs\/grafana\/latest\/\" rel=\"nofollow noopener\" target=\"_blank\">Grafana documentation<\/a> and <a href=\"https:\/\/github.com\/prometheus\/node_exporter\" rel=\"nofollow noopener\" target=\"_blank\">Node Exporter repository<\/a> provide the upstream configuration and installation references. Keep versions, digests and configuration changes in your deployment record. The pinned examples are for a new installation; do not overwrite existing services or monitoring data with these commands.<\/p>\n<h2 id='section-3'><span id=\"Install_Official_Binaries_and_Node_Exporter\">Install Official Binaries and Node Exporter<\/span><\/h2>\n<p>Use a separate service account for each component. Keep executables and configuration root-owned; only Prometheus and Alertmanager data directories need daemon write access. Node Exporter reads host information and an optional textfile directory. Its account should not be able to replace its own executable or manufacture textfile metrics.<\/p>\n<h3><span id=\"Step_1_Verify_Downloads_and_Create_Accounts\">Step 1: Verify Downloads and Create Accounts<\/span><\/h3>\n<p>These commands require a new Ubuntu\/Debian-style Linux installation with systemd, curl, tar, sha256sum and a root Bash shell; use sudo -i first if necessary. uname -m must report x86_64. ARM64 requires its own release archive and verified checksum. Each digest below belongs only to the specified version and architecture. The script installs all three components and their validation tools, but starts no services.<\/p>\n<pre class=\"language-nginx line-numbers\"><code class=\"language-nginx\">set -eu\nworkdir=$(mktemp -d \/tmp\/vps-monitoring.XXXXXX)\ncd &quot;$workdir&quot;\ncurl --fail --location --proto =https --tlsv1.2 -o node_exporter-1.12.1.linux-amd64.tar.gz https:\/\/github.com\/prometheus\/node_exporter\/releases\/download\/v1.12.1\/node_exporter-1.12.1.linux-amd64.tar.gz\nprintf &#039;%s  %s\\n&#039; &#039;b51d8a76aa2a9156a55d501aca6276fae09e262259a5e4e831d2c2222f084e63&#039; &#039;node_exporter-1.12.1.linux-amd64.tar.gz&#039; | sha256sum --check -\ntar -xzf node_exporter-1.12.1.linux-amd64.tar.gz\ninstall -o root -g root -m 0755 node_exporter-1.12.1.linux-amd64\/node_exporter \/usr\/local\/bin\/node_exporter\ncurl --fail --location --proto =https --tlsv1.2 -o prometheus-3.15.1.linux-amd64.tar.gz https:\/\/github.com\/prometheus\/prometheus\/releases\/download\/v3.15.1\/prometheus-3.15.1.linux-amd64.tar.gz\nprintf &#039;%s  %s\\n&#039; &#039;6a726885328ad9efebbf36e876ce2fb6225468a71fd1e7ce3ba666d5f4d97a84&#039; &#039;prometheus-3.15.1.linux-amd64.tar.gz&#039; | sha256sum --check -\ntar -xzf prometheus-3.15.1.linux-amd64.tar.gz\ninstall -o root -g root -m 0755 prometheus-3.15.1.linux-amd64\/prometheus \/usr\/local\/bin\/prometheus\ninstall -o root -g root -m 0755 prometheus-3.15.1.linux-amd64\/promtool \/usr\/local\/bin\/promtool\ncurl --fail --location --proto =https --tlsv1.2 -o alertmanager-0.34.2.linux-amd64.tar.gz https:\/\/github.com\/prometheus\/alertmanager\/releases\/download\/v0.34.2\/alertmanager-0.34.2.linux-amd64.tar.gz\nprintf &#039;%s  %s\\n&#039; &#039;17ee14acd0f6ba6e25a436ff223d9c17ddd5cf484f543ad12f0932eaa89ba186&#039; &#039;alertmanager-0.34.2.linux-amd64.tar.gz&#039; | sha256sum --check -\ntar -xzf alertmanager-0.34.2.linux-amd64.tar.gz\ninstall -o root -g root -m 0755 alertmanager-0.34.2.linux-amd64\/alertmanager \/usr\/local\/bin\/alertmanager\ninstall -o root -g root -m 0755 alertmanager-0.34.2.linux-amd64\/amtool \/usr\/local\/bin\/amtool\nuseradd --system --no-create-home --shell \/usr\/sbin\/nologin nodeexp\nuseradd --system --no-create-home --shell \/usr\/sbin\/nologin prometheus\nuseradd --system --no-create-home --shell \/usr\/sbin\/nologin alertmanager\ninstall -d -o root -g nodeexp -m 0750 \/var\/lib\/node_exporter \/var\/lib\/node_exporter\/textfile\ninstall -d -o root -g prometheus -m 0750 \/etc\/prometheus \/etc\/prometheus\/rules\ninstall -d -o prometheus -g prometheus -m 0700 \/var\/lib\/prometheus\ninstall -d -o root -g alertmanager -m 0750 \/etc\/alertmanager\ninstall -d -o alertmanager -g alertmanager -m 0700 \/var\/lib\/alertmanager\n<\/code><\/pre>\n<h3><span id=\"Step_2_Define_the_Node_Exporter_Service\">Step 2: Define the Node Exporter Service<\/span><\/h3>\n<p>The service keeps default collectors and filesystem exclusions, binds only to 127.0.0.1:9100 and reads the root-owned textfile directory. When adapting exclusions, use the current &#8211;collector.filesystem.mount-points-exclude flag and confirm that required mounts still appear. The obsolete ignored-mount-points option is not used. Save this unit now; startup is deferred until all configurations and rules are ready.<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">cat &gt; \/etc\/systemd\/system\/node_exporter.service &lt;&lt;&#039;EOF&#039;\n[Unit]\nDescription=node_exporter\nWants=network-online.target\nAfter=network-online.target\n\n[Service]\nUser=nodeexp\nGroup=nodeexp\nType=simple\nExecStart=\/usr\/local\/bin\/node_exporter --web.listen-address=127.0.0.1:9100 --collector.textfile.directory=\/var\/lib\/node_exporter\/textfile\nRestart=on-failure\nRestartSec=5s\nUMask=0027\nNoNewPrivileges=true\n\n[Install]\nWantedBy=multi-user.target\nEOF\n<\/code><\/pre>\n<h3><span id=\"Step_3_Verify_the_Intended_Listener\">Step 3: Verify the Intended Listener<\/span><\/h3>\n<p>After the startup section, inspect listeners and retrieve metrics locally using the commands below. The explicit loopback bind keeps port 9100 off public interfaces; Prometheus and Alertmanager use the same approach. For remote collection, design private network\/VPN and appropriate TLS\/authentication access first. A firewall allow rule alone does not remove broader rules; validate both IPv4 and IPv6 while preserving SSH access.<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">ss -ltnp\ncurl --fail http:\/\/127.0.0.1:9100\/metrics\n<\/code><\/pre>\n<p>Review service logs and required collector metrics after startup. A successful scrape does not prove every collector succeeded; inspect node_scrape_collector_success and, when applicable, node_textfile_scrape_error. Container deployment requires host namespace, filesystem mounts and matching path settings; published ports and firewall behavior must be checked separately. Do not combine container snippets with this native setup without adapting the architecture.<\/p>\n<h2 id='section-4'><span id=\"Configure_Prometheus_Rules_and_Alertmanager\">Configure Prometheus, Rules and Alertmanager<\/span><\/h2>\n<p>The binaries, accounts and directories already exist from Step 1. Prepare the following configuration and systemd files before enabling services. Prometheus uses job=&#8221;node&#8221; and instance=&#8221;vps-01&#8243; consistently. If the instance name changes, update the expected-target absence rule as well. Each instance must remain uniquely identifiable as you add hosts.<\/p>\n<h3><span id=\"Step_1_Set_the_Target_and_Alertmanager_Address\">Step 1: Set the Target and Alertmanager Address<\/span><\/h3>\n<p>This configuration scrapes the local exporter and Prometheus itself, loads rules from \/etc\/prometheus\/rules and explicitly sends alerts through alerting.alertmanagers to 127.0.0.1:9093. The Alertmanager receiver is configured later. An alert visible in Prometheus does not imply that notification routing or SMTP delivery works.<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">cat &gt; \/etc\/prometheus\/prometheus.yml &lt;&lt;&#039;EOF&#039;\nglobal:\n  scrape_interval: 15s\n  evaluation_interval: 15s\nrule_files:\n- \/etc\/prometheus\/rules\/*.yml\nalerting:\n  alertmanagers:\n  - static_configs:\n    - targets:\n      - 127.0.0.1:9093\nscrape_configs:\n- job_name: prometheus\n  static_configs:\n  - targets:\n    - 127.0.0.1:9090\n- job_name: node\n  static_configs:\n  - targets:\n    - 127.0.0.1:9100\n    labels:\n      instance: vps-01\nEOF\n<\/code><\/pre>\n<p>The unit sets 15 days and 2 GB of block retention; whichever limit is reached first removes older blocks. The size limit is not a hard cap on total disk use: WAL, head data and compaction need extra room. These values are a small test starting point, not capacity guidance for every installation. Measure ingestion and leave headroom; local TSDB storage is a single-node database, not a replicated backup.<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">cat &gt; \/etc\/systemd\/system\/prometheus.service &lt;&lt;&#039;EOF&#039;\n[Unit]\nDescription=prometheus\nWants=network-online.target\nAfter=network-online.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 --storage.tsdb.retention.time=15d --storage.tsdb.retention.size=2GB\nExecReload=\/bin\/kill -HUP $MAINPID\nRestart=on-failure\nRestartSec=5s\nUMask=0027\nNoNewPrivileges=true\n\n[Install]\nWantedBy=multi-user.target\nEOF\n<\/code><\/pre>\n<h3><span id=\"Step_2_Write_Valid_Host_Alert_Rules\">Step 2: Write Valid Host Alert Rules<\/span><\/h3>\n<p>The file below has the required groups \u2192 name \u2192 rules structure. Host CPU uses the complement of the per-core idle-rate average, not process_cpu_seconds_total, which measures the exporter process. Non-idle includes iowait and steal; it is not a pure application-busy ratio. MemAvailable includes reclaimable memory and does not identify a leak. Filesystem space, device busy time and reported CPU iowait are separate measurements.<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">cat &gt; \/etc\/prometheus\/rules\/host.yml &lt;&lt;&#039;EOF&#039;\ngroups:\n- name: vps-host\n  rules:\n  - alert: CPUHighSustained\n    expr: (1 - avg by (instance) (rate(node_cpu_seconds_total{job=&quot;node&quot;,mode=&quot;idle&quot;}[5m]))) &gt; 0.85\n    for: 10m\n    labels:\n      severity: warning\n    annotations:\n      summary: High non-idle CPU ({{ $labels.instance }})\n      description: Non-idle CPU ratio remains above 85%. Check modes and workload; this includes iowait and steal.\n  - alert: MemoryLow\n    expr: (node_memory_MemAvailable_bytes{job=&quot;node&quot;} \/ node_memory_MemTotal_bytes{job=&quot;node&quot;}) &lt; 0.10\n    for: 5m\n    labels:\n      severity: warning\n    annotations:\n      summary: Low available memory ({{ $labels.instance }})\n      description: Available memory remains below 10%; inspect workload, swap and limits before diagnosing a leak.\n  - alert: DiskSpaceLow\n    expr: ((node_filesystem_avail_bytes{job=&quot;node&quot;,fstype!~&quot;tmpfs|overlay|squashfs&quot;} \/ node_filesystem_size_bytes{job=&quot;node&quot;,fstype!~&quot;tmpfs|overlay|squashfs&quot;})\n      and (node_filesystem_size_bytes{job=&quot;node&quot;} &gt; 0) and (node_filesystem_readonly{job=&quot;node&quot;} == 0)) &lt; 0.10\n    for: 10m\n    labels:\n      severity: critical\n    annotations:\n      summary: Low filesystem space ({{ $labels.instance }} {{ $labels.mountpoint }})\n      description: Available space on a writable nonzero filesystem remains below 10%. Check bytes, inodes and growth;\n        preserve required data.\n  - alert: DiskBusyHigh\n    expr: rate(node_disk_io_time_seconds_total{job=&quot;node&quot;}[5m]) &gt; 0.60\n    for: 15m\n    labels:\n      severity: warning\n    annotations:\n      summary: High device busy-time ratio ({{ $labels.instance }} {{ $labels.device }})\n      description: Busy-time ratio remains above 60%; correlate latency and queueing. This is not a universal saturation\n        percentage.\n  - alert: CPUWaitingForIO\n    expr: avg by (instance) (rate(node_cpu_seconds_total{job=&quot;node&quot;,mode=&quot;iowait&quot;}[5m])) &gt; 0.20\n    for: 10m\n    labels:\n      severity: warning\n    annotations:\n      summary: High reported CPU iowait ({{ $labels.instance }})\n      description: Reported CPU iowait remains above 20%; inspect storage latency and workload. Kernel accounting\n        has limitations.\n  - alert: NodeScrapeFailed\n    expr: up{job=&quot;node&quot;} == 0\n    for: 1m\n    labels:\n      severity: critical\n    annotations:\n      summary: Node scrape failed ({{ $labels.instance }})\n      description: Prometheus has failed to scrape this target for one minute; inspect exporter, network and host\n        separately.\n  - alert: ExpectedNodeSamplesMissing\n    expr: absent_over_time(up{job=&quot;node&quot;,instance=&quot;vps-01&quot;}[5m])\n    for: 1m\n    labels:\n      severity: critical\n    annotations:\n      summary: Expected node samples missing ({{ $labels.instance }})\n      description: No up samples for the expected target exist in the five-minute window. Check target configuration\n        and relabeling.\n  - alert: RecentBoot\n    expr: (time() - node_boot_time_seconds{job=&quot;node&quot;} &gt;= 0) and (time() - node_boot_time_seconds{job=&quot;node&quot;} &lt;\n      600)\n    for: 1m\n    labels:\n      severity: info\n    annotations:\n      summary: Recent host boot observed ({{ $labels.instance }})\n      description: Observed boot age is less than ten minutes. Compare maintenance records and system logs; this\n        is not outage duration.\nEOF\n<\/code><\/pre>\n<p>Thresholds are examples: non-idle CPU above 85% for ten minutes, available memory below 10% for five, writable filesystem space below 10% for ten, device busy time above 60% for fifteen and reported iowait above 20% for ten. The five-minute rate window differs from for: the condition must remain true at each evaluation for the pending duration. New or sparse series have rate extrapolation effects during warmup. <a href=\"https:\/\/prometheus.io\/docs\/alerting\/latest\/overview\/\" rel=\"nofollow noopener\" target=\"_blank\">The official alerting guide<\/a> explains rule evaluation and notification roles; test the actual workload before choosing paging thresholds.<\/p>\n<h3><span id=\"Step_3_Configure_the_SMTP_Receiver_and_Service\">Step 3: Configure the SMTP Receiver and Service<\/span><\/h3>\n<p>Replace example.com addresses with an authorized recipient, sender and SMTP account. The provider must allow SMTP authentication and STARTTLS on the selected endpoint; confirm valid certificates and outbound port 587 access. Store the password through a secure local editor in \/etc\/alertmanager\/smtp-password with root:alertmanager ownership and mode 0640. Keep it out of shell commands, articles and version control. The protected directory created earlier limits access to the configuration.<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">cat &gt; \/etc\/alertmanager\/alertmanager.yml &lt;&lt;&#039;EOF&#039;\nroute:\n  receiver: mail\n  group_by:\n  - alertname\n  - instance\n  group_wait: 30s\n  group_interval: 5m\n  repeat_interval: 2h\nreceivers:\n- name: mail\n  email_configs:\n  - to: alerts&#64;example.com\n    from: monitoring&#64;example.com\n    smarthost: smtp.example.com:587\n    auth_username: monitoring&#64;example.com\n    auth_password_file: \/etc\/alertmanager\/smtp-password\n    require_tls: true\n    send_resolved: true\nEOF\ncat &gt; \/etc\/systemd\/system\/alertmanager.service &lt;&lt;&#039;EOF&#039;\n[Unit]\nDescription=alertmanager\nWants=network-online.target\nAfter=network-online.target\n\n[Service]\nUser=alertmanager\nGroup=alertmanager\nType=simple\nExecStart=\/usr\/local\/bin\/alertmanager --config.file=\/etc\/alertmanager\/alertmanager.yml --storage.path=\/var\/lib\/alertmanager --web.listen-address=127.0.0.1:9093 --cluster.listen-address=\nExecReload=\/bin\/kill -HUP $MAINPID\nRestart=on-failure\nRestartSec=5s\nUMask=0027\nNoNewPrivileges=true\n\n[Install]\nWantedBy=multi-user.target\nEOF\n<\/code><\/pre>\n<p>All severity levels go to the same mail receiver here; labels alone do not create escalation routes. group_wait, group_interval and repeat_interval affect notification timing in addition to the rule\u2019s for duration. send_resolved explicitly enables resolution emails. The empty cluster listen address disables Alertmanager HA mode for this single-host example. After every file is ready, set ownership and permissions, validate as the service users, and then start:<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\"># Run only after all files and the protected SMTP password exist.\nset -eu\nchown root:prometheus \/etc\/prometheus\/prometheus.yml \/etc\/prometheus\/rules\/*.yml\nchmod 0640 \/etc\/prometheus\/prometheus.yml \/etc\/prometheus\/rules\/*.yml\nchown root:alertmanager \/etc\/alertmanager\/alertmanager.yml \/etc\/alertmanager\/smtp-password\nchmod 0640 \/etc\/alertmanager\/alertmanager.yml \/etc\/alertmanager\/smtp-password\nchown root:root \/etc\/systemd\/system\/{node_exporter,prometheus,alertmanager}.service\nchmod 0644 \/etc\/systemd\/system\/{node_exporter,prometheus,alertmanager}.service\nrunuser -u alertmanager -- test -s \/etc\/alertmanager\/smtp-password\nrunuser -u alertmanager -- test -r \/etc\/alertmanager\/smtp-password\nrunuser -u prometheus -- \/usr\/local\/bin\/promtool check config \/etc\/prometheus\/prometheus.yml\nrunuser -u alertmanager -- \/usr\/local\/bin\/amtool check-config \/etc\/alertmanager\/alertmanager.yml\nsystemd-analyze verify \/etc\/systemd\/system\/{node_exporter,prometheus,alertmanager}.service\nsystemctl daemon-reload\nsystemctl enable --now node_exporter alertmanager prometheus\nsystemctl --no-pager --full status node_exporter alertmanager prometheus\ncurl --fail http:\/\/127.0.0.1:9100\/metrics\ncurl --fail http:\/\/127.0.0.1:9090\/-\/ready\ncurl --fail http:\/\/127.0.0.1:9093\/-\/ready\n<\/code><\/pre>\n<p>For later configuration-only changes, validate before sending SIGHUP through systemctl reload, then inspect the logs. A successful reload command alone is not proof that the new configuration was accepted. Unit changes instead require daemon-reload and a service restart.<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">runuser -u prometheus -- \/usr\/local\/bin\/promtool check config \/etc\/prometheus\/prometheus.yml &amp;&amp; systemctl reload prometheus\nrunuser -u alertmanager -- \/usr\/local\/bin\/amtool check-config \/etc\/alertmanager\/alertmanager.yml &amp;&amp; systemctl reload alertmanager\njournalctl -u prometheus -u alertmanager --since &#039;-5 minutes&#039; --no-pager\n<\/code><\/pre>\n<h2 id='section-5'><span id=\"Set_Up_Grafana_and_Read_the_Right_Units\">Set Up Grafana and Read the Right Units<\/span><\/h2>\n<p>Build panels around specific questions: what fraction of CPU time is non-idle, how much memory is available, which filesystem is running short, and what changed in device activity? Show instance, device and mountpoint where relevant. Keep missing data distinct from zero and correlate with maintenance, traffic and application measurements.<\/p>\n<h3><span id=\"Step_1_Install_Native_Grafana_and_Add_Prometheus\">Step 1: Install Native Grafana and Add Prometheus<\/span><\/h3>\n<p>Grafana is not included in the download script. Install a supported native stable package on this same host following <a href=\"https:\/\/grafana.com\/docs\/grafana\/latest\/\" rel=\"nofollow noopener\" target=\"_blank\">the official Grafana documentation<\/a>; the version checked for this guide is 13.3.0. Before its first start, set [server] http_addr = 127.0.0.1 and http_port = 3000 in \/etc\/grafana\/grafana.ini. If the package already started it, restrict external access and restart with the intended settings. Change the initial administrator password and keep anonymous access disabled. Connect through a trusted SSH tunnel; use Connections \u2192 Add new connection \u2192 Prometheus \u2192 Add new data source and URL http:\/\/127.0.0.1:9090. Save &amp; test, then query real node samples.<\/p>\n<h3><span id=\"Step_2_Create_a_Server_Overview\">Step 2: Create a Server Overview<\/span><\/h3>\n<p>Use ratio units for fractions, bytes for capacity and seconds\/duration for boot age. Deployment annotations help correlate changes but do not prove causation. Process-level memory and endpoint-level load need additional instrumentation; Node Exporter cannot supply those details merely because a dashboard template contains panels for them.<\/p>\n<p><strong>Non-idle CPU ratio:<\/strong><\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">1 - avg by (instance) (rate(node_cpu_seconds_total{job=&quot;node&quot;,mode=&quot;idle&quot;}[5m]))<\/code><\/pre>\n<p>Select Percent (0.0\u20131.0). This averages cores and includes iowait and steal in the idle complement; inspect modes and per-core activity separately when needed. Averaging can hide a single-core bottleneck. A five-minute rate is a windowed estimate, not an instantaneous utilization measurement.<\/p>\n<p><strong>Available memory ratio:<\/strong><\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">node_memory_MemAvailable_bytes{job=&quot;node&quot;} \/ node_memory_MemTotal_bytes{job=&quot;node&quot;}<\/code><\/pre>\n<p>Use Percent (0.0\u20131.0). MemAvailable estimates memory available to new applications without swapping, including reclaimable cache\/slab and kernel watermarks. Low values warrant checking swap, OOM records, cgroup limits and workload; this graph alone cannot identify a memory leak or predict a crash.<\/p>\n<p><strong>Available filesystem space:<\/strong><\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">(node_filesystem_avail_bytes{job=&quot;node&quot;,fstype!~&quot;tmpfs|overlay|squashfs&quot;} \/ node_filesystem_size_bytes{job=&quot;node&quot;,fstype!~&quot;tmpfs|overlay|squashfs&quot;}) and (node_filesystem_size_bytes{job=&quot;node&quot;} &gt; 0) and (node_filesystem_readonly{job=&quot;node&quot;} == 0)<\/code><\/pre>\n<p>Use Percent (0.0\u20131.0) and show instance, mountpoint and device. The query filters read-only, zero-size and selected temporary\/image filesystems; monitor read-only failures and required excluded mounts separately. Also display absolute available bytes and inode capacity. With absolute threshold values, a base red color, 0.1 yellow and 0.2 green represents below 10%, 10\u201320% and at least 20% respectively.<\/p>\n<p><strong>Reported CPU iowait:<\/strong><\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">avg by (instance) (rate(node_cpu_seconds_total{job=&quot;node&quot;,mode=&quot;iowait&quot;}[5m]))<\/code><\/pre>\n<p>Use this separately from <code>rate(node_disk_io_time_seconds_total{job=&quot;node&quot;}[5m])<\/code>, the per-device busy-time ratio. Kernel iowait accounting has limitations, and device busy time is not a universal saturation percentage on parallel storage. Correlate device latency, throughput, IOPS and queueing before blaming a database or backup. Verify how virtual devices map to filesystems; the two label sets are not interchangeable.<\/p>\n<p><strong>Observed time since boot:<\/strong><\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">time() - node_boot_time_seconds{job=&quot;node&quot;}<\/code><\/pre>\n<p>The result is seconds since the observed boot timestamp; format it as a duration. Add a separate status panel for <code>up{job=&quot;node&quot;}<\/code>: 1 means the latest scrape succeeded, 0 means it failed, and missing data is a third state. None of these is a service-availability percentage or a complete history of application outages.<\/p>\n<p>Inspect raw data when a panel is blank or unexpectedly flat. Confirm the selected source, time range, job and instance labels before replacing missing values with zero. A successful data-source connection test proves neither metric completeness nor alert delivery. Keep an explicit owner for Prometheus rules if Grafana alerting is also introduced later.<\/p>\n<h2 id='section-6'><span id=\"Handle_Failed_Scrapes_Missing_Targets_and_Reboots\">Handle Failed Scrapes, Missing Targets and Reboots<\/span><\/h2>\n<p>for delays firing while a condition remains true at each evaluation. It is not amplitude hysteresis: the example rules resolve at the first evaluation where the condition is false. Different trigger and recovery thresholds require separate logic; keep_firing_for is another option that holds firing state for a duration after the condition ends. Longer waits trade less noise for slower detection.<\/p>\n<p>NodeScrapeFailed triggers after up=0 persists for one minute. The exporter, network, permissions or host may be responsible; this is not proof that the machine is off. A blackbox probe in an independent location can test a specific HTTP endpoint or port. It establishes the outcome from that probe\u2019s location and configured checks, not every user path or the complete business transaction.<\/p>\n<p>ExpectedNodeSamplesMissing checks a specific expected instance. It becomes active when its five-minute range has no up samples and then waits one minute; if no sample has existed since startup, it does not first wait for a full five minutes of history. An up=0 sample is present and therefore is not absence. RecentBoot observes a boot age between zero and ten minutes for one minute; it is informational and can miss restarts first scraped after that window. It does not measure downtime.<\/p>\n<p>Use bounded maintenance silences with exact target labels and confirm their end state. Silences suppress matching notifications; collection and rule evaluation continue. This example groups by alertname and instance and sends all severities to one recipient. Add and verify child routes for separate escalation destinations. A silence expiring does not by itself establish that delivery has recovered.<\/p>\n<h2 id='section-7'><span id=\"Protect_Access_and_Plan_Recovery\">Protect Access and Plan Recovery<\/span><\/h2>\n<p>The three monitoring listeners use loopback and should not be publicly reachable. Localhost does not isolate untrusted users or processes on the same host. For remote administration use a trusted SSH tunnel or a properly authenticated TLS proxy; keep Grafana roles least-privileged and accounts personal. A hidden port number is not authentication. Verify IPv4\/IPv6 exposure, certificate renewal and access revocation.<\/p>\n<p>Keep instance names unique and stable. Adding environment labels can help routing, but every rule, aggregation and missing-target check must remain consistent with the chosen identity. Do not create unbounded labels from user IDs or raw request paths. More targets, collectors, cardinality and frequent scrapes increase resource requirements; measure before extending retention or collection scope.<\/p>\n<p>A failed monitoring service should not become an application dependency. Back up configuration, rules, required Alertmanager state and Grafana data; use a consistent TSDB backup method and test restoration in a separate environment. Copying a live database directory arbitrarily is not a verified backup. Restarts can interrupt collection and evaluation for an unbounded period if recovery fails; monitor the monitoring system from outside its failure domain.<\/p>\n<h2 id='section-8'><span id=\"Tune_Thresholds_Against_Workload_and_User_Impact\">Tune Thresholds Against Workload and User Impact<\/span><\/h2>\n<p>Record representative workload and adjust thresholds using application latency, errors, capacity and an agreed response time. An already busy CPU is not automatically a paging incident, and a small filesystem may need an absolute-bytes or growth forecast alert before a percentage rule fires. Avoid simply raising thresholds until warnings disappear; confirm whether the underlying pressure is acceptable.<\/p>\n<p>Recurring I\/O activity may align with exports, backups or reports, but confirm that relationship before rescheduling work or changing storage. Cache policy, query optimization and workload separation are possible responses after evidence is gathered. <a href=\"https:\/\/www.dchost.com\/blog\/en\/anycast-dns-automatic-failover\/\">Anycast DNS and automatic failover<\/a> can support resilience planning; detection, DNS caches, existing sessions and data consistency still affect failover. Monitoring and failover do not guarantee that users never see a disruption.<\/p>\n<p>For example, if reported iowait rises during a scheduled export, compare device latency and queueing with the export timeline. Test a smaller batch or different schedule in a suitable environment, then compare both export completion and application response times. Treat this as a diagnostic workflow rather than proof that a particular workload is responsible whenever iowait rises.<\/p>\n<h2 id='section-9'><span id=\"Verify_the_Full_Path_and_Troubleshoot_Missing_Data\">Verify the Full Path and Troubleshoot Missing Data<\/span><\/h2>\n<p>Inspect Prometheus Targets, Rules and Alerts for the node target, eight loaded rules, pending\/firing state and the configured Alertmanager target. Query up and actual node metrics with the same job\/instance labels used by rules. Check exporter\/collector status and server logs. A job=&#8221;node&#8221; versus job=&#8221;nodes&#8221; mismatch can produce an empty vector that never fires a threshold alert.<\/p>\n<p>Use promtool test rules with normal, strict-boundary, short-peak, counter-reset, absent and resolved samples. In a separate test environment, route a short-lived, clearly labeled synthetic test alert to an authorized test recipient and verify rule \u2192 Alertmanager \u2192 SMTP \u2192 received message. Then remove the test rule and verify resolution. Parsing, service readiness and an Alertmanager UI entry are distinct checks; none alone proves delivery. Avoid generating production CPU load just to test a threshold.<\/p>\n<h2 id='section-10'><span id=\"Extend_Collection_and_Retention_Deliberately\">Extend Collection and Retention Deliberately<\/span><\/h2>\n<p>The textfile collector suits metrics tied to a particular machine, such as the last successful run of a host batch job. An authorized producer should write a temporary file in the same directory and atomically rename it to a .prom file; timestamps on samples are unsupported. Add freshness checks because an old file can remain readable. Ongoing service request\/error\/queue metrics need appropriate application instrumentation or an exporter. External blackbox checks and process metrics are separate additions.<\/p>\n<p>Choose retention from measured ingestion, recovery objectives and available disk; the example\u2019s 15 days\/2 GB is not a universal recommendation. A remote_write backend adds its own access control, durability, queueing and failure behavior and is not automatically a backup. Keep credentials separate, test outages and document recovery. Upgrade with pinned versions, release notes and compatibility checks, including how changes affect stored data.<\/p>\n<h2 id='section-11'><span id=\"Accept_the_Installation_with_Recorded_Checks\">Accept the Installation with Recorded Checks<\/span><\/h2>\n<p>Before relying on the installation, verify target samples, meaningful dashboard units, all rule conditions, missing-data behavior and delivery to the intended test recipient. Check directory ownership, loopback listeners, disk headroom and recovery after a controlled service restart. Record the versions, date and results; a green dashboard is only one observation.<\/p>\n<p>Start with one target and an actionable set of rules, then observe representative traffic before adding hosts. Document who responds to each alert, how to silence a planned maintenance window and how to test recovery. Add independent monitoring for the host that runs Prometheus and Alertmanager so a local failure cannot silently remove the only notification path.<\/p>\n<p>Use the collected evidence to compare application tuning, workload scheduling, capacity changes and service separation. The useful result is a traceable connection between a metric, its alert condition and a tested response path. Keep those contracts consistent as versions, target labels and architecture evolve.<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Collect VPS metrics with private listeners and dedicated service accounts. Use accurate CPU, memory and disk queries, missing-target rules and a complete SMTP notification path.<\/p>\n","protected":false},"author":1,"featured_media":11111,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[184],"tags":[],"class_list":["post-1373","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/posts\/1373","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/comments?post=1373"}],"version-history":[{"count":2,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/posts\/1373\/revisions"}],"predecessor-version":[{"id":11113,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/posts\/1373\/revisions\/11113"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/media\/11111"}],"wp:attachment":[{"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/media?parent=1373"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/categories?post=1373"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/tags?post=1373"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}