Get Raspberry Pi CPU Temperature on ESXi-Arm

Having proper cooling is very important when you run the ESXi-Arm Fling on a Raspberry Pi. With the Fling itself, it is not possible to get the actual CPU temperature.

Luckily, a few days ago a repository created by Tom Hebel (@tom_hebel) popped up on GitHub that contains a native driver for the Raspberry Pi 4's GPIO interface. This driver allows you to poll the CPU temperature. This article explains how to install the driver.

Get the Native ESXi driver for RPi 4's GPIO interface
The driver is available on GitHub (thebel1 / thgpio). To use the driver, you need to install the ESXi-Arm on your Raspberry Pi 4B.

The driver installation is very simple. The steps are:

  1. Download the VIB file from the build directory (thgpio/build/vib/)
  2. Copy the .vib file to ESXi-Arm running on your Raspberry Pi
  3. Set the host acceptance level changed to CommunitySupported
  4. Install the driver using esxcli
  5. Reboot the ESXi Host (The reboot is required! Ignore that esxcli tells a reboot is not required.)

You can directly download and install the driver from the ESXi host by using SSH:

# cd /
# esxcli software acceptance set --level=CommunitySupported
# esxcli network firewall ruleset set -e true -r httpClient
# wget https://github.com/thebel1/thpimon/raw/main/build/vib/thpimon-0.1.0-1OEM.701.1.0.40650718.aarch64.vib
# esxcli network firewall ruleset set -e false -r httpClient
# esxcli software vib install -v /thpimon-0.1.0-1OEM.701.1.0.40650718.aarch64.vib
# reboot

After the reboot, you should see a new device: /dev/vmgfxXX

This device is used to connect to the Raspi's GPIO interface. To understand how to use the device, get the thpimon repository from GitHub. The repository contains a Python Library in ./pyUtil/pimonLib/ and an example script.

Note: Files in the ESXi root directory do not persist a reboot. If you want the script to survive a reboot, download it to a VMFS or VMFS-L Datastore. To list all datastores, run esxcli storage filesystem list.

# wget https://github.com/thebel1/thpimon/archive/main.zip
# unzip main.zip
# ./thpimon-main/pyUtil/pimon_util.py
Firmware Revision:   0x5f440c10
Board Model:         0
Board Revision:      0xd03114
Board MAC Address:   6b:34:c5:32:a6:dc
Board Serial:        0x00000022412ff2
Temp:                47.0 (deg. C)

Note: If you get the following error message:

Traceback (most recent call last):
FileNotFoundError: [Errno 2] No such file or directory: '/dev/vmgfx33'

You have to change the PIMON_DEVICE_PATH variable in ./pyUtil/gpioLib/__init__.py to reflect the correct name for your device. Get the device with the following command:

# ls /dev/vmgfx*
/dev/vmgfx32

Change the variable to /dev/vmgfx32 (Or whatever the output above is) and save the file:

If you still get the error, delete the python cache directory: ./pyUtil/gpioLib/__pycache__

Follow up: ESXi-Arm on Raspberry Pi - Send CPU Temperature to Graphite

  1. Thanks for this. I'm going to start pushing CPU temp to Log Insight. I was already using this VIB and can successfully read pin state, but when I run pimon_util, I get errors and empty values. I'll dig into this.

    ] python ./pimon_util.py
    [Errno 22] Invalid argument
    [Errno 22] Invalid argument
    Firmware Revision: 0x0
    [Errno 22] Invalid argument
    Board Model: 0
    [Errno 22] Invalid argument
    Board Revision: 0x0
    Board MAC Address: 0:0:0:0:0:0
    [Errno 22] Invalid argument
    Board Serial: 0x00000000000000
    [Errno 22] Invalid argument
    Temp: 0 (deg. C)

  2. Fixed that error. Reinstalled the VIB, rebooted, everything working. Yay.

    • I meet the same issue, can you elaborate what exactly you did to fix the error? I tried below steps but still the error persists.
      esxcli software vib remove -n thgpio
      reboot
      esxcli software vib install -v thgpio-0.1.0-1OEM.701.1.0.40650718.aarch64.vib
      rebot
      ./pyUtil/pimon_util.py

  3. I meet the same issue, can you elaborate what exactly you did to fix the error? I tried below steps but still the error persists.
    esxcli software vib remove -n thgpio
    reboot
    esxcli software vib install -v thgpio-0.1.0-1OEM.701.1.0.40650718.aarch64.vib
    rebot
    ./pyUtil/pimon_util.py

    • viumden, I noticed that I did not have a /dev/vmg33 only a /dev/vmg32. I tried using vmg32 in the library but received those errors. I reinstalled the VIB, rebooted, /dev/vmg33 was created, and the errors were gone.

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.