How to install node exporter in a different host and connect to prometheus

December 29, 2023
I have another device that I needed to start adding to my monitoring stack. ( Previous link ) . So that I can build another dashboard later to monitor all three major devices I use as servers for my home lab. 
Now there are several Boxes that you can chose from as metric exporter to install in the different machine. You can learn more about these here.
Choose the URL on the basis of the device architecture and operating system that you are using . For my specific need. I need to install node exporter in my "Nakhwahp" node with Ubuntu Operating system and 64 architecture. 
Hence, My download link is
So let's ssh into Nakhwahp 
$ ssh xecutioner@nakhwahp
wget the node exporter tarball
xecutioner@nakhwahp:~$ wget
--2023-12-29 07:24:05--
Resolving (
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: [following]
--2023-12-29 07:24:06--
Resolving (,,, ...
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10419253 (9.9M) [application/octet-stream]
Saving to: ‘node_exporter-1.7.0.linux-amd64.tar.gz’

node_exporter-1.7 100%[=============>]   9.94M  3.68MB/s    in 2.7s

2023-12-29 07:24:11 (3.68 MB/s) - ‘node_exporter-1.7.0.linux-amd64.tar.gz’ saved [10419253/10419253]
untar the tarball 
xecutioner@nakhwahp:~$ tar -zxvf node_exporter-1.7.0.linux-amd64.tar.gz
xecutioner@nakhwahp:~$ cd node_exporter-1.7.0.linux-amd64
xecutioner@nakhwahp:~/node_exporter-1.7.0.linux-amd64$ ls
LICENSE  node_exporter  NOTICE
move the tarball
xecutioner@nakhwahp:~/node_exporter-1.7.0.linux-amd64$ sudo mv node_exporter /usr/local/bin
switch to home directory and remove downloaded files 
ecutioner@nakhwahp:~/node_exporter-1.7.0.linux-amd64$ cd ..
xecutioner@nakhwahp:~$ cd ..
xecutioner@nakhwahp:~$ rm -rf  node_exporter-1.7.0.linux-amd64*
Create the user for node_exporter and have the user own node exporter binary
xecutioner@nakhwahp:~$ sudo useradd --no-create-home --shell /bin/false node_exporter
xecutioner@nakhwahp:~$ sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter

Create a service in systemd 
xecutioner@nakhwahp:~$ sudo vi /etc/systemd/system/node_exporter.service
Paste the following 
Description=Node Exporter


reload the systemd 
xecutioner@nakhwahp:~$ sudo systemctl daemon-reload
Enable and start our brand new node exporter 
xecutioner@nakhwahp:~$ sudo systemctl enable node_exporter
Created symlink /etc/systemd/system/ → /etc/systemd/system/node_exporter.service.
xecutioner@nakhwahp:~$ sudo systemctl start node_exporter
Test the service
got to <IP>:<9001>/metrics
Screenshot from 2023-12-29 13-31-10.png 172 KB

Great now let's head over to our prometheus instance 
[I] ^^>>> ssh xecutioner@xecutioner-maccy                             13:32:01
xecutioner@xecutioner-maccy:~$ cd dev/portainers/promethues/

To add the recently added node exporter as target
Let's stop the running compose we had set up earlier
xecutioner@xecutioner-maccy:~/dev/portainers/promethues$ docker-compose down
Stopping node-exporter           ... done
Stopping promethues_grafana_1    ... done
Stopping promethues_prometheus_1 ... done
Removing node-exporter           ... done
Removing promethues_grafana_1    ... done
Removing promethues_prometheus_1 ... done
Removing network promethues_default

Add the new host as target 
xecutioner@xecutioner-maccy:~/dev/portainers/promethues$ nvim prometheus/prometheus.yml

Screenshot from 2023-12-29 13-36-17.png 216 KB

Start the compose stack again 
xecutioner@xecutioner-maccy:~/dev/portainers/promethues$ docker-compose up -d
Creating network "promethues_default" with the default driver
Creating promethues_prometheus_1 ... done
Creating promethues_grafana_1    ... done
Creating node-exporter           ... done
Go over to the prometheus at and we should see it added as data sources
Screenshot from 2023-12-29 13-57-43.png 76.1 KB

Now over to grafana and we should the new host listed
Screenshot from 2023-12-29 14-00-26.png 86.9 KB