[mrtg] How can I eliminate interfaces from CFG files ?

Steve Shipway s.shipway at auckland.ac.nz
Tue Sep 1 23:36:26 CEST 2009

You can only do one -if-filter , but it can be as complex as you like.

Things to note -

1)       ALWAYS surround it in single quotes under UNIX so as to prevent accidental variable expansion by the shell.
2)       The filter evaluates to TRUE if the interface is kept.
3)       $default is TRUE if the interface would normally have been kept
4)       The filter is in fact a snippet of Perl code, so you can put anything you like in there.


--if-filter='($default and $if_type!=1 and $if_type!=101 and $if_type!=102 and $if_type!=103)'
Or, if you prefer, this is slightly more efficient:
--if-filter='($default and $if_type!=1 and ($if_type<101 or $if_type>103))'

This should do what you're asking for.  Note that you can use '&&' or 'and', the former does a bitwise AND and the latter does a logical one (0 is false, anything else is true).  Since the flags are set to 1 it shouldn't make any difference which you use but I feel 'and' is safer)


From: Mersberger, Robert [mailto:robert.mersberger at goldenliving.com]
Sent: Wednesday, 2 September 2009 7:54 a.m.
To: Steve Shipway; mrtg at lists.oetiker.ch
Subject: RE: How can I eliminate interfaces from CFG files ?

after reading the manual I am somewhat confused.
I tried with the following filter and it seemed to work in that it commented out all type 1 interface but it also commented out type 103 interface.  This was close to what I want to do so I tried it on another router (same series router) and get different results.
This is the filter I used for both.
--if-filter="$default && $if_type !=1"
What I am looking to accomplish is to omit all if_type 1, 101, 102, 103  These were or are all associated with the phone interfaces

How would you suggest I do this?
can I do Multiple --if-filters and can I specify a range?
I have included the latest and really only attempt that seem to almost work.

Hope you can help me understand.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/mrtg/attachments/20090902/27e6b1d5/attachment-0001.htm 

More information about the mrtg mailing list