[mrtg] multi-context templates

Daniel J McDonald dan.mcdonald at austinenergy.com
Sat Mar 7 00:45:51 CET 2009


On Tue, 2009-03-03 at 11:38 +1300, Steve Shipway wrote:
> > In SNMP v3, there is no "community string" that can be modified, so they
> > do a similar thing with Context-id's.  Thus, when querying the
> > BRIDGE-MIB, you specify -n Vlan-2 to see the vlan 2 bridging
> > information.
> 
> I think I can smell a requirement for a cfgmaker modification.  And I don't
> want to be the one to do it (not least because I don't have SNMPv3 here to
> test with :-) )

Ok, I think I've got how it will work...

The config generation is done using 

	foreach(sort {mumble} keys %$routers) 

if I instead create a sorted array and use 

	while (my $router = shift @array_of_routers)

then I should be able to call addrouter() from within the template and
push the new virtual router on @array_of_routers.  I would have to tweak
the options to drop the host-template, add the contextname, and change
the community (I'll probably put the context in that field).  Since the
community is ignored in snmpv3, that should be fine and create nice
unique keys.

Except I'm doing something wrong - it makes it one pass through and
still won't go back and look at the new "routers" I've built.  I might
not be using references properly.  Would appreciate any ideas.







More information about the mrtg mailing list