Commit 02fbdd68 authored by Nigel Kukard's avatar Nigel Kukard

Reworked processing of stats

parent 3147ded6
......@@ -231,26 +231,31 @@ sub task_child_stdout
# Is this a system class?
# XXX: _class_parent is hard coded to 1
if ($stat->{'_class_parent'} == 1 && (my $classChildDec = hex($stat->{'_class_child'})) < 100) {
# Split off the different types of updates
if ($classChildDec == 1) {
$sid = opentrafficshaper::plugins::statistics::getSIDFromCID($interface,0);
my $classChildDec = hex($stat->{'_class_child'});
if ($stat->{'_class_parent'} == 1) {
# Check if this is a limit class...
if (opentrafficshaper::plugins::tc::isTcLimitClass($interface,1,$stat->{'_class_child'})) {
if (defined(my $lid = opentrafficshaper::plugins::tc::getLIDFromTcLimitClass($interface,$stat->{'_class_child'}))) {
$sid = opentrafficshaper::plugins::statistics::getSIDFromLID($lid);
$direction = opentrafficshaper::plugins::statistics::getTrafficDirection($lid,$interface);
} else {
$logger->log(LOG_WARN,"[TCSTATS] Limit traffic class '%s:%s' NOT FOUND",$stat->{'_class_parent'},$stat->{'_class_child'});
}
} else {
# Save the class with the decimal number
if (my $tcClass = opentrafficshaper::plugins::tc::isTcTrafficClassValid($interface,1,$stat->{'_class_child'})) {
my $classID = hex($tcClass);
$sid = opentrafficshaper::plugins::statistics::getSIDFromCID($interface,$classID);
# Class = 1 is the root
if ($classChildDec == 1) {
# This is a special case case
$sid = opentrafficshaper::plugins::statistics::getSIDFromCID($interface,0);
} else {
$logger->log(LOG_WARN,"[TCSTATS] System traffic class '%s:%s' NOT FOUND",$stat->{'_class_parent'},$stat->{'_class_child'});
# Save the class with the decimal number
if (my $tcClass = opentrafficshaper::plugins::tc::isTcTrafficClassValid($interface,1,$stat->{'_class_child'})) {
my $classID = hex($tcClass);
$sid = opentrafficshaper::plugins::statistics::getSIDFromCID($interface,$classID);
} else {
$logger->log(LOG_WARN,"[TCSTATS] System traffic class '%s:%s' NOT FOUND",$stat->{'_class_parent'},$stat->{'_class_child'});
}
}
}
} else {
if (defined(my $lid = opentrafficshaper::plugins::tc::getLIDFromTcLimitClass($interface,$stat->{'_class_child'}))) {
$sid = opentrafficshaper::plugins::statistics::getSIDFromLID($lid);
$direction = opentrafficshaper::plugins::statistics::getTrafficDirection($lid,$interface);
}
}
# Make sure we have the lid now
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment