Tag Archives: smart

Sensors Information on FreeBSD

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.

sensors.code

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.

sensors.help

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.

sensors.update.1

EOF.

Advertisement