1.\" $OpenBSD: sensorsd.conf.5,v 1.18 2007/08/14 17:10:02 cnst Exp $
2.\" $DragonFly: src/usr.sbin/sensorsd/sensorsd.conf.5,v 1.2 2007/10/26 08:22:01 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@FreeBSD.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 August 14, 2007
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 (such as those from
80.Xr bio 4 ,
81.Xr esm 4 ,
82or
83.Xr ipmi 4 )
84do not require boundary values specified
85and simply trigger on status transitions.
86If boundaries are specified nonetheless,
87then they are used in addition to automatic status monitoring,
88unless the
89.Dq Li istatus
90attribute is specified to ignore status values that are provided by the drivers.
91.Pp
92The command is executed when there is any change in sensor state.
93Tokens in the command are substituted as follows:
94.Pp
95.Bl -tag -width indent -offset indent -compact
96.It Li %x
97the
98.Va xname
99of the device the sensor sits on
100.It Li %t
101the type of sensor
102.It Li %n
103the sensor number
104.It Li %2
105the sensor's current value
106.It Li %3
107the sensor's low limit
108.It Li %4
109the sensor's high limit
110.El
111.Pp
112By default,
113.Xr sensorsd 8
114monitors status changes on all sensors that keep their state.
115This behaviour may be altered by using the
116.Dq Li istatus
117attribute to ignore
118status changes of sensors of a certain type
119or individual sensors.
120.Sh FILES
121.Bl -tag -width ".Pa /etc/sensorsd.conf"
122.It Pa /etc/sensorsd.conf
123Configuration file for
124.Xr sensorsd 8 .
125.El
126.Sh EXAMPLES
127In the following configuration file,
128if
129.Va hw.sensors.ipmi0.temp0
130transitions 80C or
131if its status as provided by
132.Xr ipmi 4
133changes, the command
134.Pa /etc/sensorsd/log_warning
135will be executed,
136with the sensor type, number and current value passed to it.
137Alerts will be sent
138if
139.Va hw.sensors.lm0.volt3
140transitions to being within or outside
141a range of 4.8V and 5.2V;
142if the speed of the fan attached to
143.Va hw.sensors.lm0.fan1
144transitions to being below or above 1000RPM;
145if any RAID volume drive
146changes its status from, for example,
147.Dq Li OK ,
148such as in the case of drive failure, rebuild, or a complete failure,
149the command
150.Pa /etc/sensorsd/drive
151will be executed, with the sensor number passed to it; however,
152no alerts will be generated for status changes on timedelta sensors.
153For all other sensors whose drivers automatically provide
154sensor status updates, alerts will be generated
155each time those sensors undergo status transitions.
156.Bd -literal -offset indent
157# Comments are allowed
158hw.sensors.ipmi0.temp0:high=80C:command=/etc/sensorsd/log_warning %t %n %2
159hw.sensors.lm0.volt3:low=4.8V:high=5.2V
160hw.sensors.lm0.fan1:low=1000
161drive:command=/etc/sensorsd/drive %n
162timedelta:istatus	#ignore status changes for timedelta
163.Ed
164.Sh SEE ALSO
165.Xr getcap 3 ,
166.Xr bio 4 ,
167.Xr esm 4 ,
168.Xr ipmi 4 ,
169.Xr sensorsd 8 ,
170.Xr sysctl 8
171.Sh HISTORY
172The
173.Nm
174file format first appeared in
175.Ox 3.5 .
176The format was altered in
177.Ox 4.1
178to accommodate hierarchical device-based sensor addressing.
179The
180.Dq Li istatus
181attribute was introduced in
182.Ox 4.2 .
183.Sh CAVEATS
184Alert functionality is triggered every time there is a change in sensor state;
185for example, when
186.Xr sensorsd 8
187is started,
188the status of each monitored sensor changes
189from undefined to whatever it is.
190One must keep this in mind when using commands
191that may unconditionally perform adverse actions (e.g.\&
192.Xr shutdown 8 ) ,
193as they will be executed even when all sensors perform to specification.
194If this is undesirable, then a wrapper shell script should be used instead.
195