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