πŸ“Š Setting Up Node Exporter as a systemd Service on a Specific Interface

This guide explains how to install Prometheus Node Exporter, configure it to listen on a specific network interface, and run it as a systemd service.

πŸ› οΈ Step 1: Install Node Exporter

Download and install Node Exporter (https://github.com/prometheus/node_exporter/releases)

or whatever binary you wish to run as a systemd service:

wget https://github.com/prometheus/node_exporter/releases/latest/download/node_exporter-*.linux-amd64.tar.gz
tar xvfz node_exporter-*.linux-amd64.tar.gz
sudo cp node_exporter-*/node_exporter /usr/local/bin/

Step 2: Create the Service

Create the file

sudo nano /etc/systemd/system/node_exporter.service

Paste the following content, replacing 192.168.1.100 with the IP address of your desired interface:

[Unit]
Description=Prometheus Node Exporter
After=network.target

[Service]
User=nobody
ExecStart=/usr/local/bin/node_exporter \
  --web.listen-address=192.168.1.100:9100
Restart=always

[Install]
WantedBy=default.target

πŸ”„ Step 3: Reload systemd and Start the Service

sudo systemctl daemon-reexec
sudo systemctl daemon-reload
sudo systemctl enable node_exporter
sudo systemctl start node_exporter

βœ… Step 4: Verify It’s Running

sudo systemctl status node_exporter

Test the metrics endpoint:

curl http://192.168.1.100:9100/metrics