[mrtg] Re: Accessing MRTG Graphs in a Drill Down Fashion

bwoodcoc bwoodcoc at genuity.com
Tue Nov 27 23:50:45 MET 2001


 >>The web image that you dynamically generate is something that I'm very 
interested in.
 >>Can you give me some specifics? Is it all custom written or a 
combination of custom scripts and a drawing package of some >>sort? Any 
info pointing me to some software that I could use to do what you are doing 
would be appreciated.

 >>Thanks,
 >>Keith Monroe


Hi Keith,

The drawing package is simply GD within perl along with custom scripts as 
you have guessed. GD in fact turned out to be fairly easy to use once you 
have played with it. I had this concept in my mind for years but did not 
look closely enough at GD and thought I was incapable. I'm just a hack 
netmgt guy who does fairly basic perl. However once I drew my first circle 
to a gif file I became obsessed with my long sought after functions 
described below. I don't believe you can buy these functions anywhere yet 
but I could be wrong.

If you want to draw basic icons for routers and make them hot links this is 
fairly simple. But inter-connectivity and logical placement of icons is a 
big deal which is where the obsession lead me.

I also want to note before I go any further for those interested in this 
subject you do have alternatives which I forgot to even mention to the 
original questioner. My first crack at this was to create a visio drawing 
which you can apply a hot link url to the objects (rtrs and lines) then 
export to html format. This worked fairly well except it is a major admin 
task to upkeep the maps and url's for changes. But for those who have a 
fairly static topology (ya right) or are willing to put in the effort this 
can be a slick technique for graphical navigation AND can be a control 
point for maps of topology. It worked for me except line colors are static 
compared to what I describe below. But I just can't deal with the 
maintenance, lazy dude that I am I'd rather script for a few months to 
provide something dynamic (grin).

Here is an overview of how I create dynamic maps, it is a multi-step process.
- I am running mrtg 2.7.5 (old eh?). I modified cfgmaker to do several 
things. It builds a cfg for each router which contains targets for 
utilization, ifErrors/ifDiscards, and response time (if a flag is seen). 
The targets are named rtrName.ipAddress for better navigation from scripts 
and so on.
- cfgmaker also builds a dummy cfg for the network number of the interface 
with the file name being netNumber.cfg . This way I use indexmaker to build 
index files by network number and each will contain all interfaces for a 
given net. This is very important for the automapping functions navigation 
to metrics.
- cfgmaker also writes link info out to a file which contains rtrName, ip, 
netNumber, speed, indexNumber, etc... Note I added to cfgmaker a call to 
get netmasks then a call to ipmask unix utility to determine the net. I 
could have written this function wholely myself but cfgmaker was already 
hitting the rtrs with 90% of what I needed, so I just added to it.
- indexmaker is executed against all the rtr cfgs and dummy net cfgs. These 
index files are the hot links which I navigate to metrics using a simple 
cgi from the web image.
- a script then goes through the link list and builds relations based on 
the network numbers. Who is connected to who. Note there are 2 requirements 
for this whole automap function to work. You must have a list of all rtrs 
(objs) to be placed on the map. You must also address each ptp link with a 
unique net number. If you are using frame relay then you must also have 
subinterfaces defined also with unique nets just like a ptp link. This is 
basic addressing and network numbers become the glue. There is also a map 
properties file to help with layout. You can define groups of routers to 
another map. You can also define the root for the map. The root simply 
means what will be at the top of any map. The script then determines the 
hop count for every object with relation to the root objects for that map. 
This was confusing stuff to write but when the layout drops before you on 
the web it looks nice IMHO.
- and lastly there is the main cgi. For any given map it reads all the 
topology file info and constructs the layout, connecting routers directly 
if ptp links or drawing an Ethernet line for a network object then 
connecting to it. All the lines are hot linked to the appropriate network 
index file using an additional small cgi. Also while the lines are being 
drawn the cgi has a function defined (utilization, speed, latency). In this 
way lookups are done before drawing the line so color can be applied.

So this is not for the meek at heart but it could be applied to other unix 
implementations given some perl experience. However it is a package and as 
you can see there are many interdependencies of scripts and file naming 
standards.

cheers,
brad...

At 11:18 AM 11/26/2001 -0500, bwoodcoc wrote:

>Hi Cliff,
>
>We use a couple different techniques. The first is a java script tree
>similar as to what the other responses have shown. However ours ends up
>pointing to a directory structure for indexmaker files. A web directory
>structure pointer is not pretty to say the least but we have 200+ switches
>with isl's and 60+ routers. We need the structure to be built dynamically
>via script each day because of changes. I have not put the effort into
>making the tree build dynamically each day. However the directory
>structures for the index files is very functional. There are 3
>subdirectories: routers, switches/isls, and networks. You can walk your way
>very easily to find what you need, but there is no flash to this. The
>others responding look better indeed.
>
>The second technique is very slick and is for routers/L3 only right now. It
>is a web image with icons indicated for each router. There is also a
>grouping function which allows for a drill down. For instance all Cambridge
>located routers are in a "Cambridge" group and Cambridge is presented as
>the icon. Click on Cambridge and it presents all of these routers. Also all
>the routers show interconnections (lines) between them, including pipe
>icons for Ethernets. This is dynamically built each night so it is an
>auto-discovery like mapping function for Layer 3.
>
>All of the icons for routers, groups and lines are hot links. Router icons
>go to an mrtg index file for all the interfaces for that router. Group
>icons bring up the interconnectivity of all routers within the group (of
>which those router icons now lead to mrtg metrics). And lines are hot links
>to an index file showing all the interfaces within that net for which the
>line represents. Full graphical navigation to L3 metrics while depicting
>topology.
>
>Now here is the real win. I build the connectivity relationships each night
>making this sort of dynamic. However I build the web image on the fly from
>the relations when navigating. I now have control of COLORS of OBJECTS
>during image presentation, specifically the lines are of interest. Next I
>export all of my mrtg values into a file for reference each 5 minutes.
>Using this reference I now have a L3 auto-map which color codes the lines
>by speed, utilization or response time. Waaaay cool.
>
>Unfortunately I have struggled with how to show the world this given
>security concerns of my company. And needless to say there are strict
>conformance requirements to how mrtg targets are named and links are
>numbered. The scripts to deliver these functions are a bit complex but it
>is achievable.
>
>cheers,
>brad...
>
>At 04:26 PM 11/24/2001 -0900, Cliff Savage wrote:
>
> >What are ppl using to index their MRTG graphs in an overview
> >sort of mode? I've seen a frameset with arrows that you diddle
> >and expand the tree so you can see what graphs are available
> >but I don't know what scripts are used to do this. Anyone got any
> >ideas and/or examples and/or something available for download?
> >
> >Thx Gurus.
> >
> >
> >--
> >Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
> >Archive     http://www.ee.ethz.ch/~slist/mrtg
> >FAQ         http://faq.mrtg.org  Homepage     http://www.mrtg.org
> >WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi
>
>
>--
>Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
>Archive     http://www.ee.ethz.ch/~slist/mrtg
>FAQ         http://faq.mrtg.org  Homepage     http://www.mrtg.org
>WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi


--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the mrtg mailing list