habibzain Just husband, father and enthusiastic men about System Administration. Love to write short article about it. Perhaps can help and be useful for others.

How to Install Node Exporter on Ubuntu 18.04

2 min read

A Guide to Install Node Exporter on Ubuntu 18.04

System monitoring the performance of systems is crucial for maintaining their health and ensuring optimal functionality. One powerful tool for system monitoring is Prometheus, and a key component of Prometheus is Node Exporter. Node Exporter facilitates the collection of various system metrics, providing valuable insights into our system’s performance. In this guide, we’ll walk we through the step-by-step process of install Node Exporter on Ubuntu 18.04, empowering we to take control of our system’s monitoring capabilities.

Prerequisites: Before diving into the installation process, it’s essential to ensure that our Ubuntu 18.04 system is up to date. Open a terminal and run the following commands:

Bash
sudo apt update
sudo apt upgrade

Additionally, ensure that Prometheus is already installed on our system. If not, we can easily set it up using the official Prometheus installation guide. Once we have Prometheus up and running, we’re ready to proceed with Node Exporter installation. Installation Steps:

Download Node Exporter

Begin by visiting the official Prometheus GitHub releases page to find the latest version of Node Exporter. Copy the link to the Node Exporter tar.gz file.

Bash
wget https://github.com/prometheus/node_exporter/releases/download/v1.6.0/node_exporter-1.6.0.linux-amd64.tar.gz

Extract and Move Files

Once the download is complete, extract the tar.gz file and move the Node Exporter binary to the /usr/local/bin directory.

Bash
tar -zxvf node_exporter-1.6.0.linux-amd64.tar.gz
mv node_exporter*/node_exporter /usr/local/bin/

Create User with No Home Directory and Chown

Create user local with no home directory and chown them to binary like below.

Bash
useradd --no-create-home --shell /bin/false node_exporter
chown node_exporter:node_exporter /usr/local/bin/node_exporter

Make sure user assigned with ls -al.

Bash
ls -al /usr/local/bin/node_exporter

#result of ls -al
-rwxr-xr-x 1 node_exporter node_exporter 20023864 May 27 19:04 /usr/local/bin/node_exporter

Create a Systemd Service

To manage Node Exporter as a service, create a systemd service unit file. Use our preferred text editor to create a file named node_exporter.service in the /etc/systemd/system/ directory.

Bash
vim /etc/systemd/system/node_exporter.service

Add the following content to the file.

Bash
[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
[Install]
WantedBy=multi-user.target

Start and Enable the Service

Last step is start service and check status.

Bash
systemctl start node_exporter
systemctl enable node_exporter
Bash
habibza@habibza-svrdb:~# systemctl status node_exporter.service

#result systemctl status

 node_exporter.service - Node Exporter
   Loaded: loaded (/etc/systemd/system/node_exporter.service; disabled; vendor preset: enabled)
   Active: active (running) since Thu 2023-11-30 03:29:35 UTC; 1 day 7h ago
 Main PID: 6343 (node_exporter)
    Tasks: 6 (limit: 4915)
   CGroup: /system.slice/node_exporter.service
           └─6343 /usr/local/bin/node_exporter

If successfull, node exporter will running in TCP port 9100.

See also  Add Linux Server Integration for Grafana Cloud

Test with Curl

Make sure service is running and test with curl.

curl localhost:9100/metrics

We should see metrics like this picture.

With Node Exporter in place, we have unlocked a powerful tool for monitoring our Ubuntu 18.04 system. The installation process may seem intricate at first, but by following this guide, we’ve taken a significant step toward ensuring the reliability and performance of our infrastructure. Harness the insights provided by Node Exporter to make informed decisions and proactively manage our system’s health.

That is about install Node Exporter on Ubuntu 18.04. Cheers to effective system monitoring. Please feel free for comment. May be usefull.


habibzain Just husband, father and enthusiastic men about System Administration. Love to write short article about it. Perhaps can help and be useful for others.

Leave a Reply

Your email address will not be published. Required fields are marked *

Never miss good article from us, get weekly updates in your inbox