{{Short description|Hardware monitoring sensors framework}} {{lowercase}} {{Use mdy dates|date=March 2019}} {{Infobox software | name = hw.sensors | author = Constantine A. Murenin (2006),<br/>Alexander Yurchenko (2003–2004) | developer = The OpenBSD Project | released = {{Start date and age|2003|04|25|df=yes}} | programming language = C | operating system = OpenBSD, DragonFly BSD | genre = system monitoring | licence = ISC }} The '''hw.sensors''' framework is a kernel-level hardware sensors framework originating from OpenBSD, which uses the sysctl kernel interface as the transport layer between the kernel and the userland. {{As of|2019}}, the framework is used by over a hundred device drivers in OpenBSD to export various environmental sensors, with temperature sensors being the most common type.<ref name=mmath/><ref name=abc2009/> Consumption and monitoring of sensors is done in the userland with the help of sysctl, systat, sensorsd, OpenBSD NTP Daemon (OpenNTPD, ntpd), Simple Network Management Protocol (snmpd), ports/sysutils/symon and GKrellM.<ref name=kerneltrap08/><ref name=gkrellm/>
== Drivers == In OpenBSD, the framework is integrated with Dell's ESM, Intelligent Platform Management Interface (IPMI) and I<sup>2</sup>C,<ref name=opencon06/><ref name=zdnet06/> in addition to several popular Super I/O chips through {{URL|http://mdoc.su/o/lm.4|<code>lm(4)</code>}}.<ref name=abc2009/>
A major difference compared to other solutions like lm_sensors is simplicity and a works-by-default approach in the drivers, which don't need or support any configurability; no installation or configuration actions are required by the system administrator to get the sensors going.<ref name=linux06/><ref name=zdnet06/> This is coupled with a fine-tuned ad-hoc read-only scan procedure on the I<sup>2</sup>C bus, written by Theo de Raadt in a centralised way with a cache, making it possible to leave it enabled by default at all times, unlike the competing solutions.<ref name=linux06/><ref name=zdnet06/><ref name=i2c_scan/>
=== RAID <code>drive</code> sensors === {{anchor|drive|SENSOR_DRIVE}} Support for automatic monitoring of RAID drives is also provided through the sensors framework,<ref name=opencon06/> this concept of sensors of <code>drive</code> type has been backported by NetBSD back into envsys in 2007.<ref name=abc2009/>
=== OpenNTPD <code>timedelta</code> sensors === {{anchor|timedelta|SENSOR_TIMEDELTA}} OpenNTPD uses sensors of type <code>timedelta</code> to synchronise time.<ref name=ntpd/> These are provided by NMEA and other drivers.<ref name=mbalmer07/><ref name=nmea/>
== History == The framework was originally devised in 2003 by Alexander Yurchenko, when he was porting several envsys-based drivers from NetBSD. Instead of porting NetBSD's envsys, a simpler sysctl-based mechanism was developed.<ref name=abc2009/>
Framework use by the device drivers rose sharply with the release of OpenBSD 3.9. Then, in only 6 months, the number of individual drivers using the framework rose from 9 in OpenBSD 3.8 (released {{dts|2005|11|01|format=dmy}}) to 33 in OpenBSD 3.9 (released {{dts|2006|05|01|format=dmy}}).<ref name=abc2009/>
{{As of|2006|12|23}}, the framework was used by 44 devices drivers. At this time, a patchset was committed converting a simple one-level addressing scheme into a more stable multi-layer addressing.<ref name=ieee07/><ref name=undeadly06/>
In 2007, the framework was ported to FreeBSD as part of a Google Summer of Code grant. It was adopted by DragonFly BSD later that year.<ref name=gsoc/> The usability of the {{URL|http://mdoc.su/o/sensorsd.8|<code>sensorsd(8)</code>}}, the sensor monitoring daemon, was vastly improved in 2007, partly via the same GSoC grant.<ref name=onlamp-42/>
{{As of|2008|11|01}}, the total number of drivers stood at 68 in OpenBSD 4.4; growing by 7 drivers in a 6-month release cycle.<ref name=onlamp-44/> This rate of growth, of one new driver per month on average, has been common throughout the history of the framework since OpenBSD 3.9.<ref name=abc2009/>
The values exported by the drivers through the framework are read-only; however, an external patch exists that implements the fan control functions in both the framework, and in one of the drivers for the most popular family of Super I/O chips. This patchset was provided for both OpenBSD and DragonFly BSD.<ref name=fanctl/><ref name=mmath/>
== See also == {{Portal|Free and open-source software}} * lm_sensors * SpeedFan
== References == {{Reflist |refs=
<ref name=zdnet06>{{cite web |url=https://www.zdnet.com/article/openbsd-3-9-adds-sensor-framework/ |title=OpenBSD 3.9 adds sensor framework |author=Ingrid Marson |publisher=ZDNet |date=2006-03-24 |access-date=2019-03-04 }}</ref>
<ref name=linux06>{{cite web |url=https://www.linux.com/news/interview-theo-de-raadt-openbsd |title=Interview: Theo de Raadt of OpenBSD |author=Manolis Tzanidakis |publisher=Linux.com |date=2006-03-28 |access-date=2019-03-04 }}</ref>
<ref name=gsoc>{{cite web |url=https://wiki.freebsd.org/GSoC2007/cnst-sensors |title=GSoC2007/cnst-sensors |author=Constantine A. Murenin |publisher=FreeBSD |date=2007-10-14 |access-date=2019-03-04 }}</ref>
<ref name=kerneltrap08>{{cite web |url=http://kerneltrap.org/OpenBSD/BSDCan_2008_Hardware_Sensors_Framework |title=BSDCan 2008: Hardware Sensors Framework |author=Jeremy Andrews |website=KernelTrap |date=2008-06-07 |archive-url=https://web.archive.org/web/20101218045620/http://kerneltrap.org/OpenBSD/BSDCan_2008_Hardware_Sensors_Framework |access-date=2019-03-04 |archive-date=December 18, 2010 }}</ref>
<ref name=gkrellm>{{cite web |url=http://ports.su/sysutils/gkrellm/gkrellm,-main |title=gkrellm-server-2.3.10p1 – single process stack of system monitors for GTK+2 (server) |work=OpenBSD ports |date=2018-06-01 |access-date=2019-03-04 }}</ref>
<ref name=onlamp-42>{{cite web |url=http://onlamp.com/lpt/a/7155 |title=Puffy's Marathon: What's New in OpenBSD 4.2 |author=Federico Biancuzzi |publisher=O'Reilly Media |date=2007-11-01 |archive-url=https://web.archive.org/web/20111013021755/http://onlamp.com/lpt/a/7155 |access-date=2019-03-03 |archive-date=October 13, 2011 }} *{{cite web |title=Puffy's Marathon: What's New in OpenBSD 4.2 - ONLamp.com |url=https://undeadly.org/cgi?action=article&sid=20071102080000 |website=Undeadly}}</ref>
<ref name=onlamp-44>{{cite web |url=http://broadcast.oreilly.com/2008/11/source-wars---return-of-the-pu.html |title=Source Wars - Return of the Puffy: What's New in OpenBSD 4.4 |author=Federico Biancuzzi |publisher=O'Reilly Media |date=2008-11-03 |archive-url=https://web.archive.org/web/20120524040127/http://broadcast.oreilly.com/2008/11/source-wars---return-of-the-pu.html |access-date=2019-03-03 |archive-date=May 24, 2012 }}</ref>
<ref name=opencon06>{{Cite conference |author1=David Gwynne |author2=Marco Peereboom |date=2006-12-03 |url=https://www.openbsd.org/papers/opencon06-bio.pdf |title=bio and sensors in OpenBSD |conference=OpenCON 2006, 2–3 December 2006 |location=Courtyard Venice Airport, Venice/Tessera, Italy |access-date=2019-03-04 }}</ref>
<ref name=ieee07>{{Cite conference |author=Constantine A. Murenin |date=2007 |title=Generalised Interfacing with Microprocessor System Hardware Monitors |conference=Proceedings of 2007 IEEE International Conference on Networking, Sensing and Control, 15–17 April 2007. |location=London, United Kingdom |id=IEEE ICNSC 2007, pp. 901—906. |doi=10.1109/ICNSC.2007.372901 }}</ref>
<ref name=undeadly06>{{Cite web |author=Constantine A. Murenin |editor=Marco Peereboom |date=2006-12-30 |url=https://undeadly.org/cgi?action=article&sid=20061230235005 |title=New two-level sensor API |website=OpenBSD Journal |access-date=2019-03-04 }}</ref>
<ref name=mbalmer07>{{Cite conference |author=Marc Balmer |date=2007-03-15 |url=https://www.openbsd.org/papers/radio-clocks-asiabsdcon07.pdf |title=Support for Radio Clocks in OpenBSD |conference=AsiaBSDCon 2007 Proceedings, 8–11 March 2007 |location=Tokyo, Japan |publication-date=2007-03-10 |archive-url=https://web.archive.org/web/20080827225534/https://2007.asiabsdcon.org/papers/P03-paper.pdf |archive-date=2008-08-27 |url-status=live |access-date=2019-03-04 }} *{{cite web |author=Marc Balmer |date=2007-09-16 |title=Supporting Radio Clocks in OpenBSD |url=https://www.openbsd.org/papers/eurobsdcon07/mbalmer-radio_clocks.pdf |website=OpenBSD}}</ref>
<ref name=abc2009>{{Cite conference |author1=Constantine A. Murenin |author2=Raouf Boutaba |date=2009-03-17 |url=https://www.openbsd.org/papers/asiabsdcon2009-sensors-paper.pdf |title=OpenBSD Hardware Sensors Framework. |conference=AsiaBSDCon 2009 Proceedings, 12–15 March 2009 |location=Tokyo University of Science, Tokyo, Japan |publication-date=2009-03-14 |archive-url=https://web.archive.org/web/20090221000000/https://www.openbsd.org/papers/asiabsdcon2009-sensors-paper.pdf |archive-date=February 21, 2009 |url-status=live |access-date=2019-03-04 }} [https://2009.asiabsdcon.org/papers/abc2009-P3B-paper.pdf Alt URL]</ref>
<ref name=fanctl>{{cite web |url=http://sensors.cnst.su/fanctl/ |author=Constantine A. Murenin |date=2010-03-14 |access-date=2019-03-04 |title=Quiet computing with BSD: Fan control with sysctl hw.sensors and lm(4) on OpenBSD and DragonFly BSD }}</ref>
<ref name=i2c_scan>{{cite web |url=https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/dev/i2c/i2c_scan.c |author=Theo de Raadt |author-link=Theo de Raadt |date=2015-05-29 |access-date=2019-03-04 |title=/sys/dev/i2c/i2c_scan.c |website=Super User's BSD Cross Reference }}</ref>
<ref name=ntpd>{{cite web |url=https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.sbin/ntpd/sensors.c |author=Henning Brauer |date=2016-09-03 |access-date=2019-03-04 |title=ntpd/sensors.c |website=Super User's BSD Cross Reference }}</ref>
<ref name=nmea>{{cite web |url=https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/kern/tty_nmea.c |author=Marc Balmer |date=2019-01-26 |access-date=2019-03-04 |title=/sys/kern/tty_nmea.c |website=Super User's BSD Cross Reference }}</ref>
<ref name=mmath>{{cite thesis |type=MMath |author=Constantine A. Murenin |date=2010-05-21 |title=OpenBSD Hardware Sensors — Environmental Monitoring and Fan Control. |location=University of Waterloo, Waterloo, Ontario, Canada |publisher=UWSpace |url=http://cnst.su/MMathCS |hdl=10012/5234 |id=Document ID: ab71498b6b1a60ff817b29d56997a418. }}</ref> }}
{{Refbegin}} {{Refend}}
== External links == * {{URL|https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/sys/sensors.h}} * {{URL|https://www.openbsd.org/papers/asiabsdcon2009-sensors-paper.pdf|asiabsdcon2009-sensors-paper.pdf}} * {{URL|https://www.openbsd.org/papers/asiabsdcon2009-sensors-slides.pdf|asiabsdcon2009-sensors-slides.pdf}}
{{OpenBSD}} {{DragonFly}}
Category:BSD software Category:OpenBSD Category:FreeBSD Category:DragonFly BSD Category:Software using the ISC license Category:System administration