From da92cb53f8493d3f24c669e0ea10a3bc57dca387 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Thu, 30 Apr 2020 16:25:00 +0200 Subject: [PATCH] rcmd h&d --- pandora_server/lib/PandoraFMS/DiscoveryServer.pm | 11 +++++++++++ pandora_server/lib/PandoraFMS/Recon/Base.pm | 5 ++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm index 7303771422..8639c52b6f 100644 --- a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm +++ b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm @@ -935,6 +935,16 @@ sub PandoraFMS::Recon::Base::create_network_profile_modules($$) { $np_component->{'id_nc'} ); + # Tag cleanup. + if (!is_empty($component->{'tags'})) { + my @tags = map { + if ($_ > 0) { $_ } + else {} + } split ',', $component->{'tags'}; + + $component->{'tags'} = join ',', @tags; + } + $component->{'name'} = safe_output($component->{'name'}); if ($component->{'type'} >= 15 && $component->{'type'} <= 18) { $component->{'snmp_community'} = safe_output($self->get_community($device)); @@ -1386,6 +1396,7 @@ sub PandoraFMS::Recon::Base::report_scanned_agents($;$) { $progress += $step; # Store temporally. Wait user approval. my $encoded; + eval { local $SIG{__DIE__}; $encoded = encode_base64( diff --git a/pandora_server/lib/PandoraFMS/Recon/Base.pm b/pandora_server/lib/PandoraFMS/Recon/Base.pm index dec92f1437..ff78852bd5 100644 --- a/pandora_server/lib/PandoraFMS/Recon/Base.pm +++ b/pandora_server/lib/PandoraFMS/Recon/Base.pm @@ -1364,7 +1364,7 @@ sub prepare_agent($$) { $self->{'agents_found'} = {} if ref($self->{'agents_found'}) ne 'HASH'; # Already initialized. - return if ref($self->{'agents_found'}->{$host_name}) eq 'HASH'; + return if (ref($self->{'agents_found'}->{$addr}) eq 'HASH'); my @addresses = $self->get_addresses($addr); $self->{'agents_found'}->{$addr} = { @@ -1413,8 +1413,7 @@ sub add_module($$$) { return unless is_enabled($rs); - $self->{'agents_found'}->{$agent}->{'modules'}{$data->{'name'}} = $data; - + $self->{'agents_found'}->{$agent}->{'modules'}->{$data->{'name'}} = $data; } ################################################################################