How to Implement Monitoring & Observability: A Step-by-Step Guide
Unlock a precise how-to for setting up advanced monitoring and observability workflows to keep your systems resilient and performing.
How to Implement Monitoring & Observability: A Step-by-Step Guide
Basic Linux Host Monitoring with Prometheus Node Exporter
Monitor Linux system metrics using Node Exporter for Prometheus.
1. Node Exporter Setup (Linux Host)
-
Download Node Exporter:
1
wget https://github.com/prometheus/node_exporter/releases/download/v1.8.1/node_exporter-1.8.1.linux-amd64.tar.gz
- Note: Verify latest version on GitHub releases.
-
Extract & Install:
1 2 3 4
tar xvfz node_exporter-*.linux-amd64.tar.gz sudo mv node_exporter-*.linux-amd64/node_exporter /usr/local/bin/ sudo useradd -rs /bin/false node_exporter sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter
-
Systemd Service File:
1
sudo vi /etc/systemd/system/node_exporter.service
- Add contents:
1 2 3 4 5 6 7 8 9 10 11 12 13
[Unit] Description=Prometheus Node Exporter Wants=network-online.target After=network-online.target [Service] User=node_exporter Group=node_exporter Type=simple ExecStart=/usr/local/bin/node_exporter [Install] WantedBy=multi-user.target
- Add contents:
-
Start & Enable Service:
1 2 3 4
sudo systemctl daemon-reload sudo systemctl enable node_exporter sudo systemctl start node_exporter sudo systemctl status node_exporter
- Verify metrics endpoint:
curl localhost:9100/metrics
- Verify metrics endpoint:
2. Prometheus Configuration (Prometheus Server)
-
Edit
prometheus.yml
:1
sudo vi /etc/prometheus/prometheus.yml
- Add new scrape target under
scrape_configs
: ```yaml- job_name: ‘linux_host_metrics’ static_configs:
- targets: [‘YOUR_LINUX_HOST_IP:9100’] # Replace with actual IP ```
- job_name: ‘linux_host_metrics’ static_configs:
- Add new scrape target under
-
Reload Prometheus:
1
sudo systemctl reload prometheus
3. Verification
-
Prometheus UI: Navigate to
http://YOUR_PROMETHEUS_IP:9090/targets
- Confirm
linux_host_metrics
target status isUP
.
- Confirm
-
Grafana: Add Prometheus data source, import Node Exporter dashboard (e.g., Grafana ID
1860
).
This post is licensed under CC BY 4.0 by the author.