1.\" $OpenBSD: sensorsd.conf.5,v 1.28 2019/09/02 21:18:41 deraadt Exp $ 2.\" 3.\" Copyright (c) 2003 Henning Brauer <henning@openbsd.org> 4.\" Copyright (c) 2005 Matthew Gream <matthew.gream@pobox.com> 5.\" Copyright (c) 2007 Constantine A. Murenin <cnst@openbsd.org> 6.\" 7.\" Permission to use, copy, modify, and distribute this software for any 8.\" purpose with or without fee is hereby granted, provided that the above 9.\" copyright notice and this permission notice appear in all copies. 10.\" 11.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18.\" 19.Dd $Mdocdate: September 2 2019 $ 20.Dt SENSORSD.CONF 5 21.Os 22.Sh NAME 23.Nm sensorsd.conf 24.Nd configuration file for sensorsd 25.Sh DESCRIPTION 26The 27.Nm 28file is read by 29.Xr sensorsd 8 30to configure hardware sensor monitoring. 31Each variable in the 32.Xr sysctl 2 33.Va hw.sensors 34subtree represents a sensor. 35Each sensor is matched by at most one entry in 36.Nm , 37which may specify high and low limits, 38and whether sensor status changes provided by the driver should be ignored. 39Each time the limits are crossed in either direction 40or the status provided by the driver changes, 41.Xr sensorsd 8 Ns 's 42alert functionality is triggered and a command, if specified, is 43executed. 44.Pp 45.Nm 46follows the syntax of configuration databases as documented in 47.Xr cgetent 3 . 48Sensors may be specified by their full 49.Va hw.sensors 50.Xr sysctl 8 51variable name or by type, 52with the full name taking precedence. 53For example, if an entry 54.Dq hw.sensors.lm0.temp1 55is not found, then an entry for 56.Dq temp 57will instead be looked for. 58.Pp 59The following attributes may be used: 60.Pp 61.Bl -tag -width "commandXX" -offset indent -compact 62.It Li command 63Specify a command to be executed on state change. 64.It Li high 65Specify the largest acceptable value. 66.It Li low 67Specify the smallest acceptable value. 68.It Li istatus 69Ignore status provided by the driver. 70.El 71.Pp 72The values for temperature sensors can be given in degrees Celsius or 73Fahrenheit, for voltage sensors in volts, and fan speed sensors take a 74unit-less number representing RPM. 75For Boolean sensors, specify 0 for 76.Qq Off 77or 1 for 78.Qq On . 79Values for all other types of sensors can be specified 80in the same units as they appear under the 81.Xr sysctl 8 82.Va hw.sensors 83tree. 84.Pp 85Sensors that provide status (such as those from 86.Xr bio 4 , 87.Xr esm 4 , 88or 89.Xr ipmi 4 ) 90do not require boundary values specified 91and simply trigger on status transitions. 92If boundaries are specified nonetheless, 93then they are used in addition to automatic status monitoring, 94unless the 95.Dq istatus 96attribute is specified to ignore status values that are provided by the drivers. 97.Pp 98The command is executed when there is any change in sensor state. 99Tokens in the command are substituted as follows: 100.Pp 101.Bl -tag -width Ds -offset indent -compact 102.It %l 103Whether the value exceeds or is within the user specified limits. 104Can be one of: "below", "above", "within", "invalid", or "uninitialised". 105.It %n 106The sensor number. 107.It %s 108The sensor status. 109.It %x 110The xname of the device the sensor sits on. 111.It %t 112The type of sensor. 113.It %2 114The sensor's current value. 115.It %3 116The sensor's low limit. 117.It %4 118The sensor's high limit. 119.El 120.Pp 121For Boolean sensors, %2, %3, and %4 are substituted with 122.Qq On 123or 124.Qq Off . 125.Pp 126By default, 127.Xr sensorsd 8 128monitors status changes on all sensors that keep their state. 129This behaviour may be altered by using the 130.Dq istatus 131attribute to ignore 132status changes of sensors of a certain type 133or individual sensors. 134.Sh FILES 135.Bl -tag -width "/etc/sensorsd.conf" 136.It Pa /etc/sensorsd.conf 137Configuration file for 138.Xr sensorsd 8 . 139.El 140.Sh EXAMPLES 141In the following configuration file, 142if hw.sensors.ipmi0.temp0 moves upwards beyond 80C 143or downwards to 80C or less or if its status as provided by 144.Xr ipmi 4 145changes, the command 146.Pa /etc/sensorsd/log_warning 147will be executed, 148with the sensor type, number and current value passed to it. 149Alerts will be sent 150if hw.sensors.lm0.volt3 moves into or out of 151the range from 4.8V to 5.2V, inclusive; 152if the speed of the fan attached to hw.sensors.lm0.fan1 153transitions to being below or above 1000RPM; 154if any RAID volume drive 155changes its status from, for example, 156.Dq OK , 157such as in the case of drive failure, rebuild, or a complete failure, 158the command 159.Pa /etc/sensorsd/drive 160will be executed, with the sensor number passed to it; however, 161no alerts will be generated for status changes on timedelta sensors. 162For all other sensors whose drivers automatically provide 163sensor status updates, alerts will be generated 164each time those sensors undergo status transitions. 165.Bd -literal -offset indent 166# Comments are allowed 167hw.sensors.ipmi0.temp0:high=80C:command=/etc/sensorsd/log_warning %t %n %2 168hw.sensors.lm0.volt3:low=4.8V:high=5.2V 169hw.sensors.lm0.fan1:low=1000 170drive:command=/etc/sensorsd/drive %n 171timedelta:istatus #ignore status changes for timedelta 172.Ed 173.Sh SEE ALSO 174.Xr cgetent 3 , 175.Xr bio 4 , 176.Xr ipmi 4 , 177.Xr sensorsd 8 , 178.Xr sysctl 8 179.Sh HISTORY 180The 181.Nm 182file format first appeared in 183.Ox 3.5 . 184The format was altered in 185.Ox 4.1 186to accommodate hierarchical device-based sensor addressing. 187The 188.Dq istatus 189attribute was introduced in 190.Ox 4.2 . 191.Sh CAVEATS 192Alert functionality is triggered every time there is a change in sensor state; 193for example, when 194.Xr sensorsd 8 195is started, 196the status of each monitored sensor changes 197from undefined to whatever it is. 198One must keep this in mind when using commands 199that may unconditionally perform adverse actions (e.g.\& 200.Xr shutdown 8 ) , 201as they will be executed even when all sensors perform to specification. 202If this is undesirable, then a wrapper shell script should be used instead. 203