Merge pull request #569 from jben94/env_cisco_PhysDesc

To remove the line breaks in the description.
This commit is contained in:
qgarnier 2016-12-28 10:52:43 +01:00 committed by GitHub
commit 1b129b785f
2 changed files with 6 additions and 2 deletions

View File

@ -24,6 +24,7 @@ use base qw(centreon::plugins::templates::hardware);
use strict;
use warnings;
use centreon::plugins::misc;
sub set_system {
my ($self, %options) = @_;
@ -123,6 +124,9 @@ sub snmp_execute {
push @{$self->{request}}, { oid => $oid_entPhysicalDescr }, { oid => $oid_ciscoEnvMonPresent };
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
while (my ($key, $value) = each %{$self->{results}->{$oid_entPhysicalDescr}}) {
$self->{results}->{$oid_entPhysicalDescr}->{$key} = centreon::plugins::misc::trim($value);
}
$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'}} ) ?
$map_type_mon{$self->{results}->{$oid_ciscoEnvMonPresent}->{$oid_ciscoEnvMonPresent . '.0'}} : 'unknown'));

View File

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