OpenBSD Journal

Developer blog: deanna - systat sensors

Contributed by deanna on from the XXXXXXXXXXXXXXX dept.

Yesterday I added a new display to systat(1) : sensors. Though it was no great feat of programming - it is just henning@'s sensorsd(8) code shoved into systat - it does give me an excuse to write about this really useful but often overlooked tool.

A lot of people coming to BSD from other UNIX-like OSes don't know about systat, because in modern times it has always been strictly a BSD application. It started out way back on on TOPS-10. Unfortunately I do not have access to a TOPS-10 machine, but here is what it looks like on TOPS-20.

 Sat 24-Feb-2007 07:28:41  Up 234:12:34
 6+6 Jobs   Load av   0.00   0.01   0.01

 Job  Line Program  User              Origin
   7    44  EXEC    EL                (
   8    45  EXEC    SANGRA            (
   9    46  EXEC    SANGRA            (
  10    47  EXEC    JACK3R            (
  11    50  EXEC    RSBOHN            (
  12*   51  SYSTAT  NEW               (sverige.freeshell.ORG)
   1    13  OPR     OPERATOR
   3    14  RESOLV  OPERATOR
   4    15  NETSRV  OPERATOR
   5    16  SMTJFN  OPERATOR
   6    17  MMAILR  OPERATOR

A command by the same name appeared in 4.3 BSD, and began to take on the look we are more familiar with today. For the most part, it's maintained its historical look and feel in all the modern BSD projects, which may be why new people who have found it consider it a novelty. While being cute, the default display, 'pigs', is mostly worthless.

In OpenBSD, it's continued to evolve. A few years ago, an 'if' display was added, that shows per-interface network statistics and states, and some months ago the iostat display was updated to show more useful statistics in a format that is easier to read.

The latest addition is a display to show the status of hardware sensors, which I added because I was tired of typing

sysctl hw.sensors.acpibat0.watthour3

whenever I wanted to check how much battery life I had left on my laptop.

I hope that this comes in handy for people who need to do more serious monitoring with their sensors, or who want to take quick glances at what's new with the acpi change of the hour.

So, check it out if you hadn't before. One other thing I'd like to see is an 'all' display, like NetBSD has, which automatically flips between all the available displays. But I suspect that's probably a little too cute to be accepted in OpenBSD. :-)

Here are a few more screenshots.

                    /0   /1   /2   /3   /4   /5   /6   /7   /8   /9   /10
     Load Average   >>>

Sensor                            Value      Status       Description
acpiac0.indicator0                   On                   (power supply)
acpibat0.volt0               12.53 V DC                   (voltage)   
acpibat0.volt1                0.00 V DC      unknown      (current voltage)
acpibat0.watthour0              4.80 Wh                   (last full capacity)
acpibat0.watthour1              1.00 Wh                   (warning capacity)
acpibat0.watthour2              0.40 Wh                   (low capacity)
acpibat0.watthour3              4.80 Wh      OK           (remaining capacity)
acpibat0.raw0                     2 raw      OK           (battery full)
acpibat0.raw1                     0 raw      unknown      (rate)   
acpidock0.indicator0                Off                   (not docked)
acpitz0.temp0                51.05 degC                   (zone temperature)
acpitz1.temp0                51.05 degC                   (zone temperature)

                    /0   /1   /2   /3   /4   /5   /6   /7   /8   /9   /10
     Load Average   | 

Sensor                            Value      Status       Description
ipmi0.temp0                  31.00 degC      OK           (CPU Planar)
ipmi0.temp1                  23.00 degC      OK           (Ambient)
ipmi0.fan0                     6000 RPM      OK           (Fan 1)
ipmi0.fan1                     5880 RPM      OK           (Fan 2)
ipmi0.fan2                     6000 RPM      OK           (Fan 3)
ipmi0.fan3                     6600 RPM      OK           (Fan 4)
ipmi0.fan4                     5880 RPM      OK           (Fan 5)
ipmi0.fan5                     6720 RPM      OK           (Fan 6)
ipmi0.fan6                     6600 RPM      OK           (Fan 7)
ipmi0.volt0                   1.50 V DC      OK           (CPU)
ipmi0.volt1                   5.02 V DC      OK           (+5)
ipmi0.volt2                  11.90 V DC      OK           (+12)
ipmi0.volt3                   3.30 V DC      OK           (+3.3)
ipmi0.volt4                   3.11 V DC      OK           (Battery)
ipmi0.volt5                   2.50 V DC      OK           (+2.5)
ipmi0.volt6                   3.30 V DC      OK           (+3.3 Aux)
ipmi0.volt7                   3.92 V DC      OK           (ROMB Battery)
ipmi0.volt8                   1.82 V DC      OK           (+1.8)
ipmi0.volt9                   1.50 V DC      OK           (+1.5)
ipmi0.indicator0                    Off      OK           (Cover Intrusion)
ipmi0.indicator1                     On      OK           (Power Supply - 1)
ipmi0.indicator2                     On      OK           (Power Supply - 2)
ami0.drive0                      online      OK           (sd0)
safte0.temp0                 23.33 degC      OK

(Comments are closed)

  1. By Anonymous Coward ( on

    Yayy for TOPS-10!

  2. By Anonymous Coward ( on

    While I know OpenBSD is mainly a text culture, could putting this on a background terminal in X be a hack replacement for torsmo/conky?

    1. By Deanna Phillips (deanna) on

      > While I know OpenBSD is mainly a text culture, could putting this on a background terminal in X be a hack replacement for torsmo/conky?

      I'm not totally sure what these are, but I assume they're system monitors. If that's the case, then, of course.

      In other news, the top window with the load average was changed from the old ascii histogram to the same numeric format found in 'vm'. So now even pigs is somewhat useful. :)

      4 users Load 0.97 1.39 1.51 Wed Feb 28 09:39:31 2007

  3. By Anonymous Coward ( on

    If you've never used systat before, make sure to try 'systat -w 1 vmstat'. I use it everyday. Looking forward to trying out the new sensors mode...

  4. By jared rr spiegel ( on

    i'll probably get shot in the face for saying this, but i've been feenin' for systat(1) to allow multiple displays on a single window, such as saying ``:vmstat,if'', thus showing 'vmstat', and if there're enough $LINES in the terminal window, showing 'if' below.

    two problems with this tho:
    - i have no diff to submit
    - i'm also the guy who wants to be able to scroll up and down (with any one of emacs/vi or cursor keys) in top(1), so .. well, see shot in face comment above.

    hi5 re sensors tho. there are a few utilities that the GNU ppl have that would be really nice to see in OpenBSD; and conversely there are a few utilities in (Open|*)BSD that i'm amazed the GNU ppl can live without. systat is both useful and nifty.


Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]