Install Prometheus Node Exporter on RHEL 8

What is Prometheus Node Exporter?
The Prometheus Node Exporter exposes a wide variety of hardware- and kernel-related metrics.
Learn more: https://github.com/prometheus/node_exporter

Step 1: Download
Go to https://github.com/prometheus/node_exporter/releases/ and identify the latest release. Then download the .gz file by running:
wget https://github.com/prometheus/node_exporter/releases/download/v1.3.1/node_exporter-1.3.1.linux-amd64.tar.gz

Step 2. Extracting
Extract the gzip file by running:
tar -xzvf node_exporter-1.3.1.linux-amd64.tar.gz

Step 3. Create a user for the Node Exporter
Run the following command to create a new user:
sudo useradd -rs /bin/false nodeusr

Step 4. Move Binary
Run the following command to move the node_exporter binary to the /usr/local/bin folder:
sudo mv node_exporter-1.3.1.linux-amd64/node_exporter /usr/local/bin/node_exporter

Step 5. Setup the Service for Node-Exporter
Run the following to set up a new service for the Node_Exporter:
sudo vim /etc/systemd/system/node-exporter.service

Add the following to the newly created service:
[Unit]
Description=Node Exporter
After=network.target
[Service]
User=nodeusr
Group=nodeusr
Type=simple
ExecStart=/usr/local/bin/node_exporter
[Install]
WantedBy=multi-user.target


Step 6. Reload the daemons and start the service
This can be done by running:
sudo systemctl daemon-reload

Now start the service by running:
sudo systemctl start node_exporter

Then you can check the status of the service by running:
sudo systemctl status node_exporter

Step 7. Setup the Service upon Restart
So if you want to set up the service so that it will start when the virtual machine, node, etc, starts up then run the following:
sudo systemctl enable node_exporter

Step 8. Verify the Service
You can verify the node_exporter is working by running the following curl command:
curl http://localhost:9100/metrics

Author avatar
cloudstrata-root
http://cloudstrata.io