From: W.J.M. N. <Wim...@nl...> - 2014-09-02 06:53:55
|
Hello, >> I am using a patch to Devmon to solve this problem. It changes the >> name of the interfaced part of the RRD file name. This causes the >> alphabetical order to be the same as the numerical order. There is a >> drawback however. For some of the interfaces the RRD file name >> changes, causing new files to be generated once the patch is >> applied. If you do not want to loose the history, you need to save / >> restore / move those files. Anyway, you need to remove the RRD files >> with the unsed interface names in it, as they will mesh up the >> graphs on the Xymon page. >> >> The patch itself is: >> >> Index: dm_tests.pm >> =================================================================== >> --- dm_tests.pm (revision 13) >> +++ dm_tests.pm (revision 14) >> @@ -2022,6 +2022,11 @@ >> for my $leaf (@{$rrd{$name}{'leaves'}}) { >> my $pri_val = $oids->{$pri}{'val'}{$leaf}; >> $pri_val =~ s/\s*//g; >> + # >> + # Map Cisco interface names like "Fa1/0/1" onto "Fa1/0/01". This >> will cause a >> + # nicer order of the graphs in the trends column in Xymon. >> + # >> + if ( $pri_val =~ >> m/^(Fa\d\/|Fa\d\/\d\/|Gi\d\/\d\/|Gi\d\/|Po)(\d)$/ ) { >> + $pri_val = $1 . '0' . $2 ; >> + } elsif ( $pri_val =~ m/^(Vl)(\d{1,3})$/ ) { >> + $pri_val = $1 . substr( '000' . $2, -4, 4 ) ; >> + } # of elsif > > If this is the approach everyone wants, this needs at least Te, and possibly longer prefixes that can be used (if the device is configured for long names) such as GigabitEthernet, TegGigE etc. How about extending patch #27, "Add TABLE:sort option" to apply the same transformations to the RRD file names? That approach would make the code of Devmon independent of the devices being used. However, the line above using function substr is harder to catch in a s/// substitution. Regards, Wim Nelis. |