Skip to content

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

13 thoughts on “Get Raspberry Pi CPU Temperature on ESXi-Arm”

  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)

    1. 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

  2. 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

    1. 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.

  3. Still not working:
    ] 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)

  4. I have the same issue. I tried

    # esxcli software acceptance set --level=CommunitySupported
    # esxcli software vib install -v /tmp/thpimon-0.1.0-1OEM.701.1.0.40650718.aarch64.vib
    Installation Result
    Message: Operation finished successfully.
    Reboot Required: false
    VIBs Installed: THX_bootbank_thpimon_0.1.0-1OEM.701.1.0.40650718
    VIBs Removed:
    VIBs Skipped:
    # reboot

    It shows the driver is installed
    # esxcli software vib list | grep pimon
    thpimon 0.1.0-1OEM.701.1.0.40650718 THX CommunitySupported 2022-03-07

    But when I check /dev/ no /dev/vmg* has been installed. I uninstalled the thpimon driver, rebooted, reinstalled it again, rebooted, but still no /dev/vmgfx32 device.

    I'm running VMware ESXi 7.0.0 build-19546333 on a Raspberry Pi 4B 8GB with RPi4_UEFI_Firmware_v1.33.

    It seems the installation went ok, but what is going wrong here?

  5. I reverted to an older firmware version. RPi4_UEFI_Firmware_v1.20 instead of RPi4_UEFI_Firmware_v1.33.

    Now the /dev/vmgfx32 is installed and it is working.

    ./pimon_temp.py
    Polling CPU temperature every 10 seconds...
    CPU Temperature: 42.0 C
    CPU Temperature: 40.0 C

Leave a Reply to PaulB Cancel reply

Your email address will not be published. Required fields are marked *