The article show how to install Prometheus Node Exporter on Ubuntu Linux as a systemd service and to add it to Prometheus config.
Download Node exporter binary from official site:
#wget https://github.com/prometheus/node_exporter/releases/download/v1.1.2/node_exporter-1.1.2.linux-amd64.tar.gz
Extract and move Node Exporter binary to /usr:
#gunzip node_exporter-1.1.2.linux-amd64.tar.gz
#tar -xvf ./node_exporter-1.1.2.linux-amd64.tar
#mv node_exporter*/node_exporter /usr/local/bin
Create user for Node Exporter:
#useradd -rs /bin/false node_exporter
Create systemd unit file - vim /etc/systemd/system/node_exporter.service - with following content:
[Unit]
Description=Node Exporter
After=network.target
[Service]
User=node_exporter
Group=node_exporter
Type=simple
ExecStart=/usr/local/bin/node_exporter
[Install]
WantedBy=multi-user.target
Restart systemd process and start node_exporter:
#systemctl daemon-reload
#systemctl start node_exporter
#systemctl enable node_exporter
#systemctl status node_exporter
Now you should access node metrics at:
http://<server-IP>:9100/metrics
Configure Prometheus. Add following to prometheus.yaml and restart it:
- job_name: 'node_exporter1'
static_configs:
- targets: ['localhost:9100']