From e05d47dfdbf50263c94dc518c7b9b093214a6edc Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Date: Tue, 22 May 2018 15:38:51 +0200 Subject: [PATCH] [QOS] Cisco - Bug fix proposal (#792) * Fix: Calcul total And Child * Fix: Put in 'variable' the name of the service-policy * Fix: child detection --- .../cisco/standard/snmp/mode/qosusage.pm | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/centreon-plugins/centreon/common/cisco/standard/snmp/mode/qosusage.pm b/centreon-plugins/centreon/common/cisco/standard/snmp/mode/qosusage.pm index a5cbd75b0..d2b634e4e 100644 --- a/centreon-plugins/centreon/common/cisco/standard/snmp/mode/qosusage.pm +++ b/centreon-plugins/centreon/common/cisco/standard/snmp/mode/qosusage.pm @@ -374,12 +374,20 @@ sub manage_selection { display => $name, traffic_usage => $traffic_usage * 8, drop_usage => $drop_usage * 8, total => $total }; - $self->{classmap}->{$class_name} = { display => $class_name, drop_usage => 0, traffic_usage => 0} if (!defined($self->{classmap}->{$class_name})); - $self->{classmap}->{$class_name}->{traffic_usage} += $traffic_usage * 8; - $self->{classmap}->{$class_name}->{drop_usage} += $drop_usage * 8; - $self->{total}->{traffic_usage} += $traffic_usage * 8; - $self->{total}->{drop_usage} += $drop_usage * 8; + my @tabname = split /:/, $name; + if (defined($tabname[3])){ + $class_name = $tabname[3].'-'.$class_name; + } + + $self->{classmap}->{$name} = { display => $class_name, drop_usage => 0, traffic_usage => 0} if (!defined($self->{classmap}->{$name})); + $self->{classmap}->{$name}->{traffic_usage} += $traffic_usage * 8; + $self->{classmap}->{$name}->{drop_usage} += $drop_usage * 8; + + if (!defined($tabname[3])){ + $self->{total}->{traffic_usage} += $traffic_usage * 8; + $self->{total}->{drop_usage} += $drop_usage * 8; + } } $self->{cache_name} = "cisco_qos_" . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' . $self->{mode} . '_' .