• About Me
  • Impressum
  • Privacy
  • Status Page

№42

... it's better to have good questions

Installing Node Exporter on Linux

March 11, 2021 2 min read Technology Open-Source Ronny Trommer

In OpenNMS Horizon 28+ is now a PrometheusCollector available. It scrapes the metrics from the provided exporter pages and allows to add data collections. As of speaking today it is not 100% feature complete, scraping data types like histograms is not implemented yet. If you want to play around here is a quick way to get the Linux Node_Exporter installed.

The following steps are executed in a root shell with sudo -i.

Download Node_Exporter

wget https://github.com/prometheus/node_exporter/releases/download/v1.2.2/node_exporter-1.2.2.linux-amd64.tar.gz
tar xzf node_exporter-1.2.2.linux-amd64.tar.gz
mv node_exporter-1.2.2.linux-amd64/node_exporter /usr/local/bin
mkdir -p /var/lib/node_exporter

Create system user account

useradd --no-create-home --shell /bin/false node-exp

Authentication

Save the following python script to a file named gen-pass.py, (requires apt install python3-bcrypt)

import getpass
import bcrypt

password = getpass.getpass("password: ")
hashed_password = bcrypt.hashpw(password.encode("utf-8"), bcrypt.gensalt())
print(hashed_password.decode())

To create a password hash run it with:

python3 gen-pass.py

You should get a prompt for the password and use the hash in your basic auth configuration.

Create basic config

Create config directory and create empty configuration file

mkdir /etc/node_exporter
/etc/node_exporter/config.yaml

If you want basic authentication add the user credentials in your config file.

File: /etc/node_exporter/config.yaml

basic_auth_users:
  prometheus: $2b$09$jlnZqhti2frPWS69U8XmM.vwy6K0J5R0kmaCSb4IvNBXNXOlIKAC.

Create systemd unit

File: /etc/systemd/system/node_exporter.service

[Unit]
Description=Prometheus Node Exporter
After=network-online.target

[Service]
Type=simple
User=node-exp
Group=node-exp
ExecStart=/usr/local/bin/node_exporter \
    --collector.systemd \
    --collector.textfile \
    --collector.textfile.directory=/var/lib/node_exporter \
    --web.config=/etc/node_exporter/config.yaml \
    --web.listen-address=0.0.0.0:9100

SyslogIdentifier=node_exporter
Restart=always
RestartSec=1
StartLimitInterval=0

ProtectHome=yes
NoNewPrivileges=yes

ProtectSystem=strict
ProtectControlGroups=true
ProtectKernelModules=true
ProtectKernelTunables=yes

[Install]
WantedBy=multi-user.target
  1. Reload systemd with systemctl daemon-reload
  2. Start up with systemctl enable --now node_exporter.service
Prometheus Opennms
Latest posts
  • Why You Should Care About Your Release Notes
  • How Docker Broke the Internet for Me
  • macOS with Apple Silicon and x86-64-v3 support
  • Streaming telemetry with gNMI
  • Go away or I replace you with a Makefile
  • SNMP Proxy ... wait what?
  • Hackathon on BGP monitoring using BMP in OpenNMS
  • Dealing with secrets in OpenNMS Horizon
  • Building container images for OpenNMS
  • Hello Containerlab with Orbstack
Categories
  • OpenNMS (27)
  • Technology (26)
  • How-To (23)
  • Monitoring (13)
  • Container (8)
  • Tutorial (8)
  • Events (6)
  • Open-Source (6)
  • BGP (2)
  • Networking (2)
Social media
© 2025 made in 🇪🇺 by Ronny Trommer with ❤️ for Open Source
Bilberry Hugo Theme