Use centreon::plugins::misc::trim()

This commit is contained in:
Jean-Baptiste 2016-12-22 15:07:06 +01:00
parent 53a16dacd8
commit 7452038113
2 changed files with 4 additions and 4 deletions

View File

@ -123,8 +123,8 @@ sub snmp_execute {
push @{$self->{request}}, { oid => $oid_entPhysicalDescr }, { oid => $oid_ciscoEnvMonPresent }; push @{$self->{request}}, { oid => $oid_entPhysicalDescr }, { oid => $oid_ciscoEnvMonPresent };
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request}); $self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
foreach my $k (keys(%{$self->{results}->{$oid_entPhysicalDescr}})) { while (my ($key, $value) = each %{$self->{results}->{$oid_entPhysicalDescr}}) {
$self->{results}->{$oid_entPhysicalDescr}->{$k} =~ s/^\s+|\s+$|[\n\r]+//g; $self->{results}->{$oid_entPhysicalDescr}->{$key} = centreon::plugins::misc::trim($value);
} }
$self->{output}->output_add(long_msg => sprintf("Environment type: %s", $self->{output}->output_add(long_msg => sprintf("Environment type: %s",
defined($self->{results}->{$oid_ciscoEnvMonPresent}->{$oid_ciscoEnvMonPresent . '.0'}) && defined($map_type_mon{$self->{results}->{$oid_ciscoEnvMonPresent}->{$oid_ciscoEnvMonPresent . '.0'}} ) ? defined($self->{results}->{$oid_ciscoEnvMonPresent}->{$oid_ciscoEnvMonPresent . '.0'}) && defined($map_type_mon{$self->{results}->{$oid_ciscoEnvMonPresent}->{$oid_ciscoEnvMonPresent . '.0'}} ) ?

View File

@ -314,8 +314,8 @@ sub trim {
# Sometimes there is a null character # Sometimes there is a null character
$value =~ s/\x00$//; $value =~ s/\x00$//;
$value =~ s/^[ \t]+//; $value =~ s/^[ \t\n]+//;
$value =~ s/[ \t]+$//; $value =~ s/[ \t\n]+$//;
return $value; return $value;
} }