1.\" $NetBSD: envstat.8,v 1.66 2020/11/14 20:07:13 wiz Exp $ 2.\" 3.\" Copyright (c) 2000, 2007, 2008, 2009, 2014 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Juan Romero Pardines and Bill Squier. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28.\" POSSIBILITY OF SUCH DAMAGE. 29.\" 30.Dd November 14, 2020 31.Dt ENVSTAT 8 32.Os 33.Sh NAME 34.Nm envstat 35.Nd utility to handle environmental sensors 36.Sh SYNOPSIS 37.Nm 38.Op Fl DfIklnSTW 39.Op Fl c Ar file 40.Op Fl d Ar device 41.Op Fl i Ar interval 42.Op Fl s Ar "device:sensor,..." 43.Op Fl w Ar width 44.Nm 45.Fl x 46.Op Fl d Ar device 47.Op Fl s Ar "device:sensor,..." 48.Op Ar property... 49.Sh DESCRIPTION 50.Nm 51is a utility that handles various aspects of the sensors 52registered with the 53.Xr envsys 4 54framework. 55It is capable of displaying sensor values as well as 56changing parameters and setting critical limits for the sensors. 57.Pp 58In display mode, column widths as well as displayed sensors 59are fully customizable. 60Critical limits or other properties can be set via the configuration file. 61If critical limits were set previously, the display mode will show 62the critical limits in addition to the current values. 63.Pp 64The following options are available: 65.Bl -tag -width flag 66.It Fl c 67Accepts a file as argument to set properties for sensors in 68devices registered with the framework. 69See the 70.Xr envsys.conf 5 71manual page for more information. 72.It Fl D 73Display the names of the devices that are currently registered with 74the 75.Xr envsys 4 76framework, one per line, along with some properties for the device 77(for example, its refresh timeout value). 78.It Fl d Ar device 79Display only the sensors for the given 80.Ar device . 81This is useful when there are multiple devices registered and 82you want to only see results from a specific device. 83.It Fl f 84Display temperature values in degrees Fahrenheit. 85The default is to display temperature values in degrees Celsius. 86.It Fl I 87This flag skips the sensors with invalid state; these are normally 88shown using the 89.Qq N/A 90string by default. 91.It Fl i Ar interval 92Repeat the display every 93.Ar interval 94seconds. 95Note that some devices do not provide fresh values on demand. 96See the individual device's manual page for meaningful values for 97.Ar interval . 98If not specified, or specified as 0, 99.Nm 100produces one round of values and exits. 101.It Fl k 102Display temperature values in Kelvin. 103The default is to display temperature values in degrees Celsius. 104.It Fl l 105List the names of all supported sensors, one per line. 106Use of this flag causes 107.Nm 108to ignore all other option flags. 109.It Fl n 110Print only the current value of a sensor and no headers. 111If statistics are selected with 112.Fl T 113then also display max, min and average. 114.It Fl r 115This flag is provided for compatibility reasons and there's no need 116to use it. 117In the previous implementation, it was used to enable the 118row mode; this mode is now the default. 119.It Fl S 120This flag is used to restore defaults to all devices registered with 121the framework. 122This will remove all properties that were set in 123the configuration file to the setting that the devices use by 124default. 125.It Fl s Ar "device:sensor,..." 126Restrict the display to the named devices and sensors. 127The pair device and sensor description must be supplied as a comma separated list. 128Device as well as sensor descriptions are case sensitive. 129Note that the order of the arguments given does not influence the order of output. 130.It Fl T 131Create and display max, min and average statistics for a sensor. 132Must be used with an 133.Ar interval , 134otherwise statistics cannot be collected up. 135Please note that to get realistic 136values a lower interval value should be used, but that will also increase 137overhead. 138.It Fl w Ar width 139Use 140.Ar width 141as the column width for the output. 142Each column is additionally separated by a single space. 143The default is the length of the longest sensor name. 144.It Fl W 145This option has no effect. 146It is retained for historical reasons. 147.It Fl x 148Shows the raw XML property list used by the 149.Xr sysmon_envsys 9 150framework that contains details about all registered devices 151and sensors. 152If 153.Ar property 154is specified, the value of that property is printed. 155The property list can be filtered with the 156.Fl d 157or 158.Fl s 159options. 160If 161.Fl s 162is used with only a single sensor, only the properties 163of this sensor are returned, not a list of sensors. 164.El 165.Sh UNITS 166The display mode may show some values with abbreviated units; 167for example: 168.Bl -tag -width "12345678" -compact -offset indent 169.It A 170Amperes 171.It Ah 172Ampere-hours 173.It degC 174degrees Celsius 175.It degF 176degrees Fahrenheit 177.It K 178Kelvin 179.It Ohms 180Ohms 181.It RPM 182Revolutions per minute 183.It V 184Volts DC 185.It VAC 186Volts AC 187.It W 188Watts 189.It Wh 190Watt-hours 191.It %rH 192relative Humidity 193.El 194.Sh EXAMPLES 195To display the 196.Dq charge 197sensor of the device 198.Ar acpibat0 199in one line every ten seconds: 200.Pp 201.Dl $ envstat -s \*qacpibat0:charge\*q -i 10 202.Pp 203To list the devices that are currently registered with 204.Xr envsys 4 : 205.Pp 206.Dl $ envstat -D 207.Pp 208To display the sensors of the device 209.Ar aibs0 : 210.Pp 211.Dl $ envstat -d aibs0 212.Pp 213To set all properties specified in the configuration file: 214.Pp 215.Dl $ envstat -c /etc/envsys.conf 216.Pp 217To remove all properties that were set previously in the configuration 218file: 219.Pp 220.Dl $ envstat -S 221.Pp 222To display statistics for all sensors and ignoring sensors with 223invalid states every second: 224.Pp 225.Dl $ envstat -ITi1 226.Pp 227To return a single temperature value: 228.Pp 229.Dl $ envstat -s vcmbox0:temperature -x /cur-value 230.Pp 231To return values of multiple temperature sensors from a single device 232.Pp 233.Dl $ envstat -s 'thinkpad0:temperature 0,thinkpad0:temperature 1' -x /thinkpad0/0/cur-value /thinkpad0/1/cur-value 234.Pp 235To return values of temperature sensors from multiple devices: 236.Pp 237.Dl $ envstat -s 'coretemp0:cpu0 temperature,coretemp1:cpu 2 temperature' -x /coretemp0/0/cur-value /coretemp1/0/cur-value 238.Sh SEE ALSO 239.Xr units 1 , 240.Xr proplib 3 , 241.Xr acpiacad 4 , 242.Xr acpibat 4 , 243.Xr acpitz 4 , 244.Xr admtemp 4 , 245.Xr aibs 4 , 246.Xr amdtemp 4 , 247.Xr aps 4 , 248.Xr arcmsr 4 , 249.Xr battery_pmu 4 , 250.Xr cac 4 , 251.Xr dbcool 4 , 252.Xr envsys 4 , 253.Xr finsio 4 , 254.Xr hythygtemp 4 , 255.Xr ipmi 4 , 256.Xr itesio 4 , 257.Xr lm 4 , 258.Xr lmtemp 4 , 259.Xr mfi 4 , 260.Xr nsclpcsio 4 , 261.Xr owtemp 4 , 262.\".Xr pic16lc 4 , 263.Xr smsc 4 , 264.Xr sparc/tctrl 4 , 265.Xr sparc64/envctrl 4 , 266.Xr thinkpad 4 , 267.Xr tm121temp 4 , 268.Xr ug 4 , 269.Xr viaenv 4 , 270.Xr x86/coretemp 4 , 271.Xr envsys.conf 5 272.Sh HISTORY 273.Nm 274appeared in 275.Nx 1.5 . 276It was completely rewritten from scratch for 277.Nx 5.0 . 278.Sh AUTHORS 279.An -nosplit 280The 281.Nm 282utility that appeared in 283.Nx 5.0 284was written by 285.An Juan Romero Pardines . 286The previous version was written by 287.An Bill Squier . 288.Sh BUGS 289When displaying statistics using the 290.Fl T 291option, the average value is an average of the minimum, maximum, and 292current sensor values. 293It is not an average of all current values displayed during the session. 294