Install Node Exporter & Register to Prometheus Server on Grafana for Linux AMD64 & ARM64

Arif
2 min readDec 7, 2020

Setting up Prometheus

Now that we have the basic understanding of Prometheus, let’s get a Prometheus server up and start scraping some metrics. For this example I’ll set up the following architecture on Ubuntu 20.04

Installing node_exporter

First, we will download the Node Exporter on all machines :
(Update: 6 Feb 2023), current prometheus version 1.5.0.

### for x64 arch (common server)wget
https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-amd64.tar.gz
## or### for arm64 (raspi, etc)
https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-arm64.tar.gz

Extract the downloaded archive

tar -xf node_exporter-1.5.0.linux-amd64.tar.gz

Move the node_exporter binary to /usr/local/bin:

sudo mv node_exporter-1.5.0.linux-amd64/node_exporter /usr/local/bin

Remove the residual files with:

rm -r node_exporter-1.5.0.linux-amd64*

Next,we will create users and service files for node_exporter.

For security reasons, it is always recommended to run any services/daemons in separate accounts of their own. Thus, we are going to create an user account for node_exporter. We have used the -r flag to indicate it is a system account, and set the default shell to /bin/false using -s to prevent logins.

sudo useradd -rs /bin/false node_exporter

Then, we will create a systemd unit file so that node_exporter can be started at boot. sudo nano /etc/systemd/system/node_exporter.service

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

[Service]
User=node_exporter
Group=node_exporter
Type=simple
ExecStart=/usr/local/bin/node_exporter

[Install]
WantedBy=multi-user.target

Since we have created a new unit file, we must reload the systemd daemon, set the service to always run at boot and start it :

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

Configure UFW / Firewall Ubuntu :

sudo ufw allow from YOURPROMETHEUSSERVERIP to any port 9100
sudo ufw status numbered

Add new client to Prometheus Server

Register new IP of client to /etc/hosts on prom server

sudo vim /etc/hosts## add this to bottom of the line
IPADDRESS hostname
## example
10.0.0.37 pht-pve-mhs1

Add new config at prometheus server at /etc/prometheus/prometheus.yml

## add this to bottom of the line
- targets: ['CLIENTHOSTNAME:NODE_EXPORTERPORT']
## example
- targets: ['pht-pve-mhs1:9100']

Restart the Prometheus server with this command

sudo systemctl restart prometheus.service

Check node target on Prom GUI at http://10.0.0.46:9090/targets

That’s it.

--

--