# Support routines implementation

The main Perl code shares some common back-end routines. The code in the source tree is in more than one directory.

## Code in `common/`

Some of the files in this directory are:

read-hr-log.pl
  This script implements reading of a raw data file, extracting the data values and distributing the measurements over the hours of the day.
read-raw-log.pl
  This script is similar to the one above, but it simply records the individual samples instead of collating the measurements into their respective hours. Both these routines are called `read_log`, and return data in global variables.
date.pl
  This is a set of functions to handle time values and their different representations. In hindsight this could probably have been designed better; there are a number of "ad-hoc" functions in this file.
search.pl
  This finds data and reports, some functions possibly create the required directories.
plot.pl
  This file implements some basic support functions to create plot files for gnuplot; one of them computes X tick marks to be set for a given plot.

## Code in `db/`

Some of the files in this directory are:

db-lookup.pl
  This set of functions implements the feature where a logical port can move from one router to another over time. Given a date the routines can translate from logical port name to a "physical" name (base name of the raw data file) and vice versa.
update-dbs.pl
  This script updates the database of mappings between logical port names and the base name of the raw data files, and should be run periodically (once per day). This script uses the snmpnetstat TCL/scotty script to collect the data. This script could probably be made more robust to operator errors such as inserting spaces in the wrong places etc.

It is possible to "hand edit" the database by using the `dbm-edit` script, but note that the reports generated in the affected period need to be regenerated afterwards.

Last modified: Thu Jun 26 12:11:57 MET DST 1997