\" $NetBSD: envstat.8,v 1.72 2025/04/01 17:07:58 uwe 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 DfIjklnSTtW
Op Fl c Ar file
Op Fl d Ar device
Op Fl i Ar interval
Op Fl s Ar device Ns Cm \&: Ns Ar sensor Ns Cm \&, Ns Ar ...
Op Fl w Ar width
Nm
Fl x
Op Fl d Ar device
Op Fl s Ar device Ns Cm \&: Ns Ar sensor Ns Cm \&, Ns Ar ...
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 Fl
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
Pq 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
Ql 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.
When the
Fl j
flag is used to get JSON output the string
Ql #-------
is placed between each JSON block.
It Fl j
Output the results in JSON format.
Each output will be a correct JSON object that consists of objects,
arrays, integers, floats and strings included, as needed, for any particular
sensor.
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 Ns Cm \&: Ns Ar sensor Ns Cm \&, Ns Ar ...
Restrict the display to the named devices and sensors.
The pair
Ar device
and
Ar 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
Fl i ,
otherwise statistics cannot be collected up.
Please note that to get realistic
values a lower
Ar interval
value should be used, but that will also increase overhead.
It Fl t
Output a time stamp along with the rest of the sensor data.
When the
Fl j
flag is not specified, the time stamp will be on the first line and
be in human readable format.
When the output is JSON, two objects will be included that contain the
Julian Unix time and another with the time stamp in human readable format.
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 -column -offset indent "degC" "..."
It Li A Ta Amperes
It Li Ah Ta Ampere-hours
It Li degC Ta degrees Celsius
It Li degF Ta degrees Fahrenheit
It Li K Ta Kelvin
It Li Ohms Ta Ohms
It Li RPM Ta Revolutions per minute
It Li V Ta Volts DC
It Li VAC Ta Volts AC
It Li W Ta Watts
It Li Wh Ta Watt-hours
It Li %rH Ta relative Humidity
It Li hPa Ta Hectopascals
El
Sh EXAMPLES
To list the devices that are currently registered with
Xr envsys 4 :
Pp
Dl envstat -D
Pp
To display the sensors of the device
Ql aibs0 :
Pp
Dl envstat -d aibs0
Pp
To display the
Ql charge
sensor of the device
Ql acpibat0
in one line every ten seconds:
Pp
Dl envstat -s acpibat0:charge -i 10
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
Bd -literal -offset indent
envstat -s \(aqthinkpad0:temperature 0,thinkpad0:temperature 1\(aq \e
-x /thinkpad0/0/cur-value /thinkpad0/1/cur-value
Ed
Pp
To return values of temperature sensors from multiple devices:
Pp
Bd -literal -offset indent
envstat -s \(aqcoretemp0:cpu0 temperature,coretemp1:cpu 2 temperature\(aq \e
-x /coretemp0/0/cur-value /coretemp1/0/cur-value
Ed
Pp
To output the sensor data in JSON with a timestamp:
Pp
Dl envstat -d owtemp0 -jt
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.