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:
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.
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.
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.
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 /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.
Add the following content to the file.
Start and Enable the Service
Last step is start service and check status.
systemctl start node_exporter
systemctl enable node_exporter
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)
If successfull, node exporter will running in TCP port 9100.
Test with Curl
Make sure service is running and test with
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.