VMware: How to extract Temperature information from ESXi for ARM, send it to InfluxDB, and display it with Grafana

Greetings friends, I told you a few weeks ago what VMware had just launched, and that it was going to revolutionize the world of virtualization and make it, even more, accessible in many new use cases with the new ESXi for ARM.

Well, one of the things that worried me the most, I think I mentioned it in the video, was being able to control the temperature of the Raspberry Pi with ESXi for ARM, as ESXi usually gets all this data from the IPMI, iDRAC, iLO, etc.

But luckily we have a hero (Tom Hebel) who works in VMware and who has compiled a native driver to extract this information, besides being able to interact with many more things.

Diagram of how this solution works

It’s fine, I think, just creating a .json that telegraf then parses and writes to InfluxDB, but if I find a better way to do it, everything will get better, here the diagram:

Download and install the ESXi for ARM Native Driver for Raspberry Pi

I don’t know if it needs to be said, but all these steps are obviously for an unsupported product, created by the Community 🙂

To download the plugin from our ESXi over SSH, we will first have to disable the firewall so that it can connect through the ESXi http client, as well as having to download the system security so that we can install this plugin:

esxcli software acceptance set --level=CommunitySupported
esxcli network firewall ruleset set -e true -r httpClient

Once we have made these changes, we will proceed to download the package, directly from Tom’s GitHub, take a look at it for you, as it may have new versions:

wget https://github.com/thebel1/thpimon/raw/main/build/vib/thpimon-0.1.0-1OEM.701.1.0.40650718.aarch64.vib

Fantastic, let’s proceed with the installation of the Raspberry Pi driver for ESXi for ARM:

esxcli software vib install -v /thpimon-0.1.0-1OEM.701.1.0.40650718.aarch64.vib

This should show you something similar to this, after a few seconds or even a minute:

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:

Although the VIB says not to reboot, it is really recommended, so you know:

reboot

Once we reboot, we check that we have a new device in /dev/vmgfxXX in my case is /dev/vmgfx32.

Note: Put this in a scratch partition or in some datastore where the ESXi can access to keep it even if we reboot.

Now we will download the example of monitoring the RPi that our friend Tom has:

mkdir /scratch/downloads
cd /scratch/downloads
wget https://github.com/thebel1/thpimon/archive/main.zip
unzip main.zip

Before launching the script, we will go with vi to edit the following file /scratch/downloads/thpimon-main/pyUtil/pimonLib/__init__.py

vi /scratch/downloads/thpimon-main/pyUtil/pimonLib/__init__.py

And we will modify the line called PIMON_DEVICE_PATH with our new device, like this:

################################################################################
import math
import struct
import fcntl
#########################################################################
PIMON_DEVICE_PATH = '/dev/vmgfx32'
#########################################################################
RPIQ_BUFFER_LEN = 32
RPIQ_PROCESS_REQ = 0

We are going to test that everything works, we will launch the following script, which should give us the necessary information:

./thpimon-main/pyUtil/pimon_util.py
Firmware Revision: 0x5f440c10
Board Model: 0
Board Revision: 0xd03114
Board MAC Address: f7:12:b1:32:a6:dc
Board Serial: 0x000000ab401f61
Temp: 38.0 (deg. C)

We already have the most important part! Thank you very much, again Tom Hebel for your great work.

Download Script to collect information and produce the .json

It’s time to download and configure the simple script I created, we can download it from here, directly to the ESXi for ARM:

cd /scratch/downloads/
wget https://raw.githubusercontent.com/jorgedlcruz/esxi_arm-grafana/main/esxi-arm-rpi_grafana.sh

Some values must be edited in order to make it work properly, these values:

# Configurations
##
thepimonPath="/scratch/downloads/thpimon-main/pyUtil/pimon_util.py"

We will make the script executable, as always:

chmod +x esxi-arm-rpi_grafana.sh

And we will launch the script to see what works:

./esxi-arm-rpi_grafana.sh
Building the JSON file
All good, now you can go to https://esxi-zlon-rpi-001.jorgedelacruz.es/ui/pimonarm.json and use the JSON on your favourite Monitoring system

