From f0e668fb10288d2e93b7d227e580fd8edb3c2d37 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Thu, 2 Jul 2020 10:41:03 +0200 Subject: [PATCH] fix #2087 --- snmp_standard/mode/storage.pm | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/snmp_standard/mode/storage.pm b/snmp_standard/mode/storage.pm index b217c4438..d5263665a 100644 --- a/snmp_standard/mode/storage.pm +++ b/snmp_standard/mode/storage.pm @@ -350,22 +350,23 @@ sub manage_selection { } if (defined($self->{option_results}->{filter_duplicate})) { - my $sid = $_; - my @duplicate = grep { - ($self->{storage}->{$_}->{allocation_units} == $result->{$oid_hrStorageAllocationUnits . "." . $sid}) && - ($self->{storage}->{$_}->{size} == $result->{$oid_hrStorageSize . "." . $sid}) && - ($self->{storage}->{$_}->{used} == $result->{$oid_hrStorageUsed . "." . $sid}) - } keys $self->{storage}; - if (scalar(@duplicate)) { - next; - } + my $duplicate = 0; + foreach my $entry (values %{$self->{storage}}) { + if (($entry->{allocation_units} == $result->{$oid_hrStorageAllocationUnits . '.' . $_}) && + ($entry->{size} == $result->{$oid_hrStorageSize . "." . $_}) && + ($entry->{used} == $result->{$oid_hrStorageUsed . "." . $_})) { + $duplicate = 1; + last; + } + } + next if ($duplicate == 1); } $self->{storage}->{$_} = { display => $name_storage, - allocation_units => $result->{$oid_hrStorageAllocationUnits . "." . $_}, - size => $result->{$oid_hrStorageSize . "." . $_}, - used => $result->{$oid_hrStorageUsed . "." . $_}, + allocation_units => $result->{$oid_hrStorageAllocationUnits . '.' . $_}, + size => $result->{$oid_hrStorageSize . '.' . $_}, + used => $result->{$oid_hrStorageUsed . '.' . $_}, access => defined($access_result->{$_}) ? $access_result->{$_} : undef, }; $self->{global}->{count}++;