Node Exporter Installation
I am using linux ubuntu machine for this installation. I spin up linux ubuntu machine in AWS cloud, and it is up and running. I have also connected EC2 instance using iterm terminal in my Mac machine.
Step 1
Go to the website "https://prometheus.io/download/#node_exporter" and find the latest version of node exporter tar file. Copy the link for that tar file.
Step 2
Run the command "wget
wget https://github.com/prometheus/node_exporter/releases/download/v1.8.2/node_exporter-1.8.2.linux-amd64.tar.gz
Step 3
Untar the downloaded file using the command "tar -xvzf
tar -xvzf node_exporter-1.8.2.linux-amd64.tar.gz
Step 4
Navigate to node exporter directory (unzipped one)
Step 5
Start the node exporter executable file
Step 6
Open the browser and enter node exporter server IP followed by port number 9100.
Node exporter is up and running now. However, if I close the terminal where node exporter executable is running or my EC2 instance is down, then the node exporter also stops. Hence, this is not the ideal way to run the node exporter. The ideal way of running node exporter is to install and run as a service (systemd).
The ideal way of running node exporter as a service.
Step 1 - Create a system user for node exporter
System username is node_exporter
.
Before doing it, we need to ensure node_exporter
user is not created yet.
To do so, run the command cat /etc/passwd | grep -i node_exporter
If it returns value, it means node_exporter
user is already available in the system.
We can create system user now. To create the user, run the below commands
To check if the user is created successfully, run the command
Step 2 - Copy the executable file to bin location
To copy the node exporter to bin location, run the below commands
Step 3 - Assign permission and ownership to the system user
To assign the ownership to node exporter
user, run the below commands
Step 4 - Create a service file for node exporter
Update the below content in the node exporter service file located at /etc/systemd/system/node_exporter.service
[Unit]
Description=Node Exporter
Wants=network-online.target
After=network-online.target
[Service]
User=node_exporter
Group=node_exporter
Type=simple
ExecStart=/usr/local/bin/node_exporter
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
Step 5 - Reload the daemon service
To do so, run the below command
Step 6 - Start the node exporter service
To do so, run the below command

Step 7 - Check the status of the node exporter service
To do so, run the below command

Step 8 - Enable the node exporter service
To do so, run the below command. This will ensure that the node exporter service automatically starts at system booting.

Step 9 - Check the metrics are populated
To do so, run the below command

Integrate Node Exporter with Prometheus
Prometheus scrapes the target and pulls the metrics.
So, it should know what the target is prior to pull the metrics.
Prometheus target configuration is configured in the prometheus.yml
file by default.
Hence, we need to update the configuration file with the target details of node exporter server details.
After this change, restart the prometheus.
Then, Prometheus will start to scrape the node metrics after restarting the prometheus.
Step 1 - Check Prometheus server status and Node exporter status
Connect the prometheus server in the terminal and run the following command.

Connect the node exporter machine in the terminal and run the following command.
Step 2 - Update prometheus configuration file
Add the node server ip address in the target section to ensure prometheus knows what machine it needs to scrape.
- job_name: "Node server"
scrape_interval: 10s
scrape_timeout: 5s
metrics_path: /metrics
static_configs:
- targets: ["172.31.84.187:9100"]
Step 3 - Restart Prometheus Server
Connect the prometheus server in the terminal and run the following command.

Step 4 - Check Prometheus server status
Connect the prometheus server in the terminal and run the following command.

Step 5 - Check Prometheus UI for target status
Open the browser and enter the
Click on the menu "Status -> Targets"
As we see, prometheus server is able to understand the node service and where it is running, what is the current state, etc.
If we go to the "graph" menu, and type "node" you will be able to see all the metrics related to node service.
That's all. Simple, isn't it?