Skip to content

joneskoo/ruuvi-prometheus

Repository files navigation

ruuvi-prometheus exporter

This is a simple Prometheus exporter that exports metrics for Ruuvi version 3 data format Bluetooth LE advertisements.

Usage

I use ruuvi exporter with Alpine Linux myself and it’s on Alpine Linux repository in edge/testing.

To use this binary release, install Alpine edge and enable the testing repository and apk add ruuvi-prometheus. Enable service to start at booth with rc-update add ruuvi-prometheus.

You will need to uncomment "rpi bluetooth" in /etc/mdev.conf for Raspberry Pi Bluetooth to work.

The service binds listen address to :9521 by default.

For usage with Grafana, see grafana-example-dashboard.json.

To keep the exporter stateless (I run it on a headless read-only Raspberry), it is better to add the logical names for sensors in Prometheus configuration. For example:

  - job_name: 'ruuvi-prometheus'
    static_configs:
      - targets: ['ruuvi-prometheus:9521']
    metric_relabel_configs:
      # ... id and name relabel config for each sensor
      - source_labels: ['device']
        target_label: 'id'
        regex: 'e7:37:3b:37:d9:74'
        replacement: '2'
      - source_labels: ['id']
        target_label: 'name'
        regex: '2'
        replacement: 'garage'
      # Map location based on id
      - source_labels: ['id']
        regex: '2|3|5|6|7|9'
        target_label: 'location'
        replacement: 'indoors'
      - source_labels: ['id']
        regex: '1|4'
        target_label: 'location'
        replacement: 'outdoors'

Further development

Ideally I would like to run this using gokrazy instead, but my current setup requires WiFi with WPA2 and Raspberry Pi Bluetooth which are not supported yet. Once those blockers are solved, gokrazy can create Raspberry appliance image without any C code besides Linux.

Exported metrics

ruuvi_acceleration_g
Ruuvi tag sensor acceleration X/Y/Z
ruuvi_battery_volts
Ruuvi tag battery voltage
ruuvi_frames_total
Total Ruuvi frames received
ruuvi_humidity_ratio
Ruuvi tag sensor relative humidity
ruuvi_pressure_hpa
Ruuvi tag sensor air pressure
ruuvi_rssi_dbm
Ruuvi tag received signal strength RSSI
ruuvi_temperature_celsius
Ruuvi tag sensor temperature
ruuvi_format
Ruuvi frame format version (e.g. 3 or 5)
ruuvi_movecount_total
Ruuvi movement counter
ruuvi_seqno_current
Ruuvi frame sequence number
ruuvi_txpower_dbm
Ruuvi transmit power in dBm

System requirements

  • Linux
  • Bluetooth LE; bluetoothd must not be running.