xref: /netbsd/usr.sbin/envstat/envstat.8 (revision b73c2b02)
1*b73c2b02Sbrad.\"	$NetBSD: envstat.8,v 1.67 2022/11/21 21:24:02 brad Exp $
238cfdfd8Sgroo.\"
3fa731302Skardel.\" Copyright (c) 2000, 2007, 2008, 2009, 2014 The NetBSD Foundation, Inc.
438cfdfd8Sgroo.\" All rights reserved.
538cfdfd8Sgroo.\"
638cfdfd8Sgroo.\" This code is derived from software contributed to The NetBSD Foundation
7af211bb4Sxtraeme.\" by Juan Romero Pardines and Bill Squier.
838cfdfd8Sgroo.\"
938cfdfd8Sgroo.\" Redistribution and use in source and binary forms, with or without
1038cfdfd8Sgroo.\" modification, are permitted provided that the following conditions
1138cfdfd8Sgroo.\" are met:
1238cfdfd8Sgroo.\" 1. Redistributions of source code must retain the above copyright
1338cfdfd8Sgroo.\"    notice, this list of conditions and the following disclaimer.
1438cfdfd8Sgroo.\" 2. Redistributions in binary form must reproduce the above copyright
1538cfdfd8Sgroo.\"    notice, this list of conditions and the following disclaimer in the
1638cfdfd8Sgroo.\"    documentation and/or other materials provided with the distribution.
1738cfdfd8Sgroo.\"
1838cfdfd8Sgroo.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1938cfdfd8Sgroo.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2038cfdfd8Sgroo.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2138cfdfd8Sgroo.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2238cfdfd8Sgroo.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2338cfdfd8Sgroo.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2438cfdfd8Sgroo.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2538cfdfd8Sgroo.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2638cfdfd8Sgroo.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2738cfdfd8Sgroo.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2838cfdfd8Sgroo.\" POSSIBILITY OF SUCH DAMAGE.
2938cfdfd8Sgroo.\"
30e76d963bSwiz.Dd November 14, 2020
3138cfdfd8Sgroo.Dt ENVSTAT 8
3238cfdfd8Sgroo.Os
3338cfdfd8Sgroo.Sh NAME
3438cfdfd8Sgroo.Nm envstat
35af211bb4Sxtraeme.Nd utility to handle environmental sensors
3638cfdfd8Sgroo.Sh SYNOPSIS
3738cfdfd8Sgroo.Nm
381c37d75fSmlelstv.Op Fl DfIklnSTW
39f2803256Sxtraeme.Op Fl c Ar file
40af211bb4Sxtraeme.Op Fl d Ar device
4138cfdfd8Sgroo.Op Fl i Ar interval
42b16a06cdSxtraeme.Op Fl s Ar "device:sensor,..."
4338cfdfd8Sgroo.Op Fl w Ar width
44adbfab89Smlelstv.Nm
45adbfab89Smlelstv.Fl x
46adbfab89Smlelstv.Op Fl d Ar device
47adbfab89Smlelstv.Op Fl s Ar "device:sensor,..."
489a59c229Smlelstv.Op Ar property...
4938cfdfd8Sgroo.Sh DESCRIPTION
5038cfdfd8Sgroo.Nm
51af211bb4Sxtraemeis a utility that handles various aspects of the sensors
52af211bb4Sxtraemeregistered with the
5338cfdfd8Sgroo.Xr envsys 4
54af211bb4Sxtraemeframework.
55af211bb4SxtraemeIt is capable of displaying sensor values as well as
56af211bb4Sxtraemechanging parameters and setting critical limits for the sensors.
5738cfdfd8Sgroo.Pp
58af211bb4SxtraemeIn display mode, column widths as well as displayed sensors
59af211bb4Sxtraemeare fully customizable.
600d2161c8SxtraemeCritical limits or other properties can be set via the configuration file.
61af211bb4SxtraemeIf critical limits were set previously, the display mode will show
62af211bb4Sxtraemethe critical limits in addition to the current values.
63af211bb4Sxtraeme.Pp
64af211bb4SxtraemeThe following options are available:
6538cfdfd8Sgroo.Bl -tag -width flag
66f2803256Sxtraeme.It Fl c
67f2803256SxtraemeAccepts a file as argument to set properties for sensors in
6884591547Swizdevices registered with the framework.
6984591547SwizSee the
70f2803256Sxtraeme.Xr envsys.conf 5
71f2803256Sxtraememanual page for more information.
72af211bb4Sxtraeme.It Fl D
7330c5f899SrizDisplay the names of the devices that are currently registered with
74af211bb4Sxtraemethe
75af211bb4Sxtraeme.Xr envsys 4
7630c5f899Srizframework, one per line, along with some properties for the device
7730c5f899Sriz(for example, its refresh timeout value).
789df195edSxtraeme.It Fl d Ar device
799df195edSxtraemeDisplay only the sensors for the given
809df195edSxtraeme.Ar device .
819df195edSxtraemeThis is useful when there are multiple devices registered and
829df195edSxtraemeyou want to only see results from a specific device.
8338cfdfd8Sgroo.It Fl f
84af211bb4SxtraemeDisplay temperature values in degrees Fahrenheit.
858b0cfb2dSwizThe default is to display temperature values in degrees Celsius.
86c231a901Splunky.It Fl I
8730c5f899SrizThis flag skips the sensors with invalid state; these are normally
889df195edSxtraemeshown using the
899df195edSxtraeme.Qq N/A
90c231a901Splunkystring by default.
919df195edSxtraeme.It Fl i Ar interval
9238cfdfd8SgrooRepeat the display every
9338cfdfd8Sgroo.Ar interval
948b0cfb2dSwizseconds.
953b0395d2SplunkyNote that some devices do not provide fresh values on demand.
96cc8e7a96SwizSee the individual device's manual page for meaningful values for
9738cfdfd8Sgroo.Ar interval .
9838cfdfd8SgrooIf not specified, or specified as 0,
9938cfdfd8Sgroo.Nm
1009df195edSxtraemeproduces one round of values and exits.
1014f97e87bSahoka.It Fl k
1024f97e87bSahokaDisplay temperature values in Kelvin.
1034f97e87bSahokaThe default is to display temperature values in degrees Celsius.
104af211bb4Sxtraeme.It Fl l
105af211bb4SxtraemeList the names of all supported sensors, one per line.
106af211bb4SxtraemeUse of this flag causes
107af211bb4Sxtraeme.Nm
108af211bb4Sxtraemeto ignore all other option flags.
1091c37d75fSmlelstv.It Fl n
1101c37d75fSmlelstvPrint only the current value of a sensor and no headers.
1111c37d75fSmlelstvIf statistics are selected with
1121c37d75fSmlelstv.Fl T
1131c37d75fSmlelstvthen also display max, min and average.
1142577f77bSxtraeme.It Fl r
1159df195edSxtraemeThis flag is provided for compatibility reasons and there's no need
11684591547Swizto use it.
11784591547SwizIn the previous implementation, it was used to enable the
1189df195edSxtraemerow mode; this mode is now the default.
119f2803256Sxtraeme.It Fl S
120f2803256SxtraemeThis flag is used to restore defaults to all devices registered with
12184591547Swizthe framework.
12284591547SwizThis will remove all properties that were set in
12330c5f899Srizthe configuration file to the setting that the devices use by
124f2803256Sxtraemedefault.
125b16a06cdSxtraeme.It Fl s Ar "device:sensor,..."
12630c5f899SrizRestrict the display to the named devices and sensors.
127b16a06cdSxtraemeThe pair device and sensor description must be supplied as a comma separated list.
128b16a06cdSxtraemeDevice as well as sensor descriptions are case sensitive.
12930c5f899SrizNote that the order of the arguments given does not influence the order of output.
130f960b01bSxtraeme.It Fl T
13184591547SwizCreate and display max, min and average statistics for a sensor.
13284591547SwizMust be used with an
133f960b01bSxtraeme.Ar interval ,
13484591547Swizotherwise statistics cannot be collected up.
13584591547SwizPlease note that to get realistic
136f960b01bSxtraemevalues a lower interval value should be used, but that will also increase
137f960b01bSxtraemeoverhead.
1389df195edSxtraeme.It Fl w Ar width
13938cfdfd8SgrooUse
14038cfdfd8Sgroo.Ar width
1418b0cfb2dSwizas the column width for the output.
1428b0cfb2dSwizEach column is additionally separated by a single space.
143af211bb4SxtraemeThe default is the length of the longest sensor name.
1446d65ba83Spgoyette.It Fl W
14505f103b5SwizThis option has no effect.
14605f103b5SwizIt is retained for historical reasons.
147af211bb4Sxtraeme.It Fl x
14830c5f899SrizShows the raw XML property list used by the
149af211bb4Sxtraeme.Xr sysmon_envsys 9
15030c5f899Srizframework that contains details about all registered devices
151af211bb4Sxtraemeand sensors.
1529a59c229SmlelstvIf
1539a59c229Smlelstv.Ar property
1549a59c229Smlelstvis specified, the value of that property is printed.
155adbfab89SmlelstvThe property list can be filtered with the
156e76d963bSwiz.Fl d
157e76d963bSwizor
158adbfab89Smlelstv.Fl s
159e76d963bSwizoptions.
160e76d963bSwizIf
161e76d963bSwiz.Fl s
162e76d963bSwizis used with only a single sensor, only the properties
163adbfab89Smlelstvof this sensor are returned, not a list of sensors.
16438cfdfd8Sgroo.El
165a66933c9Sreed.Sh UNITS
166a66933c9SreedThe display mode may show some values with abbreviated units;
167a66933c9Sreedfor example:
168a66933c9Sreed.Bl -tag -width "12345678" -compact -offset indent
169a66933c9Sreed.It A
170a66933c9SreedAmperes
171a66933c9Sreed.It Ah
172a66933c9SreedAmpere-hours
173a66933c9Sreed.It degC
174a66933c9Sreeddegrees Celsius
175a66933c9Sreed.It degF
176a66933c9Sreeddegrees Fahrenheit
177a66933c9Sreed.It K
178a66933c9SreedKelvin
179a66933c9Sreed.It Ohms
180a66933c9SreedOhms
181a66933c9Sreed.It RPM
182a66933c9SreedRevolutions per minute
183a66933c9Sreed.It V
184a66933c9SreedVolts DC
185a66933c9Sreed.It VAC
186a66933c9SreedVolts AC
187a66933c9Sreed.It W
188a66933c9SreedWatts
189a66933c9Sreed.It Wh
190a66933c9SreedWatt-hours
191fa731302Skardel.It %rH
192fa731302Skardelrelative Humidity
193*b73c2b02Sbrad.It hPa
194*b73c2b02SbradHectopascals
195a66933c9Sreed.El
196623f8d5aSreed.Sh EXAMPLES
197f2803256SxtraemeTo display the
198b16a06cdSxtraeme.Dq charge
19930c5f899Srizsensor of the device
200b16a06cdSxtraeme.Ar acpibat0
201b16a06cdSxtraemein one line every ten seconds:
202af211bb4Sxtraeme.Pp
203b16a06cdSxtraeme.Dl $ envstat -s \*qacpibat0:charge\*q -i 10
204af211bb4Sxtraeme.Pp
20530c5f899SrizTo list the devices that are currently registered with
206af211bb4Sxtraeme.Xr envsys 4 :
207af211bb4Sxtraeme.Pp
208af211bb4Sxtraeme.Dl $ envstat -D
209af211bb4Sxtraeme.Pp
21030c5f899SrizTo display the sensors of the device
21155a81df2Spgoyette.Ar aibs0 :
212af211bb4Sxtraeme.Pp
21355a81df2Spgoyette.Dl $ envstat -d aibs0
214af211bb4Sxtraeme.Pp
215f2803256SxtraemeTo set all properties specified in the configuration file:
216af211bb4Sxtraeme.Pp
217f2803256Sxtraeme.Dl $ envstat -c /etc/envsys.conf
218af211bb4Sxtraeme.Pp
219f960b01bSxtraemeTo remove all properties that were set previously in the configuration
220f2803256Sxtraemefile:
221f960b01bSxtraeme.Pp
222f2803256Sxtraeme.Dl $ envstat -S
223f960b01bSxtraeme.Pp
224f960b01bSxtraemeTo display statistics for all sensors and ignoring sensors with
225f960b01bSxtraemeinvalid states every second:
226f960b01bSxtraeme.Pp
227f960b01bSxtraeme.Dl $ envstat -ITi1
228adbfab89Smlelstv.Pp
229adbfab89SmlelstvTo return a single temperature value:
230adbfab89Smlelstv.Pp
231adbfab89Smlelstv.Dl $ envstat -s vcmbox0:temperature -x /cur-value
232adbfab89Smlelstv.Pp
233adbfab89SmlelstvTo return values of multiple temperature sensors from a single device
234adbfab89Smlelstv.Pp
235adbfab89Smlelstv.Dl $ envstat -s 'thinkpad0:temperature 0,thinkpad0:temperature 1' -x /thinkpad0/0/cur-value /thinkpad0/1/cur-value
236adbfab89Smlelstv.Pp
237adbfab89SmlelstvTo return values of temperature sensors from multiple devices:
238adbfab89Smlelstv.Pp
239adbfab89Smlelstv.Dl $ envstat -s 'coretemp0:cpu0 temperature,coretemp1:cpu 2 temperature' -x /coretemp0/0/cur-value /coretemp1/0/cur-value
24038cfdfd8Sgroo.Sh SEE ALSO
241a66933c9Sreed.Xr units 1 ,
242af211bb4Sxtraeme.Xr proplib 3 ,
243e76d963bSwiz.Xr acpiacad 4 ,
244ffaf7e29Skochi.Xr acpibat 4 ,
245ffaf7e29Skochi.Xr acpitz 4 ,
246fb8ec4c3Sjkunz.Xr admtemp 4 ,
2471c23afa3Scnst.Xr aibs 4 ,
24868519ac9Scegger.Xr amdtemp 4 ,
2493f2361dcSxtraeme.Xr aps 4 ,
250f88582ecSxtraeme.Xr arcmsr 4 ,
251e2749a8bSxtraeme.Xr battery_pmu 4 ,
252e984f5b1Sxtraeme.Xr cac 4 ,
25357895633Spgoyette.Xr dbcool 4 ,
25438cfdfd8Sgroo.Xr envsys 4 ,
255ba517bc7Sxtraeme.Xr finsio 4 ,
256fa731302Skardel.Xr hythygtemp 4 ,
25721a60be3Sxtraeme.Xr ipmi 4 ,
25827ddba05Sxtraeme.Xr itesio 4 ,
259eb277efeSxtraeme.Xr lm 4 ,
26021a60be3Sxtraeme.Xr lmtemp 4 ,
261664bf298Sxtraeme.Xr mfi 4 ,
26221a60be3Sxtraeme.Xr nsclpcsio 4 ,
26321a60be3Sxtraeme.Xr owtemp 4 ,
264e76d963bSwiz.\".Xr pic16lc 4 ,
265af211bb4Sxtraeme.Xr smsc 4 ,
266e76d963bSwiz.Xr sparc/tctrl 4 ,
267e76d963bSwiz.Xr sparc64/envctrl 4 ,
26842d9037cSxtraeme.Xr thinkpad 4 ,
26921a60be3Sxtraeme.Xr tm121temp 4 ,
270eb277efeSxtraeme.Xr ug 4 ,
2717447ac47Sxtraeme.Xr viaenv 4 ,
272e76d963bSwiz.Xr x86/coretemp 4 ,
2737447ac47Sxtraeme.Xr envsys.conf 5
27438cfdfd8Sgroo.Sh HISTORY
27538cfdfd8Sgroo.Nm
27638cfdfd8Sgrooappeared in
27738cfdfd8Sgroo.Nx 1.5 .
278af211bb4SxtraemeIt was completely rewritten from scratch for
279af211bb4Sxtraeme.Nx 5.0 .
280af211bb4Sxtraeme.Sh AUTHORS
281af211bb4Sxtraeme.An -nosplit
282af211bb4SxtraemeThe
283af211bb4Sxtraeme.Nm
284af211bb4Sxtraemeutility that appeared in
285af211bb4Sxtraeme.Nx 5.0
286af211bb4Sxtraemewas written by
287af211bb4Sxtraeme.An Juan Romero Pardines .
288af211bb4SxtraemeThe previous version was written by
289af211bb4Sxtraeme.An Bill Squier .
290dff359b8Swiz.Sh BUGS
291dff359b8SwizWhen displaying statistics using the
292dff359b8Swiz.Fl T
293dff359b8Swizoption, the average value is an average of the minimum, maximum, and
294dff359b8Swizcurrent sensor values.
295dff359b8SwizIt is not an average of all current values displayed during the session.
296