Src-perl-querylogger

From IARC 207 Wiki
Revision as of 09:40, 6 May 2008 by 137.229.92.253 (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

querylogger.pl

This perl script was written to exercise and test the Campbell::Comm module, but may be useful in its own right as a way to interface with dataloggers in batch (i.e., non-interactive) form. Each method in the Campbell::Comm module should be represented by a querylogger command as specified on the command line.

The interface is described if run with no arguments:

   $ querylogger
   syntax: "$ /home/ken/bin/querylogger OPTIONS SITE COMMAND ...
   where OPTIONS are
       --quiet      suppress output to STDOUT
       -q           same as above
       --logfile=f  print everything to file f 
       -l f         same as above
       --comm=s     use rc file section Campbell::Comm-s, or
       -c s         use rc file section Campbell::Comm-s
       --identify   identify site in output (default)
       --noidentify don't identify site in output
   where SITE is one of: site, slope_mtn,
   and COMMANDs may include:
       status       list status strings
       time         show time (setting not yet supported)
       backup=n     n=number of output arrays to spew (no limit)
       MPTR=loc     loc=output storage location (no limit)
       data=n       n=number of data records to get
       binary=n     n=number of data locations to get
       program      print all logger programming
       flags=n        optionally toggle specified flag(s), show flags, n=flag number
       ports        show ports (toggle not yet supported)
       memory       show mode A memory settings 
       signatures   show mode B signature settings
       input=n[,m][,r-s]  show input storage locations
       capture=[f]  end previous capture, capture output to file f
       get_time_flags experimental using F command

The querylogger (and loggerdata) scripts assume a specific system configuration of sites and rc files; see below...

This program started as a quick hack, and takes some shortcuts. It really ought to provide -h and/or --help options to show the above information, but it doesn't.

The program is "tied to" the particular/peculiar site architecture we've chosen to use; but that's just how we use it, so perhaps it's not so bad.

The program uses a different scheme for identifying sites: it just uses the site name, trying to match against the full list of sites it builds by walking the site root tree looking for .siterc files. This could maybe be simplified, just by NOT DOING THAT. But it's what it is.

Our main use of this utility is for quick operations such as setting or clearing flags, or looking at the site timestamp.

 A quick example:
 bob@shand:/home/site/atlas$ querylogger anvil flags=1