ENVSTAT(8)

NAME
envstat - utility to handle environmental sensors

SYNOPSIS
envstat [-DfIjklnSTtW] [-c file] [-d device] [-i interval] [-s device:sensor,...] [-w width]
envstat -x [-d device] [-s device:sensor,...] [property ...]

DESCRIPTION
envstat is a utility that handles various aspects of the sensors registered with the envsys(4) framework. It is capable of displaying sensor values as well as changing parameters and setting critical limits for the sensors.

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.

The following options are available:

-c  Accepts a file as argument to set properties for sensors in devices registered with the framework. See the envsys.conf(5) manual page for more information.

-D  Display the names of the devices that are currently registered with the envsys(4) framework, one per line, along with some properties for the device (for example, its refresh timeout value).

-d device
    Display only the sensors for the given device. This is useful when there are multiple devices registered and you want to only see results from a specific device.

-f  Display temperature values in degrees Fahrenheit. The default is to display temperature values in degrees Celsius.

-I  This flag skips the sensors with invalid state; these are normally shown using the ‘N/A’ string by default.

-i interval
    Repeat the display every interval seconds. Note that some devices do not provide fresh values on demand. See the individual device's manual page for meaningful values for interval. If not specified, or specified as 0, envstat produces one round of values and exits. When the -j flag is used to get JSON output the string ‘#-------’ is placed between each JSON block.

-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.

-k  Display temperature values in Kelvin. The default is to display temperature values in degrees Celsius.

-l  List the names of all supported sensors, one per line. Use of this flag causes envstat to ignore all other option flags.

-n  Print only the current value of a sensor and no headers. If statistics are selected with -T then also display max, min and average.

-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.

-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.

-s 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.

-T  Create and display max, min and average statistics for a sensor. Must be used with an -i, 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.

-t  Output a time stamp along with the rest of the sensor data. When the -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.

-w width
    Use 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.

-W  This option has no effect. It is retained for historical reasons.

-x  Shows the raw XML property list used by the sysmon_envsys(9) framework that contains details about all registered devices and sensors. If property is specified, the value of that property is printed. The property list can be filtered with the -d or -s options. If -s is used with only a single sensor, only the properties of this sensor are returned, not a list of sensors.

UNITS
The display mode may show some values with abbreviated units; for example:
A | Amperes
Ah | Ampere-hours
degC | degrees Celsius
degF | degrees Fahrenheit
K | Kelvin
Ohms | Ohms
RPM | Revolutions per minute
V | Volts DC
VAC | Volts AC
W | Watts
Wh | Watt-hours
%rH | relative Humidity
hPa | Hectopascals

EXAMPLES
To list the devices that are currently registered with envsys(4):

    envstat -D

To display the sensors of the device ‘aibs0’:

    envstat -d aibs0

To display the ‘charge’ sensor of the device ‘acpibat0’ in one line every ten seconds:

    envstat -s acpibat0:charge -i 10

To set all properties specified in the configuration file:

    envstat -c /etc/envsys.conf

To remove all properties that were set previously in the configuration file:

    envstat -S

To display statistics for all sensors and ignoring sensors with invalid states every second:

    envstat -ITi1

To return a single temperature value:

    envstat -s vcmbox0:temperature -x /cur-value

To return values of multiple temperature sensors from a single device

    envstat -s 'thinkpad0:temperature 0,thinkpad0:temperature 1' \
      -x /thinkpad0/0/cur-value /thinkpad0/1/cur-value

To return values of temperature sensors from multiple devices:

    envstat -s 'coretemp0:cpu0 temperature,coretemp1:cpu 2 temperature' \
      -x /coretemp0/0/cur-value /coretemp1/0/cur-value

To output the sensor data in JSON with a timestamp:

    envstat -d owtemp0 -jt

SEE ALSO
units(1), proplib(3), acpiacad(4), acpibat(4), acpitz(4), admtemp(4), aibs(4), amdtemp(4), aps(4), arcmsr(4), battery_pmu(4), cac(4), dbcool(4), envsys(4), finsio(4), hythygtemp(4), ipmi(4), itesio(4), lm(4), lmtemp(4), mfi(4), nsclpcsio(4), owtemp(4), smsc(4), sparc/tctrl(4), sparc64/envctrl(4), thinkpad(4), tm121temp(4), ug(4), viaenv(4), x86/coretemp(4), envsys.conf(5)

HISTORY
envstat appeared in NetBSD 1.5. It was completely rewritten from scratch for NetBSD 5.0.

AUTHORS
-nosplit The envstat utility that appeared in NetBSD 5.0 was written by Juan Romero Pardines. The previous version was written by Bill Squier.

BUGS
When displaying statistics using the -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.