From d6af3c7121dd47a00cfa9212f088f434a1266fdb Mon Sep 17 00:00:00 2001 From: SHIMIZU Hiroki Date: Mon, 28 Nov 2022 11:40:45 +0900 Subject: [PATCH] On pandora_server/util/plugin/pandora_snmp_bandwidth.pl fixed typo (bandwith -> bandwidth) added new condition to determine if SNMP has a 64-bit counter fixed a bug that bandwidth utilization was not output when bandwidth utilization was 0% --- .../util/plugin/pandora_snmp_bandwidth.pl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pandora_server/util/plugin/pandora_snmp_bandwidth.pl b/pandora_server/util/plugin/pandora_snmp_bandwidth.pl index 3eb2b4fb53..8b5d505116 100755 --- a/pandora_server/util/plugin/pandora_snmp_bandwidth.pl +++ b/pandora_server/util/plugin/pandora_snmp_bandwidth.pl @@ -2,7 +2,7 @@ # ################################################################################ # -# Bandwith usage plugin +# Bandwidth usage plugin # # Requirements: # snmpget @@ -55,7 +55,7 @@ Where OPTIONS could be: [EXTRA] -ifIndex Target interface to retrieve, if not specified, total - bandwith will be reported. + bandwidth will be reported. -uniqid Use custom temporary file name. -inUsage Show only input usage (in percentage) - 1, or not 0. -outUsage Show only output usage (in percentage) - 1, or not 0. @@ -492,9 +492,9 @@ $config->{'tmp_separator'} = ';' if empty($config->{'tmp_separator'}); $config->{'tmp'} = (($^O =~ /win/)?$ENV{'TMP'}:'/tmp') if empty($config->{'tmp'}); # Create unique name for tmp and log file for host -my $filename = $config->{'tmp'}.'/pandora_bandwith_'.$config->{'host'}; +my $filename = $config->{'tmp'}.'/pandora_bandwidth_'.$config->{'host'}; if (!empty($config->{'uniqid'})) { - $filename = $config->{'tmp'}.'/pandora_bandwith_'.$config->{'uniqid'}; + $filename = $config->{'tmp'}.'/pandora_bandwidth_'.$config->{'uniqid'}; } # Replace every dot for underscore $filename =~ tr/./_/; @@ -511,7 +511,7 @@ if ( defined($sysobjectid->{'error'}) || $sysobjectid->{'data'} eq '' ) { # Check SNMP x64 interfaces my $walk64 = snmp_walk({%{$config}, 'oid' => '.1.3.6.1.2.1.31.1.1.1.6'}); -if ( $walk64 =~ 'No Such Instance currently exists at this OID' || $walk64 =~ 'No more variables left in this MIB View') { +if ( $walk64 =~ 'No Such Instance currently exists at this OID' || $walk64 =~ 'No more variables left in this MIB View' || $walk64 =~ 'No Such Object available on this agent at this OID') { $config->{'use_x64'} = 0; } else { $config->{'use_x64'} = 1; @@ -556,15 +556,15 @@ my $j = 0; my $k = 0; foreach my $iface (keys %{$analysis_tree}) { # Calculate summary; - if (is_enabled($analysis_tree->{$iface}{'bandwidth'})) { + if (is_enabled($analysis_tree->{$iface}{'bandwidth'}) || $analysis_tree->{$iface}{'bandwidth'} == 0) { $bandwidth = $analysis_tree->{$iface}{'bandwidth'}; $i++; } - if (is_enabled($analysis_tree->{$iface}{'inUsage'})) { + if (is_enabled($analysis_tree->{$iface}{'inUsage'}) || $analysis_tree->{$iface}{'inUsage'} == 0) { $inUsage = $analysis_tree->{$iface}{'inUsage'}; $j++; } - if (is_enabled($analysis_tree->{$iface}{'outUsage'})) { + if (is_enabled($analysis_tree->{$iface}{'outUsage'}) || $analysis_tree->{$iface}{'inUsage'} == 0) { $outUsage = $analysis_tree->{$iface}{'outUsage'}; $k++; }