Install Node Exporter

Introduction

In this section we will install Node Exporter on the Radix Node Server. It will be used to scrape the Node Server and send CPU, RAM, Disk and other system metrics plus Radix's network metrics to the monitoring web server. The steps here are based on Digital Ocean's guide which can be found here.

Install Node Exporter

We’ll begin by creating a node_exporter user account. Create the account with the --no-create-home and --shell /bin/false options so that these users can’t log into the server.
sudo useradd --no-create-home --shell /bin/false node_exporter
You can find the latest binaries along with their checksums on Prometheus’ download page.
curl -LO https://github.com/prometheus/node_exporter/releases/download/v1.6.1/node_exporter-1.6.1.linux-amd64.tar.gz
Use the sha256sum command to generate a checksum of the downloaded file:
sha256sum node_exporter-1.6.1.linux-amd64.tar.gz
Verify the downloaded file’s integrity by comparing its checksum with the one on the download page.
ecc41b3b4d53f7b9c16a370419a25a133e48c09dfc49499d63bcc0c5e0cf3d01 node_exporter-1.6.1.linux-amd64.tar.gz
Now, unpack the downloaded archive.
tar xvf node_exporter-1.6.1.linux-amd64.tar.gz
This will create a directory called node_exporter-1.2.0.linux-amd64 containing a binary file named node_exporter, a license, and a notice.
Copy the binary to the /usr/local/bin directory and set the user and group ownership to the node_exporter user that you created in Step 1.
sudo cp node_exporter-1.6.1.linux-amd64/node_exporter /usr/local/bin
sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter
Lastly, remove the leftover files from your home directory as they are no longer needed.
rm -rf node_exporter-1.6.1.linux-amd64.tar.gz node_exporter-1.6.1.linux-amd64
Create a Systemd service file for Node Exporter.
sudo nano /etc/systemd/system/node_exporter.service
This service file tells your system to run Node Exporter as the node_exporter user with the default set of collectors enabled.
Copy the following content into the service file:
Node Exporter service file - /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
[Install]
WantedBy=multi-user.target
Save the file and close your text editor.
Finally, reload systemd to use the newly created service.
sudo systemctl daemon-reload
You can now run Node Exporter using the following command:
sudo systemctl start node_exporter
Verify that Node Exporter’s running correctly with the status command.
sudo systemctl status node_exporter
Like before, this output tells you Node Exporter’s status, main process identifier (PID), memory usage, and more.
If the service’s status isn’t active, follow the on-screen messages and re-trace the preceding steps to resolve the problem before continuing.
Output● node_exporter.service - Node Exporter
Loaded: loaded (/etc/systemd/system/node_exporter.service; disabled; vendor preset: enabled)
Active: active (running) since Fri 2017-07-21 11:44:46 UTC; 5s ago
Main PID: 2161 (node_exporter)
Tasks: 3
Memory: 1.4M
CPU: 11ms
CGroup: /system.slice/node_exporter.service
Lastly, enable Node Exporter to start on boot.
sudo systemctl enable node_exporter
And that's it for preparing your Node Server. The next step is to install the RadixNode package on the server which can be found here