Prometheus is a time series database for monitoring and alerting. For my environment I am going to use it as a data source in Grafana. This post will go over installing Prometheus on a Raspberry Pi and scraping node_exporter.


For Raspbian to run Prometheus we need to download a precompiled version for the armv7 architecture and then unarchive the download.

tar xfz prometheus-2.22.0.linux-armv7.tar.gz


Now the folder needs to be moved to a system location before we create the systemd service for prometheus.

sudo mv prometheus-2.22.0.linux-armv7 /opt/prometheus

We also need a user to run this server. We need to create it and ensure the owner is set on our new folder.

sudo useradd prometheus
sudo chown -R prometheus /opt/prometheus

Now create the configuration file /opt/prometheus/prometheus.yml like below, where host1/host2 are your hosts with node_exporter installed.

  scrape_interval:     15s 
    monitor: 'homelab-monitor'

  - job_name: 'prometheus'
    scrape_interval: 5s

      - targets: 
        - host1:9100
        - host2:9100

Then create the systemd unit file at /etc/systemd/system/prometheus.service.

sudo vim /etc/systemd/system/prometheus.service

The file should look like this.

Description=Prometheus Server


ExecStart=/opt/prometheus/prometheus \
  --config.file=/opt/prometheus/prometheus.yml \


Now enable/start the new service.

sudo systemctl daemon-reload
sudo systemctl enable prometheus
sudo systemctl start prometheus

Ansible Code

I have ansible code in Github to setup the Prometheus server on a Raspberry Pi here.

To use clone the repository and update the ansible_hosts file.

git clone
cd rpi-prometheus
vim ansible_hosts

After the host has been updated run this command to execute the ansible.

ansible-playbook -i ansible_hosts playbooks/prometheus_server.yml

Next Steps

The next step in getting monitoring setup in my home lab would be to connect Grafana to Prometheus. This will be released shortly.