Steve — here is how to start collecting data from the keyword history.
I present a bunch of examples of how to use gshow.
Will
Gshow’s core use is
gshow -s servicename [keyword patterns]
The keyword patterns can take all sorts of simple and fancy varieties. The asterisk “*” is a wildcard, and “%” is exactly the same (except that you never have to quote percent to protect it from the shell). You can also use “!” to mean “not” as in
% gshow -s kpfmet ! disp%
which means to show all keywords except those beginning with DISP. That covers most common uses.
As a taste of what else you can select with gshow, it has a wide variety of selectors, such as d:1 matches dispatcher 1, and t:enum matches enum keywords, and so on. If patterns are joined with comma, that means the intersection (ie AND) of the patterns, e.g. disp%,t:int selects all keywords beginning DISP and of type int.
So if we look at the dispatcher 1 keywords, we see:
% gshow -s kpfmet d:1 DISP1CLK = 109109 seconds DISP1ERR = 0 DISP1MEM = 20896 kilobytes DISP1MSG = Connected to 192.168.23.126 10001 DISP1STA = Ready DISP1STOP = No DISP1VER = 0.2b PRES = 969.0758 hPa RELH = 50.9901 % RH TEMP = 22.6421 deg C TIME = 2021-08-05T21:53:30.061 timestamp VAISALA_CONN1 = On VAISALA_IP = 192.168.23.126 VAISALA_PORT = 10001 VAISALA_RETVAL = P= 969.0758 hPa T= 22.6421 'C RH= 50.9901 %RH
Clearly this is the Vaisala dispatcher. Also clearly, we don’t care about the values of VAISALA_xxx, and all we really care about are PRES, RELH, TEMP, and maybe TIME. Their current values are:
% gshow -s kpfmet pres relh temp PRES = 968.9228 hPa RELH = 51.5508 % RH TEMP = 22.4441 deg C
You can add -c for “continuous” printing as values are broadcast the service, and -timestamp to have the values prefixed with a timestamp (-timestamp is the default when reading from the keyword history):
% gshow -s kpfmet pres relh temp -c -timestamp 2021-08-05T22:07:27.6791 PRES = 968.9199 hPa 2021-08-05T22:07:27.6981 RELH = 51.5931 % RH 2021-08-05T22:07:27.6982 TEMP = 22.4205 deg C 2021-08-05T22:07:30.0641 PRES = 968.9196 hPa 2021-08-05T22:07:30.0644 TEMP = 22.4144 deg C 2021-08-05T22:07:30.0645 RELH = 51.6001 % RH …
(Note that unlike most Unix commands, gshow’s options don’t have to come first on the command line, so I just tacked on -c and -timestamp at the end of the previous command.)
Now let’s look at those keywords from the last 10 minutes of the keyword history, by adding a -date option, like so:
% gshow -s kpfmet pres relh temp -date "10 min ago" 2021-08-05T21:49:25.0629 PRES = 969.0333 hPa 2021-08-05T21:49:25.0629 TEMP = 22.7053 deg C 2021-08-05T21:49:25.0629 RELH = 50.9477 % RH 2021-08-05T21:49:30.0834 PRES = 969.0426 hPa 2021-08-05T21:49:30.0835 TEMP = 22.6829 deg C 2021-08-05T21:49:30.0840 RELH = 50.9434 % RH …
A single -date argument means to get all data from then until the current time.
Two -date arguments means all data between those dates.
(You can also give a bunch of -date’s, if you want many ranges; see the help info.)
You can also use -window with -date:
% gshow -s kpfmet pres relh temp -date 2021-08-05T16:00 -window 5s ...
This shows 5 seconds of data starting at -date.
More generally, -window is used like so:
% gshow -h -window -window 't1,t2' -window t1 Changes each -date to form a date range as follows: If only t1: each range is -date .. (-date + t1 seconds); If 't1 t2': each range is (-date + t1 sec) .. (-date + t2 sec). e.g. -window '-1,5' means from 1 second before the date to 5 seconds after the date. A suffix of a leading substring of 'weeks', 'days', 'hours', 'minutes', or 'seconds' can be attached to t1 and/or t2, e.g. -window '3min,5h'.
Next, add the -tsv option to get tab-separated values, or -csv to get comma-separated values. And I’ll add the -sharp option, meaning that title rows should be prefixed with “#”, which your Excel program will probably understand means it’s not a data row. Alternatively, you can leave off the -sharp, and when you import the file, tell excel that the first row is a title.
Here’s one minute of data, starting from 10 minutes ago:
% gshow -s kpfmet pres relh temp -date "10 min ago" -csv -window 1m -sharp # Date-Time ,PRES,RELH,TEMP 2021-08-05T22:01:45.0000,968.9634,51.3605,22.5007 2021-08-05T22:01:50.0624,968.9598,51.3596,22.4861 2021-08-05T22:01:55.0629,968.9655,51.3597,22.5006 2021-08-05T22:02:00.0626,968.9608,51.3545,22.5061 2021-08-05T22:02:05.0625,968.9601,51.3611,22.4953 2021-08-05T22:02:10.0623,968.9569,51.3479,22.4981 2021-08-05T22:02:15.0833,968.9616,51.3610,22.5043 2021-08-05T22:02:20.0621,968.9561,51.3721,22.5009 2021-08-05T22:02:25.0633,968.9547,51.3840,22.4984 2021-08-05T22:02:30.0634,968.9528,51.3802,22.4907 2021-08-05T22:02:35.0629,968.9479,51.3904,22.4861 2021-08-05T22:02:40.0629,968.9425,51.3972,22.4924 2021-08-05T22:02:40.0629,968.9425,51.4051,22.4835
For better readability when displaying to a terminal, use -tsv instead of -csv:
% gshow -s kpfmet pres relh temp -date "10 min ago" -tsv -window 1m Date-Time PRES RELH TEMP 2021-08-05T22:04:52.0000 968.9433 51.5070 22.4498 2021-08-05T22:04:55.0622 968.9430 51.5070 22.4498 2021-08-05T22:05:00.0633 968.9372 51.5067 22.4447 2021-08-05T22:05:05.0630 968.9308 51.5167 22.4344 2021-08-05T22:05:10.0632 968.9365 51.5345 22.4427 2021-08-05T22:05:15.0628 968.9337 51.5232 22.4425 2021-08-05T22:05:20.0621 968.9339 51.5323 22.4478 2021-08-05T22:05:25.0832 968.9281 51.5336 22.4410 2021-08-05T22:05:30.0619 968.9300 51.5328 22.4401 2021-08-05T22:05:35.0645 968.9253 51.5328 22.4407 2021-08-05T22:05:40.0633 968.9228 51.5443 22.4310 2021-08-05T22:05:45.0630 968.9211 51.5508 22.4441 2021-08-05T22:05:50.0629 968.9241 51.5561 22.4498 2021-08-05T22:05:50.0632 968.9241 51.5501 22.4405
Here is a bit more info about getting help on keywords.
Use -l to see the “long name” in the output:
% gshow -s kpfmet pres relh temp -l Pressure in hPa .. PRES = 969.8840 hPa RH as a percentage RELH = 52.8438 % RH Temperature in C . TEMP = 23.8251 deg C
Use -attr to see attributes instead of live values:
% gshow -s kpfmet pres relh temp -attr PRES Pressure in hPa c- double hPa {%.4f} RELH RH as a percentage c- double % RH {%.4f} TEMP Temperature in C c- double deg C {%.4f}
Use -hto (Help Text Only) to get a quick view of the help text, with the longer list of attributes left out:
% gshow -s kpfmet pres relh temp -hto PRES Briefhelp: Pressure in hPa Fullhelp: Pressure value in hPa RELH Briefhelp: RH as a percentage Fullhelp: Relative humidity as a percentage TEMP Briefhelp: Temperature in C Fullhelp: Temperature value in C
Use -l and -hto together to see the “long name” plus “brief help”. (If the keyword configuration data doesn’t provide briefhelp, gshow constructs brief help from the long name, and vice versa, which explains the values below.)
% gshow -s kpfmet pres relh temp -l -hto PRES Longname: Pressure-in-hPa Briefhelp: Pressure in hPa Fullhelp: Pressure value in hPa RELH Longname: RH-as-a-percentage Briefhelp: RH as a percentage Fullhelp: Relative humidity as a percentage TEMP Longname: Temperature-in-C Briefhelp: Temperature in C Fullhelp: Temperature value in C
Use -fullhelp to see everything about a keyword; here I choose just PRES:
% gshow -s kpfmet pres -fullhelp PRES Brief help text: Pressure in hPa Read/Write: c- => read=y,notify=y ; broadcast=y ; write=n,notify=n Type: double Units: hPa Format: %.4f Long help: Pressure value in hPa
0 Comments