How to monitor the CM4-WRT-A board temperatures and fan speed (RPM) in InfluxDB

By MyTechCatalog, 15 April, 2023

The CM4-WRT-A OpenWrt image includes a service called picod, which communicates with the Raspberry Pi Pico collecting periodic measurements from six temperature sensors on the CM4-WRT-A board, as well as the system fan Revolutions Per Minute (RPM). Below is a screenshot showing an example of an InfluxDB dashboard displaying the six temperature sensors and system fan RPM of the CM4-WRT-A board.

CM4-WRT-A InfluxDB dashboard

As indicated above, the OpenWrt service picod natively supports InfluxDB. The interface can be configured via the picod config file located at /etc/picod.conf on the CM4-WRT-A router.

Below is a screenshot showing the settings needed for picod to publish data to InfluxDB.

CM4-WRT-A picod settings for InfluxDB

The InfluxDB interface is not enabled by default, so the value of the variable enable_influx_db should be set to true in order to enable this feature. You can change the values of influx_org_id and influx_bucket if you like, just make sure to match what you setup in step 2 below.

As for the influx_token, you can provide one or let InfluxDB generate one for you as part of the setup process below (step 3). The CM4-WRT-A GitHub repository https://github.com/MyTechCatalog/cm4-wrt-a includes a script to setup a Docker container running InfluxDB that will display your board temperatures and fan speed.

How to setup InfluxDB for the CM4-WRT-A router board

  1.  If you haven't already done so, clone the CM4-WRT-A repository:

    git clone https://github.com/MyTechCatalog/cm4-wrt-a.git
  2. Edit the setup script cm4-wrt-a/setup-influxdb.sh to set a username and password used to access InfluxDB, as well as organization ID and bucket name if you like. The lines to edit are highlighted in the screenshot below.

    CM4-WRT-A InfluxDB setup script

  3. Run the InfluxDB setup script to start a Docker container:

    cd cm4-wrt-a && ./setup-influxdb.sh
    Output of running InflxDB setup script.

    CM4-WRT-A InfluxDB setup script output

  4. The InfluxDB data and config folders will be stored in this folder: cm4-wrt-a/influxdb

    Open the file cm4-wrt-a/influxdb/config/influx-configs in a text editor and copy the token value. An example is highlighted in the screenshot below. Paste this value in the /etc/picod.conf file on the CM4-WRT-A router, overwriting the current value of influx_token. Also make sure that the values of influx_bucket and influx_org_id match what you entered in the  setup-influxdb.sh script in step 2 above. CM4-WRT-A InfluxDB config token.

  5. Login to your CM4-WRT-A router via SSH. Stop and Start the picod service using the commands below:

    root@gateway2:~# /etc/init.d/picod stop
    root@gateway2:~# /etc/init.d/picod start

You can now navigate to InfluxDB at http://localhost:8086/ and login to setup your Dashboard.

CM4-WRT-A InfluxDB login