From c5bd3204aba85ac081e3caac168b16e6049b53c7 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Fri, 24 May 2019 11:42:46 +0200 Subject: [PATCH] Minor style, avoided duplicated iface names with spaces --- .../include/javascript/pandora_taskList.js | 9 ++++--- .../lib/PandoraFMS/DiscoveryServer.pm | 26 +++++++++++-------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/pandora_console/include/javascript/pandora_taskList.js b/pandora_console/include/javascript/pandora_taskList.js index f151c9003a..75d95df026 100644 --- a/pandora_console/include/javascript/pandora_taskList.js +++ b/pandora_console/include/javascript/pandora_taskList.js @@ -19,10 +19,13 @@ function progress_task_list(id, title) { .empty() .dialog({ title: title, - draggable: true, + autoOpen: false, modal: false, - width: 600, - height: 420, + resizable: false, + draggable: false, + closeOnEscape: true, + width: 800, + height: 600, close: function() { if (xhr != null) xhr.abort(); if (timeoutRef != null) clearTimeout(timeoutRef); diff --git a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm index c92b56ed0d..e15511de44 100644 --- a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm +++ b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm @@ -597,6 +597,9 @@ sub PandoraFMS::Recon::Base::create_agents($$) { sub PandoraFMS::Recon::Base::create_agent($$) { my ($self, $device) = @_; + # Clean name. + $device = clean_blank($device); + my @agents = get_db_rows($self->{'dbh'}, 'SELECT * FROM taddress, taddress_agent, tagente WHERE tagente.id_agente = taddress_agent.id_agent @@ -732,21 +735,22 @@ sub PandoraFMS::Recon::Base::create_agent($$) { my $if_name = $self->snmp_get_value($device, "$PandoraFMS::Recon::Base::IFNAME.$if_index"); $if_name = "if$if_index" unless defined ($if_name); $if_name =~ s/"//g; + $if_name = clean_blank($if_name); # Check whether the module already exists. - my $module_id = get_agent_module_id($self->{'dbh'}, "${if_name}_ifOperStatus", $agent_id); + my $module_id = get_agent_module_id($self->{'dbh'}, $if_name.'_ifOperStatus', $agent_id); + next if ($module_id > 0 && !$agent_learning); # Encode problematic characters. - $if_name = safe_input($if_name); $if_desc = safe_input($if_desc); # Interface status module. - $module_id = get_agent_module_id($self->{'dbh'}, "${if_name}_ifOperStatus", $agent_id); + $module_id = get_agent_module_id($self->{'dbh'}, $if_name.'_ifOperStatus', $agent_id); if ($module_id <= 0) { my %module = ('id_tipo_modulo' => 18, 'id_modulo' => 2, - 'nombre' => "${if_name}_ifOperStatus", + 'nombre' => safe_input($if_name)."_ifOperStatus", 'descripcion' => $if_desc, 'id_agente' => $agent_id, 'ip_target' => $device, @@ -781,11 +785,11 @@ sub PandoraFMS::Recon::Base::create_agent($$) { # Incoming traffic module. my $if_hc_in_octets = $self->snmp_get_value($device, "$PandoraFMS::Recon::Base::IFHCINOCTECTS.$if_index"); if (defined($if_hc_in_octets)) { - $module_id = get_agent_module_id($self->{'dbh'}, "${if_name}_ifHCInOctets", $agent_id); + $module_id = get_agent_module_id($self->{'dbh'}, $if_name.'_ifHCInOctets', $agent_id); if ($module_id <= 0) { my %module = ('id_tipo_modulo' => 16, 'id_modulo' => 2, - 'nombre' => "${if_name}_ifHCInOctets", + 'nombre' => safe_input($if_name)."_ifHCInOctets", 'descripcion' => 'The total number of octets received on the interface, including framing characters. This object is a 64-bit version of ifInOctets.', 'id_agente' => $agent_id, 'ip_target' => $device, @@ -816,11 +820,11 @@ sub PandoraFMS::Recon::Base::create_agent($$) { } # ifInOctets elsif (defined($self->snmp_get_value($device, "$PandoraFMS::Recon::Base::IFINOCTECTS.$if_index"))) { - $module_id = get_agent_module_id($self->{'dbh'}, "${if_name}_ifInOctets", $agent_id); + $module_id = get_agent_module_id($self->{'dbh'}, $if_name.'_ifInOctets', $agent_id); if ($module_id <= 0) { my %module = ('id_tipo_modulo' => 16, 'id_modulo' => 2, - 'nombre' => "${if_name}_ifInOctets", + 'nombre' => safe_input($if_name)."_ifInOctets", 'descripcion' => 'The total number of octets received on the interface, including framing characters.', 'id_agente' => $agent_id, 'ip_target' => $device, @@ -853,11 +857,11 @@ sub PandoraFMS::Recon::Base::create_agent($$) { # Outgoing traffic module. my $if_hc_out_octets = $self->snmp_get_value($device, "$PandoraFMS::Recon::Base::IFHCOUTOCTECTS.$if_index"); if (defined($if_hc_out_octets)) { - $module_id = get_agent_module_id($self->{'dbh'}, "${if_name}_ifHCOutOctets", $agent_id); + $module_id = get_agent_module_id($self->{'dbh'}, $if_name.'_ifHCOutOctets', $agent_id); if ($module_id <= 0) { my %module = ('id_tipo_modulo' => 16, 'id_modulo' => 2, - 'nombre' => "${if_name}_ifHCOutOctets", + 'nombre' => safe_input($if_name)."_ifHCOutOctets", 'descripcion' => 'The total number of octets received on the interface, including framing characters. This object is a 64-bit version of ifOutOctets.', 'id_agente' => $agent_id, 'ip_target' => $device, @@ -893,7 +897,7 @@ sub PandoraFMS::Recon::Base::create_agent($$) { if ($module_id <= 0) { my %module = ('id_tipo_modulo' => 16, 'id_modulo' => 2, - 'nombre' => "${if_name}_ifOutOctets", + 'nombre' => safe_input($if_name)."_ifOutOctets", 'descripcion' => 'The total number of octets received on the interface, including framing characters.', 'id_agente' => $agent_id, 'ip_target' => $device,