🖥️ Node Exporter

🎯 Purpose

Node Exporter provides host‑level metrics for Prometheus, which Grafana uses for dashboards and service visibility. In your environment, it supports:


⚙️ How It Works


🧩 Key Concepts

📊 Native Metrics

Examples include:

📝 Textfile Collector Metrics

Allows scripts to publish custom .prom metrics.

Flow:

  1. Script writes Prometheus‑formatted metrics
  2. File is atomically moved into the collector directory
  3. Node Exporter exposes metrics at scrape time

Benefits:


📁 Textfile Collector Paths & Files

Collector directory
/var/lib/node_exporter/textfile

Script paths

Metrics files

Refresh cadence


📈 Current Custom Metrics

🔒 Linux Update Metrics

Written to: linux_updates.prom
Metric families:

🚨 Failed Systemd Service Metrics

Written to: failed_services.prom
Metric families:

Labels include:


🚀 Deployment

Deployment is managed via Ansible roles and deployed through the Node Exporter playbook.

Operational behavior:

🛠️ Sample Commands

Deploy:

source /opt/python_3.12/bin/activate
ansible-playbook -i inventory/rproxy/inventory.ini playbooks/prometheus/deploy_node_exporter.yml

Syntax check:

ansible-playbook --syntax-check ...

Refresh Prometheus exporter targets:

ansible-playbook playbooks/prometheus/deploy_prometheus_exporters.yml

👉 See also: Adding Node Exporter to an Inventory


🔍 Common Prometheus Queries


📊 Grafana Usage Notes


🛠️ Troubleshooting

❌ No Failed Service Data

Check:

🐢 Slow Data Updates

Cause: Cron interval too long
Fix: Reduce failed‑service collection interval

🔎 Quick Verification Commands

ls -l /var/lib/node_exporter/textfile
cat /var/lib/node_exporter/textfile/failed_services.prom
cat /var/lib/node_exporter/textfile/linux_updates.prom
systemctl status node_exporter

🔐 Security & Operational Guidance


🧾 Summary

Node Exporter is the foundation of host‑level observability in your stack. The textfile collector extends visibility with operational checks like failed systemd services, enabling clear Grafana dashboards and future alerting.