I like to have interfaces and description, not one or the other. So I do this. Use your favorite editor to open indexmaker: vi /usr/bin/indexmaker
Find this part: ,i
for ($$opt{section}) {
# ...Skip ahead to descr...
/^descr(iption)?$/ &&
do{
$section = "No Description for $item";
$$rcfg{setenv}{$item} =~ /MRTG_INT_DESCR="(.+?)"/ #"
and $section = $1;
$$rcfg{pagetop}{$item} =~
m,<td>Description:</td>\s*<td>\Q$section\E\s*([^< ][^>]+?)
and $section = $1;
last;
};
The first “and $section = $1;” is a catch all to assign the interface name if there’s no description. The second one overwrites it, replacing the int name if it does find a description. So all you need to do is modify the second instance of “and $section = $1;” to:
and $section = $section . " - " . $1;
And your MRTG index is infinitely improved!


Thanks!
Screenshots or pictures would make a good addition to your articles.
Another way to fix this is to replace the line:
m,Description:\s*\Q$section\E\s*([^< ][^<]+?),i
with
m,\s*Description:\s*\s*\s*([^< ][^<]+?),i
to give a more general (perhaps) parsing rule for what the “Description:” line contains. I always find myself hand editing the MRTG cfg file, and screwing up the semantics of the Description: line enough to throw off indexmaker. Plus I suspect there may be incompatibilities with indexmaker and cfg files made by hand or made a long time ago with old versions of cfgmaker. Anyway, it’s all just a simple exercise in the joyful wonders of Perl regular expressions.
Well foo it took out all my tags. Will this work?
[code]
Replace the line
m,Description:\s*\Q$section\E\s*([^< ][^<]+?),i
with
m,\s*Description:\s*\s*\s*([^< ][^<]+?),i
[code]
Nope. well you get the idea