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

v 1.1, 5.5.97 :

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 :

The link must only contains this 3 objects.

Define GIF area

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

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 :

Building RDLOG

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

and from the gd library,

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

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