Source-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: src/usr.sbin/envstat
Module Name: src
Committed By: brad
Date: Tue Apr 1 11:39:19 UTC 2025
Modified Files:
src/usr.sbin/envstat: Makefile envstat.8 envstat.c
Log Message:
New features for envstat(8).
o The usual output of envstat(8) is meant for human consumption and it
is harder than it needs to be to extract the data and process it with
or for other systems or programs. There is a '-x' flag to output the
raw XML from the envsys(4) framework, but that doesn't run the data
though the conversions that envstat(8) does in the human output case.
So, provide a '-j' flag that outputs in JSON. Each execution of
envstat(8) will produce consistent JSON that can be piped directly
into the 'jq' command, for example. When used with the interval flag,
'-i', each interval will be consistent JSON with a separator string to
make it easier to split the input.
(as an aside, there is a '-n' option too, that just extracts the
current value from each sensor, but that is a little too terse for the
cases where a device provides multiple sensors or if you ask for
multiple devices, as you lose the ability to know what each value is
associated with)
o Provide a '-t' flag that will time stamp the output with the time
that the extraction was executed. This is only provided for the human
output, or JSON output. In the human output case, the first line is a
human readable date and time. In the JSON case, an object is included
in the output that contains the human readable date and time, and
another object that contains the Unix epoch version of the same. This
makes it possible to extract the data and have the data tell you when
it was executed.
I have been using this for a little while and it seems to work quite
well when one needs to pull a lot of sensors from the envsys(4)
framework at one time. It has ended up being much faster and less
error prone in a lot of cases then parsing the human output of
envstat(8) with regexs.
To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/envstat/Makefile
cvs rdiff -u -r1.67 -r1.68 src/usr.sbin/envstat/envstat.8
cvs rdiff -u -r1.104 -r1.105 src/usr.sbin/envstat/envstat.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Home |
Main Index |
Thread Index |
Old Index