Remstats Home


  About remstats
  architecture
  Release Notes
  FAQ
  Conventions
  Prerequisites
  Installation
  Configuration
  Configuration Tools
  Servers
  Collectors
  Updater
  Monitors
  pagemakers
  run-remstats2
  CGIs
      alert.cgi
      availability.cgi
      dataimage.cgi
      datapage.cgi
      graph.cgi
      log-event.cgi
      macinfo.cgi
      ping.cgi
      show-config.cgi
      showlog.cgi
      traceroute.cgi
      whois.cgi
  troubleshooting
  do-traceroutes
  Miscellany
  Thank-you
  Index


  Live Data

  Remstats was written by
  Thomas Erskine at the
  CRC in Canada and now
  at SourceWorks.

[Top] [Prev] [Next]

dataimage.cgi - create images driven by live data

Usage:

	<IMG SRC="/remstats/dataimage.cgi?imagename">

Description:

Dataimage.cgi reads an image definition from /var/lib/remstats/datapage/imagename.image. Some of the commands are in common with datapage.cgi and are documented there:

	oid, rrd, status, eval, debug, macro, macroend and *EOD*

These retrieve and manipulate data. There are also commands to create images:

	image, colordef, color, linewidth, line, rectangle, circle, 
	fill, font, text, out, flow

Image Commands

image

The image command has two formats. The first looks like:

	image WIDTH HEIGHT

This creates a blank image of the size specified. Sometimes you'll want a background for the image, and you can use the second form to specify a file to read for the background:

	image BGFILE

This will create the new image the same size as the one in BGFILE, by reading BGFILE and using its contents as the background. N.B., the image must be a PNG graphic.

The image command also defines a few colors (see colordef below): black, white and transparent, sets the current color to black, fills the image with white and sets the linewidth to 1.

colordef

[It can also be spelled colourdef.]

This defines a new colour and names it. The command looks like:

	colordef COLORNAME RED GREEN BLUE

where RED, GREEN and BLUE specify the level of each of those colours to be mixed to define the colour referred to in the script as COLORNAME.

color

[It can also be spelled colour.]

This sets the current colour, to be used by those commands that don't specify a colour. It is used as simply:

	color COLORNAME

linewidth

This sets the width of lines. It isn't honoured by all other commands, unfortunately, but so far this hasn't been a problem for me. It looks like:

	linewidth WIDTH

line

This just draws a line in the current color and linewidth:

	line X1 Y1 X2 Y2

rectangle

This is a way to draw a rectangle, without useing line 4 times:

	rectangle X1 Y1 X2 Y2 [filled]

The co-ordinates (X1, Y1) and (X2, Y2) define oposite corners of the rectangle. If the keyword filled is added to the end, the rectangle will be filled with the current colour as well.

circle

Here you get a circle:

	circle X Y RADIUS [filled]

The circle will be centered on (X, Y) with a radius of RADIUS. If the keyword filled is added to the end, the circle will be filled with the current colour as well.

fill

This command permits you to fill arbitrary regions:

	fill X Y [COLORNAME]

The COLORNAME is optional.

text

The text command sets text into the image, for labelling things:

	text X Y TEXT

font

This changes the font for the text command:

	font (giant|large|mediumbold|medium|small|tiny)

out

This permits the script to output additional information to an auxiliary file. I added this for doing image-maps automatically, which can be automatically loaded by a datapage.cgi web-page.

The syntax is:

	out TEXT

flow

This draws a strange double-headed, bi-coloured arrow. Think of it as two half arrows, split lengthwise, one in each direction. The colour and width of each half arrow indicates the flow in that direction. I use it for indicating network traffic flow, which usually isn't the same in both directions. It looks like:

	flow X1 Y1 X2 Y2 INFLOW OUTFLOW

The co-ordinates (X1, Y1), (X2, Y2) indicate the ends of the flow. INFLOW and OUTFLOW indicate the level in each direction, relative to (X1, Y1).


[
Top] [Remstats] [SourceWorks] [RRDtool] [SourceForge]
Last updated mardi 21 novembre 2006, 18:54:29 (UTC+0100) by <terskine@users.sourceforge.net>.