This document describes how to install and configure the Node Exporter on a server so that metrics can be collected by Prometheus.
-
Download the latest version of Node Exporter:
wget https://github.com/prometheus/node_exporter/releases/download/v1.8.2/node_exporter-1.8.2.linux-amd64.tar.gz
(can be found here: Node Exporter Download)
-
Extract the downloaded file:
tar xvfz node_exporter-1.8.2.linux-amd64.tar.gz
-
Move it to a common directory:
mv node_exporter-1.8.2.linux-amd64/node_exporter /usr/local/bin/
-
Create a service file for Node Exporter:
nano /etc/systemd/system/node_exporter.service
-
Add the configurations to the file:
[Unit] Description=Node Exporter Wants=network-online.target After=network-online.target [Service] User=node_exporter ExecStart=/usr/local/bin/node_exporter [Install] WantedBy=default.target
-
Create the user and adjust permissions:
useradd -rs /bin/false node_exporter
-
Start the service, enable it to start automatically, and check the status:
sudo systemctl daemon-reload sudo systemctl start node_exporter sudo systemctl enable node_exporter sudo systemctl status node_exporter
-
In the
prometheus.yml
file, add your job configuration in thescrape_configs
section:- job_name: "node_exporter" static_configs: - targets: ["SERVER_IP:9100"]
-
Restart the service:
sudo systemctl restart prometheus
This README.md
file provides all the necessary information to set up the Node Exporter on a server and integrate it with Prometheus.