I remember vigorous discussions that were taken several years ago about monitoring hardware sensors on FreeBSD system. Back then I never really needed them. Not that I need them now but I recently got to know the sensors(1) command on Linux. Without any arguments it just prints the available sensors data on the screen and exits. Like example output from ThinkPad T14 laptop.
RHEL % sensors
coretemp-isa-0000
Adapter: ISA adapter
Package id 0: +51.0Β°C (high = +100.0Β°C, crit = +100.0Β°C)
Core 0: +49.0Β°C (high = +100.0Β°C, crit = +100.0Β°C)
Core 1: +50.0Β°C (high = +100.0Β°C, crit = +100.0Β°C)
Core 2: +51.0Β°C (high = +100.0Β°C, crit = +100.0Β°C)
Core 3: +49.0Β°C (high = +100.0Β°C, crit = +100.0Β°C)
acpitz-virtual-0
Adapter: Virtual device
temp1: +54.0Β°C (crit = +128.0Β°C)
iwlwifi_1-virtual-0
Adapter: Virtual device
temp1: +54.0Β°C
thinkpad-isa-0000
Adapter: ISA adapter
fan1: 2873 RPM
Nothing spectacular to be honest – but also a nice single place to check all temperatures instead of filtering endless sysctl(8) output.
The FreeBSD framework was known as bsdhwmon name and last available version is from somewhere in 2015. Its even available in the FreeBSD packages and I tried to install it and use.
FreeBSD # pkg search hwmon bsdhwmon-20151206 Hardware sensor monitoring utility for FreeBSD FreeBSD # pkg install -y bsdhwmon Updating FreeBSD repository catalogue... FreeBSD repository is up to date. All repositories are up to date. The following 1 package(s) will be affected (of 0 checked): New packages to be INSTALLED: bsdhwmon: 20151206 Number of packages to be installed: 1 12 KiB to be downloaded. [1/1] Fetching bsdhwmon-20151206.pkg: 100% 12 KiB 12.0kB/s 00:01 Checking integrity... done (0 conflicting) [1/1] Installing bsdhwmon-20151206... [1/1] Extracting bsdhwmon-20151206: 100% FreeBSD # pkg info -l bsdhwmon-20151206 bsdhwmon-20151206: /usr/local/man/man8/bsdhwmon.8.gz /usr/local/sbin/bsdhwmon /usr/local/share/licenses/bsdhwmon-20151206/BSD2CLAUSE /usr/local/share/licenses/bsdhwmon-20151206/LICENSE /usr/local/share/licenses/bsdhwmon-20151206/catalog.mk FreeBSD # /usr/local/sbin/bsdhwmon Your motherboard does not appear to be supported. Please visit https://github.com/koitsu/bsdhwmon to see if support for your motherboard and/or system is under development.
I do not want to be harsh but not very useful. I expected at least something … anything. Seems that the project is dead for 7 years not without a reason.
I checked what is already available in several places of the FreeBSD system that may be used as data source to create something similar to the sensors(1) command. I started with sysctl(8) output and later went to smartctl(8) command from the smartmontools package. This data was more then enough to start with something.
Meet the first version of small sensors.sh script that gathers all these data sources and prints them all on screen.
Below you will find output from my elderly ThinkPad W520 laptop.
FreeBSD # sensors.sh
BATTERY/AC/TIME/FAN/SPEED
------------------------------------
hw.acpi.acline: 1
hw.acpi.battery.time: 274
hw.acpi.battery.life: 99
hw.acpi.cpu.cx_lowest: C1
dev.acpi_ibm.0.fan: 0
dev.acpi_ibm.0.fan_level: 0
dev.acpi_ibm.0.fan_speed: 2454
SYSTEM/TEMPERATURES
------------------------------------
hw.acpi.thermal.tz0.temperature: 48.1C
dev.cpu.7.temperature: 47.0C
dev.cpu.6.temperature: 47.0C
dev.cpu.5.temperature: 46.0C
dev.cpu.4.temperature: 47.0C
dev.cpu.3.temperature: 46.0C
dev.cpu.2.temperature: 47.0C
dev.cpu.1.temperature: 48.0C
dev.cpu.0.temperature: 48.0C
DISKS/TEMPERATURES
------------------------------------
smart.ada0.airflow_temperature_cel: 36.0C
Another example output from my home NAS with two 5TB SATA disks – Silent Fanless FreeBSD Server – described here more.
FreeBSD # sensors.sh
BATTERY/AC/TIME/FAN/SPEED
------------------------------------
hw.acpi.cpu.cx_lowest: C1
SYSTEM/TEMPERATURES
------------------------------------
hw.acpi.thermal.tz0.temperature: 26.9C
dev.cpu.3.temperature: 50.0C
dev.cpu.2.temperature: 50.0C
dev.cpu.1.temperature: 48.0C
dev.cpu.0.temperature: 49.0C
DISKS/TEMPERATURES
------------------------------------
smart.ada1.airflow_temperature_cel: 33.0C
smart.ada1.temperature_celsius: 33.0C
smart.ada0.airflow_temperature_cel: 33.0C
smart.ada0.temperature_celsius: 33.0C
You can grab it from my scripts site – sensors.sh – I did not created separate GitHub page for it.
It comes with some simple builtin help message that I think explains everything.
Please check how it works on your system and let me know if it would be useful to add something more to it. As I not so long ago changed employer to the one that uses SLES and RHEL systems I can not test it on physical FreeBSD servers. Not that my earlier employer would be a huge help here as only several physical machines were FreeBSD based – but at least they were the biggest ones – FreeBSD Enterprise 1 PB Storage – you can read about these here. I also made a PBUG presentation later partially about that machine. You can find it – FreeBSD Enterprise Storage at PBUG – here.
UPDATE 1 – Screenshot After Updates
Many people suggested and submitted some interesting updates to the – sensors.sh – script – thank you for that. The script remains in the same place but here is how it looks and behave now.
EOF.
With respect, may I suggest:
LikeLike
Thanks!
Can you also send me the outputs of these commands?
LikeLike
LikeLike
Thank you.
I changed your serial number before approval.
Modified version with your code is now on GitHub:
https://github.com/vermaden/scripts/commit/26800c92daa41cee5450279f646c847a6b2a00d3
Regards.
LikeLike
It’s a shame (not your fault) that smartctl needs to be root to grab temperature.
Also, I get hundreds of lines of:
coretemp2: critical
temperature detected,
suggest system
shutdown
coretemp0: critical
temperature detected,
suggest system
shutdown
Is there some way to filter that stuff out?
LikeLike
Can you show me how this looks on your screen/terminal?
A screenshot or paste text please π
LikeLike
It’s pretty long. See if I can post a pastebin link:
https://pastebin.com/PLeWSVKr
LikeLike
Thank you.
Please check the latest version from here:
https://raw.githubusercontent.com/vermaden/scripts/master/sensors.sh
LikeLike
Also I have seen on the FreeBSD Mailing Lists that its possible to disable these messages.
The details are in the acpi_thermal(4) man page.
LikeLike
Yes, it’s not dumping thousands of lines now.
LikeLike
I also missed the sensors command from Linux and found sysutils/hwstat. https://www.freshports.org/sysutils/hwstat/
It doesn’t do drive temperatures but I thought it was worth a mention.
LikeLike
Thanks for suggestion, I will check that.
LikeLike
I suggest sorting the output (tested with ada/cpu):
LikeLike
Not directly merged but I added some sort(1) commands π
Thanks for suggestion.
LikeLike
Maybe you want to think about including dev.cpu.X.coretenp.tjmax / .delta for the CPU temp (in the sense of current/max/diff maybe)…
LikeLike
Thanks for good suggestion.
Added.
Now looks like that:
Regards.
LikeLike
Temperatures seems to be buggy, and sort order is not numerical (I added the sort key for that, else it doesn’t work), disks are not sorted.
LikeLike
https://raw.githubusercontent.com/vermaden/scripts/master/sensors.sh
LikeLike
Sort order is ok, but the CPU temp part still shows the two tjmax lines after .1.temperature.
LikeLike
I think I have now properly fixed it.
Please check the latest version from here:
https://raw.githubusercontent.com/vermaden/scripts/master/sensors.sh
LikeLike
Yes, look good.
LikeLiked by 1 person