Plot scripts implementation notes
The collection of plot scripts are divided into two major parts:
- Four separate "backend" scripts producing plots of varying
resolution (samples, hour, day, week), producing a PNG file on
standard output.
- A common front-end plot script which takes care of the HTML and
HTTP handling (a CGI-BIN script).
These are documented separately below.
Backend scripts
These live in the plot/
directory.
These scripts take a number of command line arguments and produces a
plot file of a given format on standard output. The scripts all take
the same arguments, and they are:
- -d datespec
- Specifies the start time and period to plot data
for. Defaulted to "yesterday".
- -n name
- Specifies the logical port name to plot data for.
Mandatory.
- -m max-scale
- Set max value on Y scale. The default is to
autoscale, which is the recommended method.
- -f format
- Set the output file format. May be one of
postscript
(the default)
png
x11
(not very useful as it'll only be shown
30 seconds)
ppm
fig
The WWW scripts only uses the png
parameter.
- -t type-of-plot
- Set the data type to be plotted. May be one
of:
- traffic
- The traffic load (in percentage of
the capacity, the default)
- traffic-kbit
- The traffic load in kbit/s.
- discards
- Output discards and input ignores (the latter
from the cisco enterprise-specific interface mib
extensions)
- errors
- Input errors of various forms (more specific
information available on cisco routers)
- resets
- The number of interface resets
- eerrs
- Ethernet-specific input errors (only makes sense
for ethernet interfaces)
- -r
- Regenerate plots unconditionally (don't use plot file
cache)
All the backend scripts maintain a cache of plot command and data
files for gnuplot. In hindsight I'm not certain the gain of having
such a cache is worth the trouble of maintaining it.
The majority of the code in these files is relatively regular; one set
of functions for creating the data file for the plot (the
plot_*
functions, one other set to "decorate" the plots,
i.e. add legends, labels, and create the control file for gnuplot (the
decorate_*
functions.
The front-end script
This is cgi/plot-all.pl
.
This script creates the HTML (and HTTP) data stream, and uses the
output of the backend plot scripts above to create the plot proper.
The majority of the code is responsible for creating the client-side
image map which is overlayed on the plot to make it possible to zoom
in or out, or go to the next or previous plot.
An attempt has been made to drive parts of the content from tabular
data (which data types to zoom to etc.).
he@nordu.net
Last modified: Mon Jun 16 12:17:08 MET DST 1997