Allow separate samplerates for in/out traffic

This commit is contained in:
Shane Mc Cormack 2016-04-15 15:13:24 +01:00
parent fafb2417f4
commit 586e5f2d2c
2 changed files with 14 additions and 3 deletions

View File

@ -714,6 +714,9 @@ sub flush_cache {
my $tag = $dsname;
$tag =~ s/(_v6)?_(in|out)$//;
if ($dsname =~ /_(in|out)$/) {
$tag = "${1}_${tag}";
}
my $cursamplingrate = $link_samplingrates{$tag};
push(@templatearg, $dsname);
@ -794,12 +797,19 @@ sub read_knownlinks {
my ($routerip,$ifindex,$tag,$descr,$color,$linksamplingrate) = split(/\t+/);
$knownlinks_tmp{"${routerip}_${ifindex}"} = $tag;
unless(defined($linksamplingrate) && $linksamplingrate =~ /^\d+$/) {
my ($samplein,$sampleout) = split('/', $linksamplingrate);
unless(defined($sampleout) && $sampleout =~ /^\d+$/) {
$sampleout = $samplein;
}
unless(defined($samplein) && $samplein =~ /^\d+$/) {
die("ERROR: No samplingrate for ".$routerip."\n");
}
$link_samplingrates_tmp{$tag} = $linksamplingrate;
$link_samplingrates_tmp{"in_$tag"} = $samplein;
$link_samplingrates_tmp{"out_$tag"} = $sampleout;
#print "DEBUG Sampling Rate for ${routerip}_${ifindex} is IN: $samplein | OUT: $sampleout\n";
}
close(KLFILE);

View File

@ -1,6 +1,7 @@
# Router IP SNMP ifindex[/VLAN] tag description color samplingrate
# note: tabs must be used to separate fields (not spaces)
# max. length for tag is 12 characters; allowed characters: a-z A-Z 0-9 _
# sampling rate can be separate for in/out by specifying <in>/<out> rates.
192.0.2.1 15 uplink1 Uplink 1 A6CEE3 1
192.0.2.1 23 uplink2 Uplink 2 1F78B4 1
192.0.2.2 4 uplink3 Uplink 3 B2DF8A 1