With this done, now you have a valid .json ANYTHING can take and parse, as long as they have access over HTTPS to the ESXi for ARM. Example of the .JSON:

curl https://esxi-zlon-rpi-001.jorgedelacruz.es/ui/pimonarm.json -k
{
    "thpimon": {
        "title": "The simplest way to take data out of the ESXi",
        "firmware": "0x5f440c10",
        "boardmodel": "0",
        "boardrevision": "0xd03114",
        "boardserial": "0x000000ab401f61",
        "boardtemp": "32.0",
        "hostname": "esxi-zlon-rpi-001.jorgedelacruz.es"
    }
}

I am using telegraf, so let’s take a look.

How to create a cron to run the script every minute

Many of the changes we have made will be lost when restarting, including the cron, but I leave it for you to have it at hand, we will go to the file /var/spool/cron/crontabs/root and edit it:

vi /var/spool/cron/crontabs/root

We will add the following at the end of it, you can point to the route where you have the script:

*/1 * * * * /scratch/downloads/esxi-arm-rpi_grafana.sh

Okay, that’s it, every minute we will have a fresh .json ready to be parsed.

Telegraf configuration to parse the new .json and send it to InfluxDB

This time I am going to use the always versatile inputs.http, to parse directly from the .json, the config can not be easier, I have created a new file under /etc/telegraf/telegraf.d/pimonarm.conf with this inside:

[[inputs.http]]
#URL for ESXi for ARM data in JSON format
urls = ["https://esxi-zlon-rpi-001.jorgedelacruz.es/ui/pimonarm.json"]
method = "GET"
#Overwrite measurement name from default `http` to `vsphere_esxi_arm`
name_override = "vsphere_esxi_arm"

#Exclude url and host items from tags
tagexclude = ["url", "host"]

#Data from HTTP in JSON format
data_format = "json"

#Parse `thpimon` array only
json_query = "thpimon"

#Set pimon metadata as tags
tag_keys = ["hostname", "firmware", "boardmodel", "boardrevision", "boardserial"]

#JSON values to set as string fields
json_string_fields = ["boardtemp"]

insecure_skip_verify = true

Then we can test it with the next command:

telegraf --config /etc/telegraf/telegraf.d/pimonarm.conf --test

If all good, you will see something like this:

2020-11-15T00:17:41Z I! Starting Telegraf 1.16.1
> vsphere_esxi_arm,boardmodel=0,boardrevision=0xd03114,boardserial=0x000000ab401f61,firmware=0x5f440c10,hostname=esxi-zlon-rpi-001.jorgedelacruz.es boardtemp="37.0" 1605399462000000000

If we go to our Grafana – Explorer, we can see that we have data!

Grafana Dashboard to see everything in a centralized way

Now that we have all this information, we probably want to show it in a more elegant way. I have used the well-known vSphere Hosts Dashboard I already had and added the ESXi ARM part at the end of it.

Just by importing it using the Grafana URL, you will have something similar to this:

At the end of it all, in case you have ESXi for ARM, they will appear to you. Remember that you need vCenter for all this to work:That’s all friends, thank you for the following links that have helped me a lot:

Endnote – Using CGI to get a JSON on Demand

Florian from virten.net has published a similar process using a CGI that ESXi runs every time this URL is called:

It seems a very simple and elegant process, the only thing that makes me a little nervous is that it is using hostd-operation.cgi that is supposed to be reserved for the system, although we don’t know much about it, if it was hardcoded, it might be a reason. Anyway, Florian steps are very cool and there is no need for cron, now you have another option 🙂

Author: jorgeuk

Father, writing in https://www.jorgedelacruz.es and https://jorgedelacruz.uk Blogger, Systems Engineer @veeam - vExpert 2014/2020 & NTC 2018/19

2 Thoughts

  1. Can this method handle multiple ESXi-arm servers and normal ESXi on the same report? I’ve got 1 ESXi on a NUC and 3 x pi’s but only one of the pi’s appears in the hosts report. Hosts report was working and reporting the NUC running ESXi until I updated to this version of the Grafana dashboard.

  2. Hello,
    Yes, you should be able to monitor both, the ARM one will be at the end, like in this picture –
    And of course, the normal ones are untouched so should work as usual.

Leave a Reply

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