# RDLOG2 tool for MRTG

## Introduction

Rdlog is a small (and primitive) tool that gives indication on network traffic on a graphic map. It takes information from MRTG log files, and draw a GIF file with links that have colors based on the current traffic on your network. This small test explain how to use this tool :

- history list
- how to build a RDLOG2 draw file
- how to compile RDLOG2
- RDLOG2 command-line arguments
- your remarks

## History list

v 1.1, 5.5.97 :

- from a proposition of Christophe.Denervaud@swisstelecom.com, add depth possibilies,
- add 'in' and 'out' difference,
- use the gifarea background color

v1.0, feb. 1997: initial revision, port from rdlog

## RDLOG2 configuration file

To build a gif, RDLOG2 needs a configuration file, that you must build with XGIF (ftp.x.org, in /contrib/applications/drawing_tools/xfig), a 'X draw' program (tested with version 3.1). You can look at the example (wan.fig) in order to understand how works RDLOG2. When you draw with XFIG, you must observe some rules :

#### General Rules

You can draw : text, polylines, rectangles. Don't try to make rounded corners, arrows, splines, play with line style and width ... All your draw must be 'flat', except for special object. Don't group/ungroup all your objects. The order of object drawing is defined with the xfig 'DEPTH' parameter (biggest first). Here follow a description of all you must know to build a RDLOG2 FIG file :

#### Draw text

RDLOG use the 'gd' package to build GIF files. You can only use one font, one size, and 2 orientations (0°, 90°). Use the font 'courier 10' to have the better matching between XFIG and the gif output.

#### Draw rectangles

The rectangle are the only figure that you can fill with colors. You can specify a border and a fill color.

#### Draw polylines

The polylines has only a color attribute.

#### Rate colors definition

For each link defined in the FIG file, the color is computed based on the traffic. There are 10 different color, (0-10 %, 10-20%, ...). And they are define with a special text string, that contains 'color:x' (x is 0 for 0-10%, 1 for 10-20%, ...). The text color define the link color for the corresponding rate.

#### Draw 'links'

A link is a polyline whose color change, depending on traffic present on this link (in the mrtg log file). To build a link, you must group the following elements :

- a polyline the represent the link, with a default color,
- a text string that define the maximum speed for this link, with the following form 'speed:ssssssss'
- a text string with the mrtg log file name, of style 'log:link33.log' (maximum input or output), or of style 'log:>link33.log' (maximum output) or 'log:<link33.log' (maximum input)

The link must only contains this 3 objects.

#### Define GIF area

The GIF area is define with 2 elements, that must be grouped :

- a rectangle that define the GIF region. The color of the rectangle define the background color of the GIF file.
- a text string, containing 'gifarea'

#### Define clickable region

With the '-m' command line option, RDLOG2 build a html file, that contains the GIF file, and where you can click to reach the corresponding mrtg files. You must define the clickable region, by creating a group with the following elements :

- a rectangle that define the clickable region
- a text string, containing 'url:linkname.html'

## Building RDLOG

RDLOG use the gd library. In order to built it, you must have the following files :

- `RDLOG2.C`

and from the gd library,

- `GDFONTS.H`
- `GDFONTS.C`
- `MTABLES.C`
- `GD.H`
- `GD.C`

To build it, on unix , you can type :

`gcc rdlog2.c -I/yourgdinclude -L/yourgdlibrary -lgd -lm -o RDLOG2`

On a PC with NT or 95, make a project with `RDLOG2.C, GD.C, GDFONTS.C`

## Calling RDLOG

The command-line parameters are :

`rdlog2 -i cfile -o gfile [-m htmlfile] -r rounds`

- `ifile :` input config file name
- `gfile :` output gif file (will be overwritten)
- `mfile :` `html file with clickable map` (optional, will be overwritten)
- `rounds :` number of 5 min intervals to take

for example : `rdlog2 -i wan.fig -o wan.gif -m wan.html -r 12 > wan1.txt`

You can so make an average of the x last 5 minutes intervals. Here, the map is drawn for the last hour.

5.5.97, Philippe Simonet, philippe.simonet@swisstelecom.com