Larvitz Blog

FreeBSD, Linux, all things cleanly engineered

Simple Temperature Monitoring on FreeBSD


If you’re running FreeBSD 14.x and want to keep an eye on your system temperatures without installing third-party packages, you’re in luck. FreeBSD’s sysctl interface provides everything you need.

The Built-in Approach

Modern FreeBSD systems expose temperature data through the sysctl tree. You can query all temperature sensors with a simple command:

sysctl -a | grep temperature

This will show CPU core temperatures, ACPI thermal zones, and PCH (Platform Controller Hub) temperatures if available.

A Practical Monitoring Script

Rather than repeatedly typing sysctl commands, here’s a lightweight monitoring script that refreshes every two seconds:

#!/bin/sh
kldload coretemp
while true; do
clear
echo "======================================"
echo "   Temperature Monitor - $(date '+%H:%M:%S')"
echo "======================================"
echo ""
echo "CPU Cores:"
sysctl dev.cpu | grep temperature | sort -V
echo ""
echo "System:"
sysctl hw.acpi.thermal.tz0.temperature hw.acpi.thermal.tz1.temperature dev.pchtherm.0.temperature 2>/dev/null
echo ""
echo "Press Ctrl+C to exit"
sleep 2
done

Save this as tempmon.sh, make it executable with chmod +x tempmon.sh, and run it whenever you need real-time temperature monitoring.

Quick Access with an Alias

For instant temperature checks, add this alias to your shell configuration:

# For sh/bash (~/.shrc or ~/.bashrc)
alias temps='sysctl dev.cpu | grep temperature | sort -V; echo ""; sysctl hw.acpi.thermal.tz0.temperature dev.pchtherm.0.temperature'
# For csh/tcsh (~/.cshrc)
alias temps 'sysctl dev.cpu | grep temperature | sort -V; echo ""; sysctl hw.acpi.thermal.tz0.temperature dev.pchtherm.0.temperature'

Now temps gives you an instant snapshot of your system’s thermal state.

Understanding the Output

The dev.cpu.X.temperature values represent individual CPU core temperatures, while hw.acpi.thermal.tzX.temperature shows ACPI thermal zone readings (typically overall system/motherboard temperatures). The dev.pchtherm.0.temperature reports the Platform Controller Hub temperature when available. For most systems under normal load, CPU temperatures between 40-60°C are typical. Sustained temperatures above 80°C warrant investigation.