add protection for sap duplicate name

This commit is contained in:
qgarnier 2017-07-24 18:02:34 +02:00
parent 87a22f1c59
commit d6f85a2efb
1 changed files with 7 additions and 1 deletions

View File

@ -193,7 +193,7 @@ sub manage_selection {
my $snmp_result = $options{snmp}->get_multiple_table(oids => [
{ oid => $mapping->{sapDescription}->{oid} },
], return_type => 1, nothing_quit => 1);
my $done_description = {};
$self->{sap} = {};
foreach my $oid (keys %{$snmp_result}) {
$oid =~ /^$mapping->{sapDescription}->{oid}\.(.*)$/;
@ -208,6 +208,12 @@ sub manage_selection {
next;
}
if (defined($done_description->{$snmp_result->{$oid}})) {
$self->{output}->output_add(long_msg => "skipping sap '" . $snmp_result->{$oid} . "': duplicated description.", debug => 1);
next;
} else {
$done_description->{$snmp_result->{$oid}} = 1;
}
$self->{sap}->{$instance} = { display => $snmp_result->{$oid} };
}