Node Exporter Setup
In order for me to monitor my home servers, the first step for me is to install node exporter to push time series data to Prometheus. This post walks through installing node exporter on a raspberry pi. My next post will be about getting the data into Prometheus and setting it up. If you not interested in installing on a raspberry pi, my ansible repository supports all architectures using this same approach.
Download
Download the node exporter files for the armv7 architecture onto the server.
wget https://github.com/prometheus/node_exporter/releases/download/v1.3.1/node_exporter-1.3.1.linux-armv7.tar.gz
tar -xvf node_exporter-1.3.1.linux-armv7.tar.gz
rm node_exporter-1.3.1.linux-armv7.tar.gz
sudo mv node_exporter-1.3.1.linux-armv7 /opt/node_exporter
User Creation
We need a system user to run this as a service. Create one named node_exporter and set the permissions on the directory we created.
sudo useradd node_exporter
sudo chown -R node_exporter /opt/node_exporter
Service Installation
Now we need to edit /etc/systemd/system/node_exporter.service
file.
[Unit]
Description=Node Exporter
[Service]
User=node_exporter
Restart=on-failure
ExecStart=/opt/node_exporter/node_exporter
[Install]
WantedBy=multi-user.target
Then reload the daemon and enable/start the node_exporter service.
sudo systemctl daemon-reload
sudo systemctl enable node_exporter
sudo systemctl start node_exporter
Now run a status to see if it is running.
systemctl status node_exporter
Ansible
I added a playbook for this in my repository here. To use this playbook, update the ansible_hosts file with the hosts you require to install node_exporter on. You can also change the architecture or version so that you can install this on other computers by updating host_vars/hostname.yml
and group_vars/node_exporter.yml
accordingly. Here is the command to run to start the ansible playbook.
ansible-playbook -i ansible_hosts playbooks/node_exporter.yml
Next Steps
Install Prometheus server and configure it to scrape node_exporter on all of our hosts. This will be coming in the future.