[mrtg] cfgmaker using selective interface.

Dan mrtg at dandoore.com
Tue Jul 22 23:16:31 CEST 2008

Mersberger, Robert wrote:
> Is it possible to setup cfgmaker to only poll specific interfaces? 
> Example: I have routers with multiple subinterface but I only want to 
> poll the primary interfaces like fa0/0, fa0/1 and se0/0/0.  I would like 
> to be able to do this with cfgmaker because right now I run cfgmaker 
> then edit the created cfg file and either remove or comment out the 
> interface I do not want to monitor.  This creates problems when I have 
> to recreate the cfg file after a routers configuration changes, like 
> when a port speed in up dated.

There's two ways of doing this that I've used:

1. Use filters with cfgmaker - use something like 
'--if-filter=($default_iftype && ($if_is_ethernet || ($if_is_wan && 

2. Use a template with cfgmaker and put a condition on target processing 
to match the above criteria with a Perl expression - I do this to filter 
out interfaces that I'm not bothered about and tweak parameters on 
others so it's more flexible than a filter.

See the template section of the cfgmaker docs and look at 'Template 
Example 1' and you can add an extra condition to the section under 
if(not $problem_lines) to match or reject interfaces that you wish to 
have - I've used a string match on part of the interface name to 
explicitly reject things like vlan interfaces and virtual bits that 
cfgmaker picks up off some cisco routers.

It's all in http://oss.oetiker.ch/mrtg/doc/cfgmaker.en.html though so 
have a dig.


More information about the mrtg mailing list