NetBSD/usr.sbin/envstat/envstat.8

296 lines
8.0 KiB
Groff

.\" $NetBSD: envstat.8,v 1.67 2022/11/21 21:24:02 brad Exp $
.\"
.\" Copyright (c) 2000, 2007, 2008, 2009, 2014 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Juan Romero Pardines and Bill Squier.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd November 14, 2020
.Dt ENVSTAT 8
.Os
.Sh NAME
.Nm envstat
.Nd utility to handle environmental sensors
.Sh SYNOPSIS
.Nm
.Op Fl DfIklnSTW
.Op Fl c Ar file
.Op Fl d Ar device
.Op Fl i Ar interval
.Op Fl s Ar "device:sensor,..."
.Op Fl w Ar width
.Nm
.Fl x
.Op Fl d Ar device
.Op Fl s Ar "device:sensor,..."
.Op Ar property...
.Sh DESCRIPTION
.Nm
is a utility that handles various aspects of the sensors
registered with the
.Xr envsys 4
framework.
It is capable of displaying sensor values as well as
changing parameters and setting critical limits for the sensors.
.Pp
In display mode, column widths as well as displayed sensors
are fully customizable.
Critical limits or other properties can be set via the configuration file.
If critical limits were set previously, the display mode will show
the critical limits in addition to the current values.
.Pp
The following options are available:
.Bl -tag -width flag
.It Fl c
Accepts a file as argument to set properties for sensors in
devices registered with the framework.
See the
.Xr envsys.conf 5
manual page for more information.
.It Fl D
Display the names of the devices that are currently registered with
the
.Xr envsys 4
framework, one per line, along with some properties for the device
(for example, its refresh timeout value).
.It Fl d Ar device
Display only the sensors for the given
.Ar device .
This is useful when there are multiple devices registered and
you want to only see results from a specific device.
.It Fl f
Display temperature values in degrees Fahrenheit.
The default is to display temperature values in degrees Celsius.
.It Fl I
This flag skips the sensors with invalid state; these are normally
shown using the
.Qq N/A
string by default.
.It Fl i Ar interval
Repeat the display every
.Ar interval
seconds.
Note that some devices do not provide fresh values on demand.
See the individual device's manual page for meaningful values for
.Ar interval .
If not specified, or specified as 0,
.Nm
produces one round of values and exits.
.It Fl k
Display temperature values in Kelvin.
The default is to display temperature values in degrees Celsius.
.It Fl l
List the names of all supported sensors, one per line.
Use of this flag causes
.Nm
to ignore all other option flags.
.It Fl n
Print only the current value of a sensor and no headers.
If statistics are selected with
.Fl T
then also display max, min and average.
.It Fl r
This flag is provided for compatibility reasons and there's no need
to use it.
In the previous implementation, it was used to enable the
row mode; this mode is now the default.
.It Fl S
This flag is used to restore defaults to all devices registered with
the framework.
This will remove all properties that were set in
the configuration file to the setting that the devices use by
default.
.It Fl s Ar "device:sensor,..."
Restrict the display to the named devices and sensors.
The pair device and sensor description must be supplied as a comma separated list.
Device as well as sensor descriptions are case sensitive.
Note that the order of the arguments given does not influence the order of output.
.It Fl T
Create and display max, min and average statistics for a sensor.
Must be used with an
.Ar interval ,
otherwise statistics cannot be collected up.
Please note that to get realistic
values a lower interval value should be used, but that will also increase
overhead.
.It Fl w Ar width
Use
.Ar width
as the column width for the output.
Each column is additionally separated by a single space.
The default is the length of the longest sensor name.
.It Fl W
This option has no effect.
It is retained for historical reasons.
.It Fl x
Shows the raw XML property list used by the
.Xr sysmon_envsys 9
framework that contains details about all registered devices
and sensors.
If
.Ar property
is specified, the value of that property is printed.
The property list can be filtered with the
.Fl d
or
.Fl s
options.
If
.Fl s
is used with only a single sensor, only the properties
of this sensor are returned, not a list of sensors.
.El
.Sh UNITS
The display mode may show some values with abbreviated units;
for example:
.Bl -tag -width "12345678" -compact -offset indent
.It A
Amperes
.It Ah
Ampere-hours
.It degC
degrees Celsius
.It degF
degrees Fahrenheit
.It K
Kelvin
.It Ohms
Ohms
.It RPM
Revolutions per minute
.It V
Volts DC
.It VAC
Volts AC
.It W
Watts
.It Wh
Watt-hours
.It %rH
relative Humidity
.It hPa
Hectopascals
.El
.Sh EXAMPLES
To display the
.Dq charge
sensor of the device
.Ar acpibat0
in one line every ten seconds:
.Pp
.Dl $ envstat -s \*qacpibat0:charge\*q -i 10
.Pp
To list the devices that are currently registered with
.Xr envsys 4 :
.Pp
.Dl $ envstat -D
.Pp
To display the sensors of the device
.Ar aibs0 :
.Pp
.Dl $ envstat -d aibs0
.Pp
To set all properties specified in the configuration file:
.Pp
.Dl $ envstat -c /etc/envsys.conf
.Pp
To remove all properties that were set previously in the configuration
file:
.Pp
.Dl $ envstat -S
.Pp
To display statistics for all sensors and ignoring sensors with
invalid states every second:
.Pp
.Dl $ envstat -ITi1
.Pp
To return a single temperature value:
.Pp
.Dl $ envstat -s vcmbox0:temperature -x /cur-value
.Pp
To return values of multiple temperature sensors from a single device
.Pp
.Dl $ envstat -s 'thinkpad0:temperature 0,thinkpad0:temperature 1' -x /thinkpad0/0/cur-value /thinkpad0/1/cur-value
.Pp
To return values of temperature sensors from multiple devices:
.Pp
.Dl $ envstat -s 'coretemp0:cpu0 temperature,coretemp1:cpu 2 temperature' -x /coretemp0/0/cur-value /coretemp1/0/cur-value
.Sh SEE ALSO
.Xr units 1 ,
.Xr proplib 3 ,
.Xr acpiacad 4 ,
.Xr acpibat 4 ,
.Xr acpitz 4 ,
.Xr admtemp 4 ,
.Xr aibs 4 ,
.Xr amdtemp 4 ,
.Xr aps 4 ,
.Xr arcmsr 4 ,
.Xr battery_pmu 4 ,
.Xr cac 4 ,
.Xr dbcool 4 ,
.Xr envsys 4 ,
.Xr finsio 4 ,
.Xr hythygtemp 4 ,
.Xr ipmi 4 ,
.Xr itesio 4 ,
.Xr lm 4 ,
.Xr lmtemp 4 ,
.Xr mfi 4 ,
.Xr nsclpcsio 4 ,
.Xr owtemp 4 ,
.\".Xr pic16lc 4 ,
.Xr smsc 4 ,
.Xr sparc/tctrl 4 ,
.Xr sparc64/envctrl 4 ,
.Xr thinkpad 4 ,
.Xr tm121temp 4 ,
.Xr ug 4 ,
.Xr viaenv 4 ,
.Xr x86/coretemp 4 ,
.Xr envsys.conf 5
.Sh HISTORY
.Nm
appeared in
.Nx 1.5 .
It was completely rewritten from scratch for
.Nx 5.0 .
.Sh AUTHORS
.An -nosplit
The
.Nm
utility that appeared in
.Nx 5.0
was written by
.An Juan Romero Pardines .
The previous version was written by
.An Bill Squier .
.Sh BUGS
When displaying statistics using the
.Fl T
option, the average value is an average of the minimum, maximum, and
current sensor values.
It is not an average of all current values displayed during the session.