How to enable CPU temperature monitoring with Telegraf on Windows 11

2 min readDec 31, 2022

If your PC can execute the following “wmic” command on the PowerShell terminal then you DO NOT need to read this content. Just uncomment [[inputs.temperature]] on your Telegraf configuration file, then it is fine.

> wmic /namespace:\\root\wmi PATH MSAcpi_ThermalZoneTemperature

How to install the Telegraf

> wget -UseBasicParsing -OutFile
> Expand-Archive .\ -DestinationPath 'C:\Program Files\InfluxData\telegraf\'
> cd "C:\Program Files\InfluxData\telegraf"
> mv .\telegraf-1.XX.X\telegraf.* .

Please replace XX.X to the latest version numbers.

How to install the OpenHardwareMonitor

Download it and unzip it in C:\Program Files\InfluxData\

How to install the NSSM

Download it and unzip it in C:\Program Files\InfluxData\

How to run the OpenHardwareMonitor service with the NSSM

> cd "C:\Program Files\InfluxData\nssm-2.24\win64"
> .\nssm.exe install OpenHardwareMonitor

Then input “OpenHardwareMonitor” execution to Path and Setup Dir as following

Start the OpenHardwareMonitor as a service

> .\nssm.exe start OpenHardwareMonitor
> cd "C:\Program Files\InfluxData\telegraf"

Download PowerShell script into current directory.

> powershell -executionpolicy bypass -File "C:\Program Files\influxData\telegraf\xps-13-9370.ps1"

Got CPU temperature information

Edit telegraf.conf

# ## Commands array
commands = ['powershell -executionpolicy bypass -File "C:/Program Files/influxData/telegraf/xps-13-9370.ps1"']
data_format = "influx"

Test telegraf.conf

> .\telegraf.exe --config C:\"Program Files"\InfluxData\telegraf\telegraf.conf --test

Then enable the Telegraf

> .\telegraf.exe --service install --config "C:\Program Files\InfluxData\telegraf\telegraf.conf"
> .\telegraf.exe --service start