Setting up Node Exporter on Raspberry Pi 4


Recently I wanted to get metrics out of my Raspberry Pi4 AdGuard Appliance and there was little on the internet about how to do this. Knowing a tonne about Linux I figured I'd just from scratch it and save it here in case I ever need it again, and to help anyone who may take a wrong turn and end up here.

I'm running the minimal 64bit Raspberry Pi OS, you will need to tailor the downloads by your arch, etc 

These were the steps:

  1. SSH into the Pi
  2. In your home directory (or whatever, you do you...), download node exporter, extract and place it in a system-friendly spot
    1
    2
    3
    4
    wget https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-arm64.tar.gz
    tar xvfz node_exporter-1.5.0.linux-arm64.tar.gz
    sudo mkdir -p /opt/node_exporter/
    sudo cp node_exporter-1.5.0.linux-arm64/node_exporter /opt/node_exporter/
    
  3. Once snugly in a nice place, you won't accidentally delete, either sudo -s or su - and create a service, this allows the node exporter to be run as a daemon and start on boot, etc.
    1
    2
    touch /etc/systemd/system/node-exporter.service
    nano /etc/systemd/system/node-exporter.service
    
  4. Paste the following in, and save (this assumes you used the same paths and filenames as me)
    [Unit]
    Description=Node-Exporter
    After=syslog.target network-online.target
    
    [Service]
    ExecStart=/opt/node_exporter/node_exporter
    Restart=on-failure
    RestartSec=10s
    
    [Install]
    WantedBy=multi-user.target
    
  5. Start, check then Enable the service (Enable means it starts on boot)
    1
    2
    3
    systemctl start node-exporter.service
    systemctl status node-exporter.service
    systemctl enable node-exporter.service
    
  6. All going well the output of systemctl status node-exporter.service should return you this (or something like it)
    ● node-exporter.service - Node-Exporter
         Loaded: loaded (/etc/systemd/system/node-exporter.service; enabled; vendor preset: enabled)
         Active: active (running) since Tue 2022-12-20 03:37:33 GMT; 14min ago
       Main PID: 788 (node_exporter)
          Tasks: 6 (limit: 4164)
            CPU: 55ms
         CGroup: /system.slice/node-exporter.service
                 └─788 /opt/node_exporter/node_exporter
    
    Dec 20 03:37:33 adguard node_exporter[788]: ts=2022-12-20T03:37:33.854Z caller=node_exporter.go:117 level=info collector=thermal_zone
    Dec 20 03:37:33 adguard node_exporter[788]: ts=2022-12-20T03:37:33.854Z caller=node_exporter.go:117 level=info collector=time
    Dec 20 03:37:33 adguard node_exporter[788]: ts=2022-12-20T03:37:33.854Z caller=node_exporter.go:117 level=info collector=timex
    Dec 20 03:37:33 adguard node_exporter[788]: ts=2022-12-20T03:37:33.854Z caller=node_exporter.go:117 level=info collector=udp_queues
    Dec 20 03:37:33 adguard node_exporter[788]: ts=2022-12-20T03:37:33.854Z caller=node_exporter.go:117 level=info collector=uname
    Dec 20 03:37:33 adguard node_exporter[788]: ts=2022-12-20T03:37:33.854Z caller=node_exporter.go:117 level=info collector=vmstat
    Dec 20 03:37:33 adguard node_exporter[788]: ts=2022-12-20T03:37:33.854Z caller=node_exporter.go:117 level=info collector=xfs
    Dec 20 03:37:33 adguard node_exporter[788]: ts=2022-12-20T03:37:33.854Z caller=node_exporter.go:117 level=info collector=zfs
    Dec 20 03:37:33 adguard node_exporter[788]: ts=2022-12-20T03:37:33.855Z caller=tls_config.go:232 level=info msg="Listening on" address=[::]:9100
    Dec 20 03:37:33 adguard node_exporter[788]: ts=2022-12-20T03:37:33.855Z caller=tls_config.go:235 level=info msg="TLS is disabled." http2=false address=[::]:9100
  7. Node exporter will be available at http://localhost:9100 or http://<ip address>:9100 and will start on boot.
Happy home-labbing :)


Comments

Popular posts from this blog

Are "Solution Architects" dead?

AYANEO Air Pro Review