From b5401a500c0785e3b876d7d8feb8330edde40fb8 Mon Sep 17 00:00:00 2001 From: fbsanchez <fborja.sanchez@artica.es> Date: Mon, 25 Mar 2019 11:02:16 +0100 Subject: [PATCH 01/21] minor fixes Former-commit-id: 30e4d5dffa78834088d8644168d4d64b13cf8b08 --- pandora_console/include/class/NetworkMap.class.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php index db8df9e2a1..d86e3cfaf0 100644 --- a/pandora_console/include/class/NetworkMap.class.php +++ b/pandora_console/include/class/NetworkMap.class.php @@ -2765,6 +2765,10 @@ class NetworkMap false, true ); + + $output .= '</div>'; + $output .= '</div>'; + return $output; } @@ -3278,7 +3282,10 @@ class NetworkMap '/enterprise/include/styles/tooltipster.bundle.min.css' ).'" />'."\n"; - $output .= '<div id="simple_map" data-id="'.$this->idMap.'" style="border: 1px #dddddd solid;">'; + $output .= '<div id="simple_map" data-id="'.$this->idMap.'" '; + $output .= 'style="border: 1px #ddd solid;'; + $output .= ' width:'.$this->mapOptions['width']; + $output .= ' height:'.$this->mapOptions['height'].'">'; $output .= '<svg id="svg'.$this->idMap.'" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" pointer-events="all" width="'.$this->mapOptions['width'].'" height="'.$this->mapOptions['height'].'px">'; $output .= '</svg>'; $output .= '</div>'; From e1a4250d014c1dad85497d1222c4444c129315ea Mon Sep 17 00:00:00 2001 From: fbsanchez <fborja.sanchez@artica.es> Date: Mon, 25 Mar 2019 11:09:22 +0100 Subject: [PATCH 02/21] NetworkClass RC1 Former-commit-id: bd30ce824e0f50e9684e32268bea396a84ff6744 --- pandora_console/include/class/NetworkMap.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php index d86e3cfaf0..0d80bf7842 100644 --- a/pandora_console/include/class/NetworkMap.class.php +++ b/pandora_console/include/class/NetworkMap.class.php @@ -3285,7 +3285,7 @@ class NetworkMap $output .= '<div id="simple_map" data-id="'.$this->idMap.'" '; $output .= 'style="border: 1px #ddd solid;'; $output .= ' width:'.$this->mapOptions['width']; - $output .= ' height:'.$this->mapOptions['height'].'">'; + $output .= ' ;height:'.$this->mapOptions['height'].'">'; $output .= '<svg id="svg'.$this->idMap.'" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" pointer-events="all" width="'.$this->mapOptions['width'].'" height="'.$this->mapOptions['height'].'px">'; $output .= '</svg>'; $output .= '</div>'; From dad791b887d30470fe33cfd3e8d49c7e22ff8905 Mon Sep 17 00:00:00 2001 From: fbsanchez <fborja.sanchez@artica.es> Date: Mon, 25 Mar 2019 15:52:15 +0100 Subject: [PATCH 03/21] relationship management JS Former-commit-id: 82216265dece0e5d9f77a82b1b22d6ff00265ee1 --- .../include/class/NetworkMap.class.php | 11 ++-- .../functions_pandora_networkmap.js | 52 ++++++++++--------- 2 files changed, 36 insertions(+), 27 deletions(-) diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php index 0d80bf7842..4d166e9e0c 100644 --- a/pandora_console/include/class/NetworkMap.class.php +++ b/pandora_console/include/class/NetworkMap.class.php @@ -2992,7 +2992,11 @@ class NetworkMap $table->data = []; - $table->data['interface_row']['node_source_interface'] = html_print_label('', 'node_source_interface'); + $table->data['interface_row']['node_source_interface'] = html_print_label( + '', + 'node_source_interface', + true + ); $table->data['interface_row']['interface_source_select'] = html_print_select( [], @@ -3016,10 +3020,11 @@ class NetworkMap $table->data['interface_row']['node_target_interface'] = html_print_label( '', - 'node_target_interface' + 'node_target_interface', + true ); - $output .= 'br><br>'; + $output .= '<br>'; $table->data['interface_row']['interface_link_button'] = html_print_button( __('Add interface link'), diff --git a/pandora_console/include/javascript/functions_pandora_networkmap.js b/pandora_console/include/javascript/functions_pandora_networkmap.js index a586609f71..f4326638ed 100644 --- a/pandora_console/include/javascript/functions_pandora_networkmap.js +++ b/pandora_console/include/javascript/functions_pandora_networkmap.js @@ -83,7 +83,7 @@ function draw_minimap() { context_minimap.arc(center_orig_x, center_orig_y, 2, 0, Math.PI * 2, false); //Check if the pandora point - if (value.id_agent == -1) { + if (value.type == 2) { context_minimap.fillStyle = "#364D1F"; } else { context_minimap.fillStyle = "#000"; @@ -868,7 +868,7 @@ function edit_node(data_node, dblClick) { ); // It doesn't eval the possible XSS so it's ok $("#dialog_node_edit").dialog("open"); - if (node_selected.id_agent == undefined || node_selected.id_agent == -2) { + if (node_selected.id_agent == undefined || node_selected.type == 3) { //Fictional node $("#node_options-fictional_node_name").css("display", ""); $("input[name='edit_name_fictional_node']").val(node_selected.text); // It doesn't eval the possible XSS so it's ok @@ -1681,7 +1681,8 @@ function clear_selection() { function update_networkmap() { if (enterprise_installed) { node.each(function(d) { - if (d.id_agent != -1) { + // Do not update Pandora FMS node. + if (d.type != 2) { var params = []; params.push("update_node_color=1"); params.push("id=" + d.id_db); @@ -1896,7 +1897,7 @@ function show_menu(item, data) { icon: "interface_link_children", disabled: function() { if (enterprise_installed) { - if (data.type == 3) { + if (data.type == 3 || data.type == 2) { return true; } else { return false; @@ -1966,7 +1967,7 @@ function show_menu(item, data) { icon: "interface_link_parent", disabled: function() { if (enterprise_installed) { - if (data.type == 3) { + if (data.type == 3 || data.type == 2) { return true; } else { return false; @@ -2052,7 +2053,8 @@ function show_menu(item, data) { }; } - if (data.id_agent != -1) { + // Avoid deletion if Pandora FMS node. + if (data.type != 2) { items_list["delete"] = { name: delete_menu, icon: "delete", @@ -2291,26 +2293,25 @@ function add_interface_link_js() { cancel_set_parent_interface(); $("#dialog_interface_link").dialog("close"); - source_value = $("#interface_source_select").val(); - source_text = $("#interface_source_select") + var source_value = $("#interface_source_select").val(); + var source_text = $("#interface_source_select") .find("option:selected") .text(); - target_value = $("#interface_target_select").val(); - target_text = $("#interface_target_select") + var target_value = $("#interface_target_select").val(); + var target_text = $("#interface_target_select") .find("option:selected") .text(); - var params = []; - params.push("add_interface_relation=1"); - params.push("id=" + networkmap_id); - params.push("source_value=" + source_value); - params.push("target_value=" + target_value); - params.push("source_text=" + source_text); - params.push("target_text=" + target_text); - params.push("page=enterprise/operation/agentes/pandora_networkmap.view"); - jQuery.ajax({ - data: params.join("&"), + data: { + page: "enterprise/operation/agentes/pandora_networkmap.view", + add_interface_relation: 1, + id: networkmap_id, + source_value: source_value, + target_value: target_value, + source_text: source_text, + target_text: target_text + }, dataType: "json", type: "POST", url: "ajax.php", @@ -2326,8 +2327,9 @@ function add_interface_link_js() { if (data["type_source"] == 1) { temp_link["arrow_start"] = "module"; temp_link["id_module_start"] = source_value; - temp_link["status_start"] = data["status"]; - temp_link["link_color"] = data["status"] == "1" ? "#FC4444" : "#999"; + temp_link["status_start"] = data["status_start"]; + temp_link["link_color"] = + data["status_start"] == "1" ? "#FC4444" : "#999"; } else { temp_link["arrow_start"] = ""; temp_link["id_agent_start"] = source_value; @@ -2336,8 +2338,9 @@ function add_interface_link_js() { if (data["type_target"] == 1) { temp_link["arrow_end"] = "module"; temp_link["id_module_end"] = target_value; - temp_link["status_end"] = data["status"]; - temp_link["link_color"] = data["status"] == "1" ? "#FC4444" : "#999"; + temp_link["status_end"] = data["status_end"]; + temp_link["link_color"] = + data["status_end"] == "1" ? "#FC4444" : "#999"; } else { temp_link["arrow_end"] = ""; temp_link["id_agent_end"] = target_value; @@ -3474,6 +3477,7 @@ function draw_elements_graph() { } }), function(d) { + console.log(d); return ( d.source.id + networkmap_id + From 0cdf8a16cf1aa8ff8cc494708e54ea5e1653e0ba Mon Sep 17 00:00:00 2001 From: fbsanchez <fborja.sanchez@artica.es> Date: Mon, 25 Mar 2019 15:53:52 +0100 Subject: [PATCH 04/21] removed debug trace Former-commit-id: c9be9dfa635e45d50fdc908134e6f5cc65383c7e --- .../include/javascript/functions_pandora_networkmap.js | 1 - 1 file changed, 1 deletion(-) diff --git a/pandora_console/include/javascript/functions_pandora_networkmap.js b/pandora_console/include/javascript/functions_pandora_networkmap.js index f4326638ed..965d8ed460 100644 --- a/pandora_console/include/javascript/functions_pandora_networkmap.js +++ b/pandora_console/include/javascript/functions_pandora_networkmap.js @@ -3477,7 +3477,6 @@ function draw_elements_graph() { } }), function(d) { - console.log(d); return ( d.source.id + networkmap_id + From 1238f15190840d60407c98c05a2165a14778348b Mon Sep 17 00:00:00 2001 From: fbsanchez <fborja.sanchez@artica.es> Date: Mon, 25 Mar 2019 17:32:18 +0100 Subject: [PATCH 05/21] discovery task advanced summary support Former-commit-id: f9be116dbc2d9b07119794374319ea79a3343a81 --- pandora_console/extras/mr/26.sql | 2 + .../pandoradb_migrate_6.0_to_7.0.mysql.sql | 1 + .../functions_pandora_networkmap.js | 5 +- pandora_console/pandoradb.sql | 1 + .../lib/PandoraFMS/DiscoveryServer.pm | 12 +- pandora_server/lib/PandoraFMS/Recon/Base.pm | 319 ++++++++++-------- 6 files changed, 190 insertions(+), 150 deletions(-) diff --git a/pandora_console/extras/mr/26.sql b/pandora_console/extras/mr/26.sql index 24f177bbc2..d48f722f60 100644 --- a/pandora_console/extras/mr/26.sql +++ b/pandora_console/extras/mr/26.sql @@ -4,4 +4,6 @@ ALTER TABLE tagent_custom_fields ADD COLUMN `combo_values` VARCHAR(255) DEFAULT ALTER TABLE `treport_content` ADD COLUMN `show_extended_events` tinyint(1) default '0'; +ALTER TABLE `trecon_task` ADD COLUMN `summary` text; + COMMIT; diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 822134c54d..ce3c78126f 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -1411,6 +1411,7 @@ ALTER TABLE trecon_task ADD `vlan_enabled` int(2) unsigned default '0'; ALTER TABLE trecon_task ADD `wmi_enabled` tinyint(1) unsigned DEFAULT '0'; ALTER TABLE trecon_task ADD `auth_strings` text; ALTER TABLE trecon_task ADD `autoconfiguration_enabled` tinyint(1) unsigned default '0'; +ALTER TABLE trecon_task ADD `summary` text; -- --------------------------------------------------------------------- -- Table `twidget` AND Table `twidget_dashboard` diff --git a/pandora_console/include/javascript/functions_pandora_networkmap.js b/pandora_console/include/javascript/functions_pandora_networkmap.js index 965d8ed460..aa51275444 100644 --- a/pandora_console/include/javascript/functions_pandora_networkmap.js +++ b/pandora_console/include/javascript/functions_pandora_networkmap.js @@ -2599,8 +2599,9 @@ function proceed_to_restart_map() { type: "POST", url: "ajax.php", success: function(data) { - $("#restart_map_form").html(data); - $("#restart_map_form").dialog("open"); + $("#restart_map_form") + .html(data) + .dialog("open"); } }); } diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 01c5be088c..87a502753b 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -785,6 +785,7 @@ CREATE TABLE IF NOT EXISTS `trecon_task` ( `wmi_enabled` tinyint(1) unsigned DEFAULT '0', `auth_strings` text, `autoconfiguration_enabled` tinyint(1) unsigned default '0', + `summary` text, PRIMARY KEY (`id_rt`), KEY `recon_task_daemon` (`id_recon_server`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm index 6c4b3a5ad4..918f0bcc4a 100644 --- a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm +++ b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm @@ -834,7 +834,17 @@ sub PandoraFMS::Recon::Base::wmi_module { sub PandoraFMS::Recon::Base::update_progress ($$) { my ($self, $progress) = @_; - db_do ($self->{'dbh'}, 'UPDATE trecon_task SET utimestamp = ?, status = ? WHERE id_rt = ?', time (), $progress, $self->{'task_id'}); + my $stats = {}; + if (defined($self->{'summary'}) && $self->{'summary'} ne '') { + $stats->{'summary'} = $self->{'summary'}; + } + $stats->{'step'} = $self->{'step'}; + $stats->{'c_network_name'} = $self->{'c_network_name'}; + $stats->{'c_network_percent'} = $self->{'c_network_percent'}; + + # Store progress, last contact and overall status. + db_do ($self->{'dbh'}, 'UPDATE trecon_task SET utimestamp = ?, status = ?, summary = ? WHERE id_rt = ?', + time (), $progress, encode_json($stats), $self->{'task_id'}); } 1; diff --git a/pandora_server/lib/PandoraFMS/Recon/Base.pm b/pandora_server/lib/PandoraFMS/Recon/Base.pm index 45f5d87a27..393734bc85 100644 --- a/pandora_server/lib/PandoraFMS/Recon/Base.pm +++ b/pandora_server/lib/PandoraFMS/Recon/Base.pm @@ -15,6 +15,14 @@ use PandoraFMS::Recon::NmapParser; use PandoraFMS::Recon::Util; use Socket qw/inet_aton/; +# Constants. +use constant { + STEP_SCANNING => 1, + STEP_AFT => 2, + STEP_TRACEROUTE => 3, + STEP_GATEWAY => 4 +}; + # /dev/null my $DEVNULL = ($^O eq 'MSWin32') ? '/Nul' : '/dev/null'; @@ -47,33 +55,33 @@ our $SYSUPTIME = ".1.3.6.1.2.1.1.3"; our $VTPVLANIFINDEX = ".1.3.6.1.4.1.9.9.46.1.3.1.1.18.1"; our @ISA = ("Exporter"); -our %EXPORT_TAGS = ( 'all' => [ qw( ) ] ); +our %EXPORT_TAGS = ( 'all' => [qw( )] ); our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); our @EXPORT = qw( - $DOT1DBASEBRIDGEADDRESS - $DOT1DBASEPORTIFINDEX - $DOT1DTPFDBADDRESS - $DOT1DTPFDBPORT - $IFDESC - $IFHCINOCTECTS - $IFHCOUTOCTECTS - $IFINDEX - $IFINOCTECTS - $IFOPERSTATUS - $IFOUTOCTECTS - $IPADENTIFINDEX - $IPENTADDR - $IFNAME - $IPNETTOMEDIAPHYSADDRESS - $IFPHYSADDRESS - $IPADENTIFINDEX - $IPROUTEIFINDEX - $IPROUTENEXTHOP - $IPROUTETYPE - $PRTMARKERINDEX - $SYSDESCR - $SYSSERVICES - $SYSUPTIME + $DOT1DBASEBRIDGEADDRESS + $DOT1DBASEPORTIFINDEX + $DOT1DTPFDBADDRESS + $DOT1DTPFDBPORT + $IFDESC + $IFHCINOCTECTS + $IFHCOUTOCTECTS + $IFINDEX + $IFINOCTECTS + $IFOPERSTATUS + $IFOUTOCTECTS + $IPADENTIFINDEX + $IPENTADDR + $IFNAME + $IPNETTOMEDIAPHYSADDRESS + $IFPHYSADDRESS + $IPADENTIFINDEX + $IPROUTEIFINDEX + $IPROUTENEXTHOP + $IPROUTETYPE + $PRTMARKERINDEX + $SYSDESCR + $SYSSERVICES + $SYSUPTIME ); ####################################################################### @@ -167,6 +175,18 @@ sub new { snmp_version => 1, subnets => [], autoconfiguration_enabled => 0, + + # Store progress summary - Discovery progress view. + step => 0, + c_network_name => '', + c_network_percent => 0.0, + summary => { + SNMP => 0, + WMI => 0, + discovered => 0, + alive => 0, + not_alive => 0 + }, @_, }; @@ -176,25 +196,26 @@ sub new { # Check SNMP params id SNMP is enabled if ($self->{'snmp_enabled'}) { + # Check SNMP version - if ($self->{'snmp_version'} ne '1' && $self->{'snmp_version'} ne '2' - && $self->{'snmp_version'} ne '2c' && $self->{'snmp_version'} ne '3' - ) { + if ( $self->{'snmp_version'} ne '1' + && $self->{'snmp_version'} ne '2' + && $self->{'snmp_version'} ne '2c' + && $self->{'snmp_version'} ne '3') { $self->{'snmp_enabled'} = 0; $self->call('message', "SNMP version " . $self->{'snmp_version'} . " not supported (only 1, 2, 2c and 3).", 5); } # Check the version 3 parameters if ($self->{'snmp_version'} eq '3') { + # Fixed some vars $self->{'communities'} = []; # SNMP v3 checks - if ( - $self->{'snmp_security_level'} ne 'noAuthNoPriv' && - $self->{'snmp_security_level'} ne 'authNoPriv' && - $self->{'snmp_security_level'} ne 'authPriv' - ) { + if ( $self->{'snmp_security_level'} ne 'noAuthNoPriv' + &&$self->{'snmp_security_level'} ne 'authNoPriv' + &&$self->{'snmp_security_level'} ne 'authPriv') { $self->{'snmp_enabled'} = 0; $self->call('message', "Invalid SNMP security level " . $self->{'snmp_security_level'} . ".", 5); } @@ -207,6 +228,7 @@ sub new { $self->call('message', "Invalid SNMP authentication method " . $self->{'snmp_auth_method'} . ".", 5); } } else { + # Fixed some vars $self->{'snmp_auth_user'} = ''; $self->{'snmp_auth_pass'} = ''; @@ -296,6 +318,7 @@ sub aft_connectivity($$) { foreach my $mac ($self->snmp_get_value_array($switch, $DOT1DTPFDBADDRESS)) { push(@aft, parse_mac($mac)); } + # Search for matching entries. foreach my $aft_mac (@aft) { @@ -309,7 +332,7 @@ sub aft_connectivity($$) { # Get the interface associated to the port were we found the MAC address. my $switch_if_name = $self->get_if_from_aft($switch, $aft_mac); - next unless defined ($switch_if_name) and ($switch_if_name ne ''); + next unless defined($switch_if_name) and ($switch_if_name ne ''); # Do not connect a host to a switch twice using the same interface. # The switch is probably connected to another switch. @@ -342,8 +365,8 @@ sub are_connected($$$$$) { $if_1 = "ping" if $if_1 eq ''; $if_2 = "ping" if $if_2 eq ''; - if (defined($self->{'connections'}->{"${dev_1}\t${if_1}\t${dev_2}\t${if_2}"}) || - defined($self->{'connections'}->{"${dev_2}\t${if_2}\t${dev_1}\t${if_1}"})) { + if ( defined($self->{'connections'}->{"${dev_1}\t${if_1}\t${dev_2}\t${if_2}"}) + ||defined($self->{'connections'}->{"${dev_2}\t${if_2}\t${dev_1}\t${if_1}"})) { return 1; } @@ -367,19 +390,20 @@ sub snmp_discovery($$) { # Try to find the MAC with an ARP request. $self->get_mac_from_ip($device); - + # Check if the device responds to SNMP. if ($self->snmp_responds($device)) { - + $self->{'summary'}->{'SNMP'} += 1; + # Fill the VLAN cache. $self->find_vlans($device); - + # Guess the device type. $self->guess_device_type($device); - + # Find aliases for the device. $self->find_aliases($device); - + # Find interfaces for the device. $self->find_ifaces($device); @@ -655,12 +679,12 @@ sub get_if_from_ip($$$) { # Get the port associated to the IP address. my $if_index = $self->snmp_get_value($device, "$IPROUTEIFINDEX.$ip_addr"); - return '' unless defined ($if_index); + return '' unless defined($if_index); # Get the name of the interface associated to the port. my $if_name = $self->snmp_get_value($device, "$IFNAME.$if_index"); - return '' unless defined ($if_name); - + return '' unless defined($if_name); + $if_name =~ s/"//g; return $if_name; } @@ -686,12 +710,12 @@ sub get_if_from_mac($$$) { # Get the name of the interface associated to the port. my $if_name = $self->snmp_get_value($device, "$IFNAME.$if_index"); - return '' unless defined ($if_name); - + return '' unless defined($if_name); + $if_name =~ s/"//g; return $if_name; } - + return ''; } @@ -718,13 +742,13 @@ sub get_if_from_port($$$) { ######################################################################################## sub get_if_ip($$$) { my ($self, $device, $if_index) = @_; - + my @output = $self->snmp_get($device, $IPADENTIFINDEX); foreach my $line (@output) { - chomp ($line); + chomp($line); return $1 if ($line =~ m/^$IPADENTIFINDEX.(\S+)\s+=\s+\S+:\s+$if_index$/); } - + return ''; } @@ -748,7 +772,7 @@ sub get_if_mac($$$) { ######################################################################################## sub get_if_type($$$) { my ($self, $device, $if_index) = @_; - + my $type = $self->snmp_get_value($device, "$IFTYPE.$if_index"); return '' unless defined($type); @@ -769,7 +793,7 @@ sub get_ip_from_mac($$) { } ######################################################################################## -# Attemtps to find +# Attemtps to find ######################################################################################## sub get_mac_from_ip($$) { my ($self, $host) = @_; @@ -824,7 +848,7 @@ sub get_routes($) { } # Replace 0.0.0.0 with the default gateway's IP. - return unless defined ($self->{'default_gw'}); + return unless defined($self->{'default_gw'}); foreach my $route (@{$self->{'routes'}}) { $route->{gw} = $self->{'default_gw'} if ($route->{'gw'} eq '0.0.0.0'); } @@ -906,12 +930,15 @@ sub guess_device_type($$) { # L2? my $device_type; if ($service_bits[1] == 1) { + # L3? if ($service_bits[2] == 1) { + # Bridge MIB? if (defined($bridge_mib)) { $device_type = 'switch'; } else { + # L7? if ($service_bits[6] == 1) { $device_type = 'host'; @@ -919,8 +946,8 @@ sub guess_device_type($$) { $device_type = 'router'; } } - } - else { + }else { + # Bridge MIB? if (defined($bridge_mib)) { $device_type = 'switch'; @@ -928,14 +955,16 @@ sub guess_device_type($$) { $device_type = 'host'; } } - } - else { + }else { + # L3? if ($service_bits[2] == 1) { + # L4? if ($service_bits[3] == 1) { $device_type = 'switch'; } else { + # L7? if ($service_bits[6] == 1) { $device_type = 'host'; @@ -943,8 +972,8 @@ sub guess_device_type($$) { $device_type = 'router'; } } - } - else { + }else { + # Printer MIB? my $printer_mib = $self->snmp_get_value($device, $PRTMARKERINDEX); if (defined($printer_mib)) { @@ -1016,7 +1045,7 @@ sub is_switch_connected($$$) { # Check for aliases! $device = $self->{'aliases'}->{$device} if defined($self->{'aliases'}->{$device}); - return 1 if defined ($self->{'switch_to_switch'}->{"${device}\t${iface}"}); + return 1 if defined($self->{'switch_to_switch'}->{"${device}\t${iface}"}); return 0; } @@ -1069,8 +1098,8 @@ sub mark_connected($$;$$$) { } # Prevent parent-child loops. - if (!defined($self->{'parents'}->{$parent}) || - $self->{'parents'}->{$parent} ne $child) { + if (!defined($self->{'parents'}->{$parent}) + ||$self->{'parents'}->{$parent} ne $child) { # A parent-child relationship is always created to help complete the map with # layer 3 information. @@ -1097,8 +1126,10 @@ sub mark_switch_connected($$$) { sub mark_visited($$) { my ($self, $device) = @_; - $self->{'visited_devices'}->{$device} = { 'addr' => { $device => '' }, - 'type' => 'host' }; + $self->{'visited_devices'}->{$device} = { + 'addr' => { $device => '' }, + 'type' => 'host' + }; } ######################################################################################## @@ -1121,8 +1152,8 @@ sub snmp_responds($$) { return 1 if($self->is_snmp_discovered($device)); return ($self->{'snmp_version'} eq "3") - ? $self->snmp_responds_v3($device) - : $self->snmp_responds_v122c($device); + ? $self->snmp_responds_v3($device) + : $self->snmp_responds_v122c($device); } ######################################################################################## @@ -1221,11 +1252,7 @@ sub remote_arp($$) { ############################################################################## sub ping ($$$) { my ($self, $host) = @_; - my ($timeout, $retries, $packets) = ( - $self->{'icmp_timeout'}, - $self->{'icmp_checks'}, - 1, - ); + my ($timeout, $retries, $packets) = ($self->{'icmp_timeout'},$self->{'icmp_checks'},1,); # Windows if (($^O eq "MSWin32") || ($^O eq "MSWin32-x64") || ($^O eq "cygwin")){ @@ -1237,11 +1264,12 @@ sub ping ($$$) { return 0; } - + # Solaris if ($^O eq "solaris"){ my $ping_command = $host =~ /\d+:|:\d+/ ? "ping -A inet6" : "ping"; for (my $i = 0; $i < $retries; $i++) { + # Note: There is no timeout option. `$ping_command -s -n $host 56 $packets >/dev/null 2>&1`; return 1 if ($? == 0); @@ -1249,11 +1277,12 @@ sub ping ($$$) { return 0; } - + # FreeBSD if ($^O eq "freebsd"){ my $ping_command = $host =~ /\d+:|:\d+/ ? "ping6" : "ping -t $timeout"; for (my $i = 0; $i < $retries; $i++) { + # Note: There is no timeout option for ping6. `$ping_command -q -n -c $packets $host >/dev/null 2>&1`; return 1 if ($? == 0); @@ -1263,9 +1292,10 @@ sub ping ($$$) { } # NetBSD - if ($^O eq "netbsd"){ + if ($^O eq "netbsd"){ my $ping_command = $host =~ /\d+:|:\d+/ ? "ping6" : "ping -w $timeout"; for (my $i = 0; $i < $retries; $i++) { + # Note: There is no timeout option for ping6. `$ping_command -q -n -c $packets $host >/dev/null 2>&1`; if ($? == 0) { @@ -1275,11 +1305,11 @@ sub ping ($$$) { return 0; } - + # Assume Linux by default. my $ping_command = $host =~ /\d+:|:\d+/ ? "ping6" : "ping"; for (my $i = 0; $i < $retries; $i++) { - `$ping_command -q -W $timeout -n -c $packets $host >/dev/null 2>&1`; + `$ping_command -q -W $timeout -n -c $packets $host >/dev/null 2>&1`; return 1 if ($? == 0); } @@ -1295,11 +1325,13 @@ sub scan_subnet($) { my @subnets = @{$self->get_subnets()}; foreach my $subnet (@subnets) { + $self->{'c_network_percent'} = 0; + $self->{'c_network_name'} = $subnet; # Clean blanks. $subnet =~ s/\s+//g; - my $net_addr = new NetAddr::IP ($subnet); + my $net_addr = new NetAddr::IP($subnet); if (!defined($net_addr)) { $self->call('message', "Invalid network: $subnet", 3); next; @@ -1312,46 +1344,68 @@ sub scan_subnet($) { # fping scan. if (-x $self->{'fping'} && $net_addr->num() > 1) { $self->call('message', "Calling fping...", 5); - + my @hosts = `"$self->{'fping'}" -ga "$subnet" 2>DEVNULL`; next if (scalar(@hosts) == 0); - + + $self->{'summary'}->{'discovered'} += scalar(@hosts); + my $step = 50.0 / scalar(@subnets) / scalar(@hosts); # The first 50% of the recon task approx. + my $subnet_step = 100.0 / scalar(@hosts); foreach my $line (@hosts) { chomp($line); my @temp = split(/ /, $line); - next if (scalar(@temp) != 1); # Junk is shown for broadcast addresses. + if (scalar(@temp) != 1) { + + # Junk is shown for broadcast addresses. + # Increase summary.not_alive hosts. + $self->{'summary'}->{'not_alive'} += 1; + next; + } my $host = $temp[0]; # Skip network and broadcast addresses. next if ($host eq $network->addr() || $host eq $broadcast->addr()); - + + # Increase self summary.alive hosts. + $self->{'summary'}->{'alive'} += 1; $self->call('message', "Scanning host: $host", 5); $self->call('update_progress', ceil($progress)); $progress += $step; - + $self->{'c_network_percent'} += $subnet_step; + $self->snmp_discovery($host); # Add wmi scan if enabled. $self->wmi_scan($host) if ($self->{'wmi_enabled'} == 1); } } + # ping scan. else { my @hosts = map { (split('/', $_))[0] } $net_addr->hostenum; next if (scalar(@hosts) == 0); - + + $self->{'summary'}->{'discovered'} += scalar(@hosts); + my $step = 50.0 / scalar(@subnets) / scalar(@hosts); # The first 50% of the recon task approx. + my $subnet_step = 100.0 / scalar(@hosts); foreach my $host (@hosts) { - + $self->call('message', "Scanning host: $host", 5); $self->call('update_progress', ceil($progress)); $progress += $step; - + # Check if the host is up. - next if ($self->ping($host) == 0); - + if ($self->ping($host) == 0) { + $self->{'summary'}->{'not_alive'} += 1; + next; + } + + $self->{'summary'}->{'alive'} += 1; + $self->{'c_network_percent'} += $subnet_step; + $self->snmp_discovery($host); # Add wmi scan if enabled. @@ -1373,6 +1427,8 @@ sub scan($) { # Find devices. $self->call('message', "[1/5] Scanning the network...", 3); + $self->{'step'} = STEP_SCANNING; + $self->call('update_progress', $progress); $self->scan_subnet(); # Read the local ARP cache. @@ -1381,20 +1437,23 @@ sub scan($) { # Get a list of found hosts. my @hosts = @{$self->get_hosts()}; if (scalar(@hosts) > 0 && $self->{'parent_detection'} == 1) { - # Delete previous connections. + + # Delete previous connections. $self->call('delete_connections'); - + # Connectivity from address forwarding tables. $self->call('message', "[1/4] Finding address forwarding table connectivity...", 3); + $self->{'step'} = STEP_AFT; ($progress, $step) = (50, 20.0 / scalar(@hosts)); # From 50% to 70%. for (my $i = 0; defined($hosts[$i]); $i++) { $self->call('update_progress', $progress); $progress += $step; $self->aft_connectivity($hosts[$i]); } - + # Connect hosts that are still unconnected using traceroute. $self->call('message', "[3/4] Finding traceroute connectivity.", 3); + $self->{'step'} = STEP_TRACEROUTE; ($progress, $step) = (70, 20.0 / scalar(@hosts)); # From 70% to 90%. foreach my $host (@hosts) { $self->call('update_progress', $progress); @@ -1402,9 +1461,10 @@ sub scan($) { next if ($self->has_parent($host) || $self->has_children($host)); $self->traceroute_connectivity($host); } - + # Connect hosts that are still unconnected using known gateways. $self->call('message', "[4/4] Finding host to gateway connectivity.", 3); + $self->{'step'} = STEP_GATEWAY; ($progress, $step) = (90, 10.0 / scalar(@hosts)); # From 70% to 90%. $self->get_routes(); # Update the route cache. foreach my $host (@hosts) { @@ -1416,8 +1476,9 @@ sub scan($) { } # Done! + $self->{'step'} = ''; $self->call('update_progress', -1); - + # Print debug information on found devices. $self->call('message', "[Summary]", 3); foreach my $host (@hosts) { @@ -1425,7 +1486,7 @@ sub scan($) { next unless defined($device); # Print device information. - my $dev_info = "Device: " . $device->{'type'} . " ("; + my $dev_info = "Device: " . $device->{'type'} . " ("; foreach my $ip_address ($self->get_addresses($host)) { $dev_info .= "$ip_address,"; } @@ -1473,8 +1534,8 @@ sub snmp_get($$$) { if (scalar(@vlans) == 0) { my $command = $self->snmp_get_command($device, $oid, $community); @output = `$command`; - } - else { + }else { + # Handle duplicate lines. my %output_hash; foreach my $vlan (@vlans) { @@ -1528,7 +1589,7 @@ sub snmp_get_value($$$) { my @output = $self->snmp_get($device, $oid); foreach my $line (@output) { - chomp ($line); + chomp($line); return $1 if ($line =~ /^$oid\s+=\s+\S+:\s+(.*)$/); } @@ -1544,7 +1605,7 @@ sub snmp_get_value_array($$$) { my @output = $self->snmp_get($device, $oid); foreach my $line (@output) { - chomp ($line); + chomp($line); push(@values, $1) if ($line =~ /^$oid\S*\s+=\s+\S+:\s+(.*)$/); } @@ -1575,22 +1636,20 @@ sub traceroute_connectivity($$) { # Perform a traceroute. my $nmap_args = '-nsP -PE --traceroute --max-retries '.$self->{'icmp_checks'}.' --host-timeout '.$self->{'icmp_timeout'}.'s -T'.$self->{'recon_timing_template'}; my $np = PandoraFMS::Recon::NmapParser->new(); - eval { - $np->parsescan($self->{'nmap'}, $nmap_args, ($host)); - }; + eval {$np->parsescan($self->{'nmap'}, $nmap_args, ($host));}; return if ($@); - + # Get hops to the host. - my ($h) = $np->all_hosts (); - return unless defined ($h); - my @hops = $h->all_trace_hops (); + my ($h) = $np->all_hosts(); + return unless defined($h); + my @hops = $h->all_trace_hops(); # Skip the target host. pop(@hops); - + # Reverse the host order (closest hosts first). @hops = reverse(@hops); - + # Look for parents. my $device = $host; for (my $i = 0; $i < $self->{'parent_recursion'}; $i++) { @@ -1601,7 +1660,7 @@ sub traceroute_connectivity($$) { $self->call('create_agent', $parent); $self->call('message', "Host $device is one hop away from host $parent.", 5); - $self->mark_connected($parent, '', $device, ''); + $self->mark_connected($parent, '', $device, ''); # Move on to the next hop. $device = $parent; @@ -1643,7 +1702,10 @@ sub wmi_scan { my $auth = $self->responds_to_wmi($target); return unless defined($auth); + $self->{'summary'}->{'WMI'} += 1; + $self->call('message', "[".$target."] WMI available.", 10); + # Create the agent if it does not exist. my $agent_id = $self->call('create_agent', $target); next unless defined($agent_id); @@ -1651,56 +1713,19 @@ sub wmi_scan { # CPU. my @cpus = $self->wmi_get_value_array($target, $auth, 'SELECT DeviceId FROM Win32_Processor', 0); foreach my $cpu (@cpus) { - $self->call( - 'wmi_module', - ( - $agent_id, - $target, - "SELECT LoadPercentage FROM Win32_Processor WHERE DeviceId='$cpu'", - $auth, - 1, - "CPU Load $cpu", - "Load for $cpu (%)", - 'generic_data' - ) - ); + $self->call('wmi_module',($agent_id,$target,"SELECT LoadPercentage FROM Win32_Processor WHERE DeviceId='$cpu'",$auth,1,"CPU Load $cpu","Load for $cpu (%)",'generic_data')); } # Memory. my $mem = $self->wmi_get_value($target, $auth, 'SELECT FreePhysicalMemory FROM Win32_OperatingSystem', 0); if (defined($mem)) { - $self->call('wmi_module', - ( - $agent_id, - $target, - "SELECT FreePhysicalMemory, TotalVisibleMemorySize FROM Win32_OperatingSystem", - $auth, - 0, - 'FreeMemory', - 'Free memory', - 'generic_data', - 'KB' - ) - ); + $self->call('wmi_module',($agent_id,$target,"SELECT FreePhysicalMemory, TotalVisibleMemorySize FROM Win32_OperatingSystem",$auth,0,'FreeMemory','Free memory','generic_data','KB')); } # Disk. my @units = $self->wmi_get_value_array($target, $auth, 'SELECT DeviceID FROM Win32_LogicalDisk', 0); foreach my $unit (@units) { - $self->call( - 'wmi_module', - ( - $agent_id, - $target, - "SELECT FreeSpace FROM Win32_LogicalDisk WHERE DeviceID='$unit'", - $auth, - 1, - "FreeDisk $unit", - 'Available disk space in kilobytes', - 'generic_data', - 'KB' - ) - ); + $self->call('wmi_module',($agent_id,$target,"SELECT FreeSpace FROM Win32_LogicalDisk WHERE DeviceID='$unit'",$auth,1,"FreeDisk $unit",'Available disk space in kilobytes','generic_data','KB')); } } From 6cc6f6f125cb89c1532602985da32f99861774f5 Mon Sep 17 00:00:00 2001 From: fbsanchez <fborja.sanchez@artica.es> Date: Mon, 25 Mar 2019 19:58:01 +0100 Subject: [PATCH 06/21] discovery task status overview Former-commit-id: 329d03c109b9e09788302212752f372647b19c56 --- .../include/ajax/task_list.ajax.php | 126 +++++++++++++----- pandora_console/include/constants.php | 6 + 2 files changed, 99 insertions(+), 33 deletions(-) diff --git a/pandora_console/include/ajax/task_list.ajax.php b/pandora_console/include/ajax/task_list.ajax.php index d6bf652d21..c280e13d87 100644 --- a/pandora_console/include/ajax/task_list.ajax.php +++ b/pandora_console/include/ajax/task_list.ajax.php @@ -34,30 +34,63 @@ $showmap = (bool) get_parameter('showmap', 0); if ($progress_task_discovery) { $id_task = get_parameter('id', 0); - if ($id_task !== 0) { - $result = ''; - $result .= '<ul class="progress_task_discovery">'; - $result .= '<li><h1>'._('Overall Progress').'</h1></li>'; - $result .= '<li>'; - $result .= d3_progress_bar( - $id_task, - 90, - 460, - 30, - '#EA5434', - '%', - '', - '#FFFFFF', - 0, - 0 - ); + if ($id_task <= 0) { + echo json_encode(['error' => true]); + return; + } + + $task = db_get_row('trecon_task', 'id_rt', $id_task); + $global_progress = $task['status']; + $summary = json_decode($task['summary'], true); + + $result = ''; + $result .= '<ul class="progress_task_discovery">'; + $result .= '<li><h1>'._('Overall Progress').'</h1></li>'; + $result .= '<li>'; + $result .= d3_progress_bar( + $id_task, + ($global_progress < 0) ? 100 : $global_progress, + 460, + 30, + '#EA5434', + '%', + '', + '#FFFFFF', + 0, + 0 + ); + + if ($global_progress > 0) { + switch ($summary['step']) { + case STEP_SCANNING: + $str = __('Scanning the network'); + break; + + case STEP_AFT: + $str = __('Finding AFT connectivity'); + break; + + case STEP_TRACEROUTE: + $str = __('Finding traceroute connectivity'); + break; + + case STEP_GATEWAY: + $str = __('Finding gateway connectivity'); + break; + + default: + $str = __('Searching for devices...'); + break; + } $result .= '</li>'; - $result .= '<li><h1>'.__('Searching devices in').' red a scanear</h1></li>'; + $result .= '<li><h1>'.$str.' '; + $result .= $summary['c_network_name']; + $result .= '</h1></li>'; $result .= '<li>'; $result .= d3_progress_bar( - $id_task.'_2', - 30, + $id_task.'_detail', + $summary['c_network_percent'], 460, 30, '#2751E1', @@ -67,22 +100,49 @@ if ($progress_task_discovery) { 0, 0 ); - $result .= '</li>'; - $result .= '<li><h1>'.__('Summary').'</h1></li>'; - $result .= '<li><span><b>'.__('Estimated').'</b>: total de host</span></li>'; - $result .= '<li><span><b>'.__('Discovered').'</b>: total de agentes</span></li>'; - $result .= '<li><span><b>'.__('Not alive/Not found').'</b>: total de agentes 1-2</span></li>'; - $result .= '</ul>'; - - echo $result; - } else { - // Error. - ui_print_error_message( - __('Please, select task') - ); } + $result .= '</ul>'; + + $i = 0; + $table = new StdClasS(); + $table->class = 'databox data'; + $table->width = '75%'; + $table->styleTable = 'margin: 2em auto;border: 1px solid #ddd;background: white;'; + $table->rowid = []; + $table->data = []; + + // Content. + $table->data[$i][0] = '<b>'.__('Hosts discovered').'</b>'; + $table->data[$i][1] = '<span id="discovered">'; + $table->data[$i][1] .= $summary['summary']['discovered']; + $table->data[$i++][1] .= '</span>'; + + $table->data[$i][0] = '<b>'.__('Alive').'</b>'; + $table->data[$i][1] = '<span id="alive">'; + $table->data[$i][1] .= $summary['summary']['alive']; + $table->data[$i++][1] .= '</span>'; + + $table->data[$i][0] = '<b>'.__('Not alive').'</b>'; + $table->data[$i][1] = '<span id="not_alive">'; + $table->data[$i][1] .= $summary['summary']['not_alive']; + $table->data[$i++][1] .= '</span>'; + + $table->data[$i][0] = '<b>'.__('Responding SNMP').'</b>'; + $table->data[$i][1] = '<span id="SNMP">'; + $table->data[$i][1] .= $summary['summary']['SNMP']; + $table->data[$i++][1] .= '</span>'; + + $table->data[$i][0] = '<b>'.__('Responding WMI').'</b>'; + $table->data[$i][1] = '<span id="WMI">'; + $table->data[$i][1] .= $summary['summary']['WMI']; + $table->data[$i++][1] .= '</span>'; + + $result .= html_print_table($table, true); + + echo $result; + return; } diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index 12f4d8f1fa..ea18c90d3f 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -514,6 +514,12 @@ define('OPTION_COLOR_PICKER', 11); define('NODE_TYPE', 0); define('ARROW_TYPE', 1); +// Discovery task steps. +define('STEP_SCANNING', 1); +define('STEP_AFT', 2); +define('STEP_TRACEROUTE', 3); +define('STEP_GATEWAY', 4); + // Networkmap node types. define('NODE_AGENT', 0); define('NODE_MODULE', 1); From 3d0f25cd6e5a7479f85d6976638454c4845d6f8d Mon Sep 17 00:00:00 2001 From: fbsanchez <fborja.sanchez@artica.es> Date: Mon, 25 Mar 2019 20:00:05 +0100 Subject: [PATCH 07/21] discovery task status overview Former-commit-id: 5eeb3a3220c05f30f0559d50620aa29389fb145c --- pandora_console/include/ajax/task_list.ajax.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/ajax/task_list.ajax.php b/pandora_console/include/ajax/task_list.ajax.php index c280e13d87..5fd7e7f1bd 100644 --- a/pandora_console/include/ajax/task_list.ajax.php +++ b/pandora_console/include/ajax/task_list.ajax.php @@ -63,7 +63,7 @@ if ($progress_task_discovery) { if ($global_progress > 0) { switch ($summary['step']) { case STEP_SCANNING: - $str = __('Scanning the network'); + $str = __('Scanning network'); break; case STEP_AFT: From 4031ae9bf717832d60cfcb3b67be37270fc16ebc Mon Sep 17 00:00:00 2001 From: fbsanchez <fborja.sanchez@artica.es> Date: Mon, 25 Mar 2019 20:23:07 +0100 Subject: [PATCH 08/21] minor update in notification viewer Former-commit-id: 990993ee0c2df7d9fb39a358b94c27b7df968426 --- pandora_console/include/styles/pandora.css | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 6631a5dc48..59fa94c8e8 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -4420,6 +4420,10 @@ div#dialog_messages table th:last-child { font-weight: bold; } +.notification-ball.notification-ball-new-messages:hover { + box-shadow: 0 0 3px #888; +} + .notification-ball-no-messages { background-color: #82b92e; cursor: pointer; @@ -4433,7 +4437,7 @@ div#dialog_messages table th:last-child { border: #a5a5a5 solid 1px; z-index: 900000; position: absolute; - width: 400px; + width: 550px; margin-top: -5px; border-radius: 5px; } @@ -4447,8 +4451,7 @@ div#dialog_messages table th:last-child { border-width: 12px; border-style: solid; bottom: 100%; - left: 78%; - left: calc(78% - 2px); + left: calc(58% - 7px); margin-left: -12px; border-bottom-color: white; } From d05b78520f50ad6ccc08238aca788d616f9bf461 Mon Sep 17 00:00:00 2001 From: fbsanchez <fborja.sanchez@artica.es> Date: Tue, 26 Mar 2019 11:09:17 +0100 Subject: [PATCH 09/21] minor style fix tasklist popup Former-commit-id: 628e94f56a92558e3af648520ca13d4fb658d184 --- pandora_console/include/ajax/task_list.ajax.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/ajax/task_list.ajax.php b/pandora_console/include/ajax/task_list.ajax.php index 5fd7e7f1bd..46c8340a98 100644 --- a/pandora_console/include/ajax/task_list.ajax.php +++ b/pandora_console/include/ajax/task_list.ajax.php @@ -109,7 +109,7 @@ if ($progress_task_discovery) { $table = new StdClasS(); $table->class = 'databox data'; $table->width = '75%'; - $table->styleTable = 'margin: 2em auto;border: 1px solid #ddd;background: white;'; + $table->styleTable = 'margin: 2em auto 0;border: 1px solid #ddd;background: white;'; $table->rowid = []; $table->data = []; From e3b0b7ad1136425665e00f9ccf88ac8b1d8f6980 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin <daniel.barbero@artica.es> Date: Tue, 26 Mar 2019 15:38:47 +0100 Subject: [PATCH 10/21] fixed update progress bars task for 3 second Former-commit-id: 7558c33e8540007608f7afd97ebf03e193a08def --- .../wizards/DiscoveryTaskList.class.php | 13 +- .../include/ajax/task_list.ajax.php | 10 +- .../include/graphs/functions_d3.php | 4 +- pandora_console/include/graphs/pandora.d3.js | 25 ++-- .../include/javascript/pandora_taskList.js | 116 ++++++++++++------ 5 files changed, 112 insertions(+), 56 deletions(-) diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index 2cedd211d4..d5d970a502 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -432,7 +432,7 @@ class DiscoveryTaskList extends Wizard // Name task. $data[1] = ''; if ($task['disabled'] != 2) { - $data[1] .= '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\',\''.$url_ajax.'\')">'; + $data[1] .= '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">'; } $data[1] .= '<b>'.$task['name'].'</b>'; @@ -503,7 +503,7 @@ class DiscoveryTaskList extends Wizard } if ($task['disabled'] != 2) { - $data[9] = '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\',\''.$url_ajax.'\')">'; + $data[9] = '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">'; $data[9] .= html_print_image( 'images/eye.png', true @@ -512,7 +512,7 @@ class DiscoveryTaskList extends Wizard } if ($task['disabled'] != 2 && $task['utimestamp'] > 0) { - $data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\',\''.$url_ajax.'\')">'; + $data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">'; $data[9] .= html_print_image( 'images/dynamic_network_icon.png', true @@ -565,6 +565,9 @@ class DiscoveryTaskList extends Wizard $data[9] = ''; } + // Div neccesary for modal progress task. + echo '<div id="progress_task_'.$task['id_rt'].'" style="display:none"></div>'; + array_push($table->data, $data); } @@ -576,8 +579,8 @@ class DiscoveryTaskList extends Wizard html_print_table($table); } - // Div neccesary for modal progress task. - echo '<div id="progress_task" style="display:none"></div>'; + // Div neccesary for modal map task. + echo '<div id="map_task" style="display:none"></div>'; unset($table); diff --git a/pandora_console/include/ajax/task_list.ajax.php b/pandora_console/include/ajax/task_list.ajax.php index 46c8340a98..353083390a 100644 --- a/pandora_console/include/ajax/task_list.ajax.php +++ b/pandora_console/include/ajax/task_list.ajax.php @@ -43,7 +43,7 @@ if ($progress_task_discovery) { $global_progress = $task['status']; $summary = json_decode($task['summary'], true); - $result = ''; + $result = '<div id = progress_task_'.$id_task.'>'; $result .= '<ul class="progress_task_discovery">'; $result .= '<li><h1>'._('Overall Progress').'</h1></li>'; $result .= '<li>'; @@ -57,6 +57,7 @@ if ($progress_task_discovery) { '', '#FFFFFF', 0, + 0, 0 ); @@ -98,6 +99,7 @@ if ($progress_task_discovery) { '', '#FFFFFF', 0, + 0, 0 ); $result .= '</li>'; @@ -139,10 +141,12 @@ if ($progress_task_discovery) { $table->data[$i][1] .= $summary['summary']['WMI']; $table->data[$i++][1] .= '</span>'; - $result .= html_print_table($table, true); + $result .= html_print_table($table, true).'</div>'; - echo $result; + $result_array['status'] = $global_progress; + $result_array['html'] = $result; + echo json_encode($result_array); return; } diff --git a/pandora_console/include/graphs/functions_d3.php b/pandora_console/include/graphs/functions_d3.php index cc8ffea667..5ce06e982f 100644 --- a/pandora_console/include/graphs/functions_d3.php +++ b/pandora_console/include/graphs/functions_d3.php @@ -364,7 +364,8 @@ function d3_progress_bar( $text='', $fill_color='#FFFFFF', $radiusx=10, - $radiusy=10 + $radiusy=10, + $transition=1 ) { global $config; @@ -387,6 +388,7 @@ function d3_progress_bar( '".$fill_color."', ".(int) $radiusx.', '.(int) $radiusy.', + '.(int) $transition.' ); </script>'; diff --git a/pandora_console/include/graphs/pandora.d3.js b/pandora_console/include/graphs/pandora.d3.js index 5501d92f6f..51dae061ec 100644 --- a/pandora_console/include/graphs/pandora.d3.js +++ b/pandora_console/include/graphs/pandora.d3.js @@ -1784,7 +1784,8 @@ function progress_bar_d3( label, label_color, radiusx, - radiusy + radiusy, + transition ) { var startPercent = 0; var endPercent = parseInt(percentile) / 100; @@ -1844,17 +1845,21 @@ function progress_bar_d3( progress_front.attr("width", width * bar_progress); } - var bar_progress = startPercent; - - (function loops() { + if (transition == 0) { + var bar_progress = endPercent; updateProgress(bar_progress); + } else { + var bar_progress = startPercent; + (function loops() { + updateProgress(bar_progress); - if (count > 0) { - count--; - bar_progress += step; - setTimeout(loops, 30); - } - })(); + if (count > 0) { + count--; + bar_progress += step; + setTimeout(loops, 30); + } + })(); + } } function progress_bubble_d3( diff --git a/pandora_console/include/javascript/pandora_taskList.js b/pandora_console/include/javascript/pandora_taskList.js index dc6fd13208..270fec67a0 100644 --- a/pandora_console/include/javascript/pandora_taskList.js +++ b/pandora_console/include/javascript/pandora_taskList.js @@ -1,44 +1,82 @@ -/** - * - * @param {*} id - * @param {*} name - */ -function progress_task_list(id, name, url) { - var params = []; - params.push("page=include/ajax/task_list.ajax"); - params.push("progress_task_discovery=1"); - params.push("id=" + id); +/* + global $ + global jQuery +*/ - jQuery.ajax({ - data: params.join("&"), +/** + * Function for create modal with progress task + * and recalculate 3 second. + * @param {int} id + * @param {string} name + */ +function progress_task_list(id, title) { + var timeoutRef = null; + var xhr = null; + var $elem = $("#progress_task_" + id); + + $elem + .hide() + .empty() + .dialog({ + title: title, + draggable: true, + modal: false, + width: 600, + height: 420, + close: function() { + if (xhr != null) xhr.abort(); + if (timeoutRef != null) clearTimeout(timeoutRef); + } + }); + + // Function var. + var handleFetchTaskList = function(err, data) { + if (err) { + // TODO: Show info about the problem. + } + + if (data.status > 0) { + $elem.html(data.html); + if (!$elem.dialog("isOpen")) $elem.dialog("open"); + } + + if (data.status != -1) { + timeoutRef = setTimeout(function() { + xhr = fetchTaskList(id, handleFetchTaskList); + }, 3000); + } + }; + + xhr = fetchTaskList(id, handleFetchTaskList); +} + +/** + * Function that performs ajax request to return + * the progress of the task. + * @param {int} id Id task. + * @param {function} callback Function callback. + */ +function fetchTaskList(id, callback) { + return jQuery.ajax({ + data: { + page: "include/ajax/task_list.ajax", + progress_task_discovery: 1, + id: id + }, type: "POST", - url: (action = url), - dataType: "html", + url: "ajax.php", + dataType: "json", success: function(data) { - $("#progress_task") - .hide() - .empty() - .append(data) - .dialog({ - title: "Task: " + name, - resizable: true, - draggable: true, - modal: false, - width: 600, - height: 400 - }) - .show(); + callback(null, data); + }, + error: function() { + callback(new Error("cannot fetch the list")); } }); } -function show_map(id, name, url) { - var params = []; - params.push("page=include/ajax/task_list.ajax"); - params.push("showmap=1"); - params.push("id=" + id); - - $("#progress_task") +function show_map(id, name) { + $("#map_task") .empty() .hide() .append("<p>Loading map</p>") @@ -53,12 +91,16 @@ function show_map(id, name, url) { .show(); jQuery.ajax({ - data: params.join("&"), + data: { + page: "include/ajax/task_list.ajax", + showmap: 1, + id: id + }, type: "POST", - url: (action = url), + url: "ajax.php", dataType: "html", success: function(data) { - $("#progress_task") + $("#map_task") .empty() .append(data); } From ec999341ba5ff5aa9b8916218c20ff370b762b7f Mon Sep 17 00:00:00 2001 From: alejandro-campos <alejandro.campos@artica.es> Date: Tue, 26 Mar 2019 15:42:33 +0100 Subject: [PATCH 11/21] change discovery headers and add breadcrumbs to them Former-commit-id: 93183474aabaeccfd3893cacd78c4d6ddf764502 --- pandora_console/godmode/servers/discovery.php | 3 -- .../wizards/DiscoveryTaskList.class.php | 3 +- .../godmode/wizards/HostDevices.class.php | 4 +- .../godmode/wizards/Wizard.main.php | 24 ++++++++--- .../include/class/CustomNetScan.class.php | 9 +++- .../class/ManageNetScanScripts.class.php | 5 ++- pandora_console/include/functions_ui.php | 14 ++++-- pandora_console/include/styles/discovery.css | 43 ++++++++++++++----- pandora_console/include/styles/pandora.css | 28 ++++++++++++ 9 files changed, 104 insertions(+), 29 deletions(-) diff --git a/pandora_console/godmode/servers/discovery.php b/pandora_console/godmode/servers/discovery.php index 46ee2f8979..d617d92fdf 100755 --- a/pandora_console/godmode/servers/discovery.php +++ b/pandora_console/godmode/servers/discovery.php @@ -15,9 +15,6 @@ if (! check_acl($config['id_user'], 0, 'AW')) { ui_require_css_file('discovery'); -ui_print_page_header(__('Discovery'), '', false, '', true); - - /** * Mask class names. * diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index 2cedd211d4..5b1102826d 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -96,7 +96,8 @@ class DiscoveryTaskList extends Wizard ] ); - $this->printHeader(); + // Header + ui_print_page_header(__('Task list'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); // Show redirected messages from discovery.php. if ($status === 0) { diff --git a/pandora_console/godmode/wizards/HostDevices.class.php b/pandora_console/godmode/wizards/HostDevices.class.php index f0e8325459..54d2d4fcd8 100755 --- a/pandora_console/godmode/wizards/HostDevices.class.php +++ b/pandora_console/godmode/wizards/HostDevices.class.php @@ -152,7 +152,7 @@ class HostDevices extends Wizard ] ); - $this->printHeader(); + ui_print_page_header(__('Host & devices'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); $this->printBigButtonsList($buttons); return; @@ -527,7 +527,7 @@ class HostDevices extends Wizard if ($this->page < $this->maxPagesNetScan) { // Avoid to print header out of wizard. $this->prepareBreadcrum($breadcrum); - $this->printHeader(); + ui_print_page_header(__('NetScan definition'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); } if (isset($this->page) === true diff --git a/pandora_console/godmode/wizards/Wizard.main.php b/pandora_console/godmode/wizards/Wizard.main.php index 7a1a5916aa..fde2b411c0 100644 --- a/pandora_console/godmode/wizards/Wizard.main.php +++ b/pandora_console/godmode/wizards/Wizard.main.php @@ -196,20 +196,34 @@ class Wizard * * @return void */ - public function prepareBreadcrum(array $urls, bool $add=false) + public function prepareBreadcrum(array $urls, bool $add=false, bool $separator_beginning=false) { $bc = []; $i = 0; + $count = 0; + $array_size = count($urls); + foreach ($urls as $url) { + $count++; + if ($url['selected'] == 1) { $class = 'selected'; } else { $class = ''; } - $bc[$i] = '<a href="'.$url['link'].'" class="text_color">'; - $bc[$i] .= '<div class="arrow_box '.$class.'">'.$url['label']; - $bc[$i++] .= '</div></a>'; + $bc[$i] = ''; + + if ($separator_beginning === true) $bc[$i] .= '<span class="breadcrumb_link"> / </span>'; + + $bc[$i] .= '<span><a class="breadcrumb_link '.$class.'" href="'.$url['link'].'">'; + $bc[$i] .= $url['label']; + $bc[$i] .= '</a>'; + if ($count < $array_size) $bc[$i] .= '<span class="breadcrumb_link"> / </span>'; + + $bc[$i] .= '</span>'; + + $i++; } if ($add === true) { @@ -257,7 +271,7 @@ class Wizard */ public function printBreadcrum() { - return '<h1 class="wizard">'.implode('', $this->breadcrum).'</h1>'; + return implode('', $this->breadcrum); } diff --git a/pandora_console/include/class/CustomNetScan.class.php b/pandora_console/include/class/CustomNetScan.class.php index a0f8af019d..182a80109e 100644 --- a/pandora_console/include/class/CustomNetScan.class.php +++ b/pandora_console/include/class/CustomNetScan.class.php @@ -353,7 +353,10 @@ class CustomNetScan extends Wizard if ($this->page < $this->MAXPAGES) { // Avoid to print header out of wizard. $this->prepareBreadcrum($breadcrum); - $this->printHeader(); + + // Header + ui_print_page_header(__('NetScan Custom definition'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); + } $task_url = ''; @@ -376,7 +379,9 @@ class CustomNetScan extends Wizard if ($this->page < $this->maxPagesNetScan) { // Avoid to print header out of wizard. $this->prepareBreadcrum($breadcrum); - $this->printHeader(); + + // Header + ui_print_page_header(__('NetScan Custom definition'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); } if (isset($this->page) === true diff --git a/pandora_console/include/class/ManageNetScanScripts.class.php b/pandora_console/include/class/ManageNetScanScripts.class.php index 377259478a..9a84f7a71f 100644 --- a/pandora_console/include/class/ManageNetScanScripts.class.php +++ b/pandora_console/include/class/ManageNetScanScripts.class.php @@ -108,7 +108,10 @@ class ManageNetScanScripts extends Wizard if ($this->page < $this->MAXPAGES) { // Avoid to print header out of wizard. $this->prepareBreadcrum($breadcrum); - $this->printHeader(); + + // Header + ui_print_page_header(__('List net scan scripts'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); + } $id_script = get_parameter('id_script', 0); diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index eee8138e1e..ad16bfc7d5 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -2768,7 +2768,8 @@ function ui_print_page_header( $modal=false, $message='', $numChars=GENERIC_SIZE_TEXT, - $alias='' + $alias='', + $breadcrumbs='' ) { $title = io_safe_input_html($title); if (($icon == '') && ($godmode == true)) { @@ -2781,15 +2782,20 @@ function ui_print_page_header( if ($godmode == true) { $type = 'view'; - $type2 = 'menu_tab_frame_view'; + $type2 = (empty($breadcrumbs)) ? 'menu_tab_frame_view' : 'menu_tab_frame_view_bc'; $separator_class = 'separator'; } else { $type = 'view'; - $type2 = 'menu_tab_frame_view'; + $type2 = (empty($breadcrumbs)) ? 'menu_tab_frame_view' : 'menu_tab_frame_view_bc'; $separator_class = 'separator_view'; } - $buffer = '<div id="'.$type2.'" style=""><div id="menu_tab_left">'; + $buffer = '<div id="'.$type2.'" style="">'; + + if (!empty($breadcrumbs)) + $buffer .= '<div class="breadcrumbs_container">'.$breadcrumbs.'</div>'; + + $buffer .= '<div id="menu_tab_left">'; $buffer .= '<ul class="mn"><li class="'.$type.'">'; diff --git a/pandora_console/include/styles/discovery.css b/pandora_console/include/styles/discovery.css index 6df2fee323..b851999f9a 100644 --- a/pandora_console/include/styles/discovery.css +++ b/pandora_console/include/styles/discovery.css @@ -64,7 +64,6 @@ h1.wizard a:hover { div.arrow_box { display: inline-block; position: relative; - background: #ccc; color: #888; padding: 1.3em; margin-left: 20px; @@ -72,16 +71,6 @@ div.arrow_box { padding-left: 3em; } -.arrow_box:before { - top: 50%; - border: solid transparent; - content: " "; - height: 0; - width: 0; - position: absolute; - pointer-events: none; - z-index: 1; -} .arrow_box.selected { background: #424242; color: #ccc; @@ -110,3 +99,35 @@ div.arrow_box:before { .arrow_box:hover { color: #000; } +.breadcrumb_link { + color: #d0d0d0; + font-size: 12pt !important; + font-family: "Open Sans", sans-serif !important; + text-decoration: none !important; +} + +span.breadcrumb_link { + color: #d0d0d0; + font-size: 12pt !important; +} + +.breadcrumb_link.selected { + color: #95b750; +} + +.breadcrumb_link.selected:hover { + color: #95b750; +} +.breadcrumb_link:hover { + color: #95b750; +} + +.form_grid_items { + overflow: hidden; +} +.form_grid_items .form_grid_item { + float: left; + box-sizing: border-box; + padding: 10px; +} + diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 59fa94c8e8..9ea2d02c03 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -1272,6 +1272,34 @@ div.title_line { box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1); } +#menu_tab_frame_view_bc { + display: flex; + justify-content: space-between; + border-bottom: 2px solid #82b92e; + max-height: 70px; + min-height: 50px; + width: 100%; + padding-right: 0px; + margin-left: 0px !important; + margin-bottom: 20px; + height: 70px; + box-sizing: border-box; + background-color: #fff; + border-top-right-radius: 7px; + border-top-left-radius: 7px; + box-shadow: 1px 1px 8px rgba(0, 0, 0, 0.1); + flex-direction: column; +} + +#menu_tab_frame_view_bc .breadcrumbs_container { + align-self: flex-start; +} + +.breadcrumbs_container { + padding-left: 10px; + padding-top: 4px; +} + #menu_tab { margin-right: 10px; } From a0f4eb1910d9ccf6f9b43535b9af251a5a81d355 Mon Sep 17 00:00:00 2001 From: alejandro-campos <alejandro.campos@artica.es> Date: Tue, 26 Mar 2019 16:10:03 +0100 Subject: [PATCH 12/21] change discovery page title Former-commit-id: 81bf2dc3d489acc1871f6c4cd385fc0f1c1b43aa --- pandora_console/godmode/wizards/HostDevices.class.php | 2 +- pandora_console/include/class/CustomNetScan.class.php | 4 ++-- pandora_console/include/class/ManageNetScanScripts.class.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pandora_console/godmode/wizards/HostDevices.class.php b/pandora_console/godmode/wizards/HostDevices.class.php index 54d2d4fcd8..8fd7f6a60e 100755 --- a/pandora_console/godmode/wizards/HostDevices.class.php +++ b/pandora_console/godmode/wizards/HostDevices.class.php @@ -527,7 +527,7 @@ class HostDevices extends Wizard if ($this->page < $this->maxPagesNetScan) { // Avoid to print header out of wizard. $this->prepareBreadcrum($breadcrum); - ui_print_page_header(__('NetScan definition'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); + ui_print_page_header(__('NetScan'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); } if (isset($this->page) === true diff --git a/pandora_console/include/class/CustomNetScan.class.php b/pandora_console/include/class/CustomNetScan.class.php index 182a80109e..a758789721 100644 --- a/pandora_console/include/class/CustomNetScan.class.php +++ b/pandora_console/include/class/CustomNetScan.class.php @@ -355,7 +355,7 @@ class CustomNetScan extends Wizard $this->prepareBreadcrum($breadcrum); // Header - ui_print_page_header(__('NetScan Custom definition'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); + ui_print_page_header(__('NetScan Custom'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); } @@ -381,7 +381,7 @@ class CustomNetScan extends Wizard $this->prepareBreadcrum($breadcrum); // Header - ui_print_page_header(__('NetScan Custom definition'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); + ui_print_page_header(__('NetScan Custom'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); } if (isset($this->page) === true diff --git a/pandora_console/include/class/ManageNetScanScripts.class.php b/pandora_console/include/class/ManageNetScanScripts.class.php index 9a84f7a71f..7c7ed8c9c9 100644 --- a/pandora_console/include/class/ManageNetScanScripts.class.php +++ b/pandora_console/include/class/ManageNetScanScripts.class.php @@ -108,9 +108,9 @@ class ManageNetScanScripts extends Wizard if ($this->page < $this->MAXPAGES) { // Avoid to print header out of wizard. $this->prepareBreadcrum($breadcrum); - + // Header - ui_print_page_header(__('List net scan scripts'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); + ui_print_page_header(__('Net scan scripts'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); } From 2d1463ee0c5d9496277c240a4b527aae0c6f2bd6 Mon Sep 17 00:00:00 2001 From: fbsanchez <fborja.sanchez@artica.es> Date: Tue, 26 Mar 2019 16:46:32 +0100 Subject: [PATCH 13/21] minor fixes networkmaps Former-commit-id: 85dda0470280e1f0cf142f7393f1492c61f42c6b --- pandora_console/include/class/NetworkMap.class.php | 13 +++++++------ .../javascript/functions_pandora_networkmap.js | 4 ++++ .../operation/agentes/pandora_networkmap.editor.php | 10 ++++++++-- .../operation/agentes/pandora_networkmap.php | 5 ++++- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php index 4d166e9e0c..6598f309e8 100644 --- a/pandora_console/include/class/NetworkMap.class.php +++ b/pandora_console/include/class/NetworkMap.class.php @@ -585,10 +585,6 @@ class NetworkMap $this->idGroup = $this->map['id_group']; switch ($this->map['source']) { - case SOURCE_GROUP: - $this->idGroup = $this->map['source_data']; - break; - case SOURCE_TASK: $this->idTask = $this->map['source_data']; break; @@ -597,6 +593,8 @@ class NetworkMap $this->network = $this->map['source_data']; break; + case SOURCE_GROUP: + // Already load. default: // Ignore. break; @@ -753,7 +751,9 @@ class NetworkMap // Empty map returns no data. $nodes = []; } else { - if ($this->mapOptions['map_filter']['dont_show_subgroups'] == 'true') { + if ($this->mapOptions['map_filter']['dont_show_subgroups'] == 'true' + || $this->mapOptions['map_filter']['dont_show_subgroups'] == 1 + ) { // Show only current selected group. $filter['id_grupo'] = $this->idGroup; } else { @@ -3226,7 +3226,8 @@ class NetworkMap enterprise_installed: enterprise_installed, node_radius: node_radius, holding_area_dimensions: networkmap_holding_area_dimensions, - url_background_grid: url_background_grid + url_background_grid: url_background_grid, + font_size: '.$this->mapOptions['font_size'].' }); init_drag_and_drop(); init_minimap(); diff --git a/pandora_console/include/javascript/functions_pandora_networkmap.js b/pandora_console/include/javascript/functions_pandora_networkmap.js index aa51275444..596dc2e299 100644 --- a/pandora_console/include/javascript/functions_pandora_networkmap.js +++ b/pandora_console/include/javascript/functions_pandora_networkmap.js @@ -3968,6 +3968,10 @@ function draw_elements_graph() { var font_size = node_radius / 1.5; + if (self.font_size) { + font_size = self.font_size; + } + node_temp .append("text") .attr("class", "node_text") diff --git a/pandora_console/operation/agentes/pandora_networkmap.editor.php b/pandora_console/operation/agentes/pandora_networkmap.editor.php index 0633f19070..d0bdbd57ca 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.editor.php +++ b/pandora_console/operation/agentes/pandora_networkmap.editor.php @@ -53,7 +53,7 @@ if ($new_networkmap) { $recon_task_id = 0; $source = 'group'; $ip_mask = ''; - $dont_show_subgroups = false; + $dont_show_subgroups = 0; $offset_x = ''; $offset_y = ''; $scale_z = 0.5; @@ -330,7 +330,13 @@ if ($not_found) { $table->data['source_data_ip_mask'][1] = html_print_input_text('ip_mask', $ip_mask, '', 20, 255, true, $disabled_source); $table->data['source_data_dont_show_subgroups'][0] = __('Don\'t show subgroups:'); - $table->data['source_data_dont_show_subgroups'][1] = html_print_checkbox('dont_show_subgroups', '1', $dont_show_subgroups, true, $disabled_source); + $table->data['source_data_dont_show_subgroups'][1] = html_print_checkbox( + 'dont_show_subgroups', + '1', + $dont_show_subgroups, + true, + $disabled_source + ); $methods = [ 'twopi' => 'radial', diff --git a/pandora_console/operation/agentes/pandora_networkmap.php b/pandora_console/operation/agentes/pandora_networkmap.php index 53d6278c00..9efde3fa6f 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.php +++ b/pandora_console/operation/agentes/pandora_networkmap.php @@ -76,7 +76,10 @@ if (enterprise_installed()) { $method = (string) get_parameter('method', 'fdp'); - $dont_show_subgroups = 0; + $dont_show_subgroups = (int) get_parameter_checkbox( + 'dont_show_subgroups', + 0 + ); $node_radius = (int) get_parameter('node_radius', 40); $description = get_parameter('description', ''); From a76ad27825e3f03106e9bc53fcbe8ee90eb4edcf Mon Sep 17 00:00:00 2001 From: fbsanchez <fborja.sanchez@artica.es> Date: Tue, 26 Mar 2019 16:51:09 +0100 Subject: [PATCH 14/21] minor fixes Former-commit-id: f885316b4f063daac744ca458fa3d41a16d5d81b --- .../include/javascript/functions_pandora_networkmap.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/javascript/functions_pandora_networkmap.js b/pandora_console/include/javascript/functions_pandora_networkmap.js index 596dc2e299..54a53bb5fb 100644 --- a/pandora_console/include/javascript/functions_pandora_networkmap.js +++ b/pandora_console/include/javascript/functions_pandora_networkmap.js @@ -2956,6 +2956,10 @@ function init_graph(parameter_object) { $(window).height() - $("#menu_tab_frame_view").height() - 20; // 20 of margin } + if (typeof parameter_object.font_size != "undefined") { + window.font_size = parameter_object.font_size; + } + window.refresh_period = 5 * 1000; //milliseconds if (typeof parameter_object.refresh_period != "undefined") { window.refresh_period = parameter_object.refresh_period; @@ -3968,8 +3972,8 @@ function draw_elements_graph() { var font_size = node_radius / 1.5; - if (self.font_size) { - font_size = self.font_size; + if (typeof window.font_size != "undefined") { + font_size = window.font_size; } node_temp From ee6ab43a8c244b01711165f7dd7feb84b8f650db Mon Sep 17 00:00:00 2001 From: fbsanchez <fborja.sanchez@artica.es> Date: Tue, 26 Mar 2019 16:54:11 +0100 Subject: [PATCH 15/21] minor fix Former-commit-id: e1a238bd34f4264e6be9c8a826cc1057578dd0a7 --- .../operation/agentes/pandora_networkmap.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pandora_console/operation/agentes/pandora_networkmap.php b/pandora_console/operation/agentes/pandora_networkmap.php index 9efde3fa6f..86c9c5bbee 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.php +++ b/pandora_console/operation/agentes/pandora_networkmap.php @@ -171,7 +171,10 @@ if (enterprise_installed()) { $description = get_parameter('description', ''); $values['description'] = $description; - $dont_show_subgroups = 0; + $dont_show_subgroups = (int) get_parameter_checkbox( + 'dont_show_subgroups', + 0 + ); $node_radius = (int) get_parameter('node_radius', 40); $row = db_get_row('tmap', 'id', $id); $filter = json_decode($row['filter'], true); @@ -250,7 +253,10 @@ if ($new_networkmap || $save_networkmap) { '' ); $source = (string) get_parameter('source', 'group'); - $dont_show_subgroups = (int) get_parameter('dont_show_subgroups', 0); + $dont_show_subgroups = (int) get_parameter_checkbox( + 'dont_show_subgroups', + 0 + ); $node_radius = (int) get_parameter('node_radius', 40); $description = get_parameter('description', ''); From 3316d19bd392d19b85fb1d884009507deb553912 Mon Sep 17 00:00:00 2001 From: fbsanchez <fborja.sanchez@artica.es> Date: Tue, 26 Mar 2019 17:00:20 +0100 Subject: [PATCH 16/21] minor fix Former-commit-id: ff5da555c29cdde5d632e090f2b9ac779ead262f --- pandora_console/include/class/NetworkMap.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php index 6598f309e8..25a50d9b7b 100644 --- a/pandora_console/include/class/NetworkMap.class.php +++ b/pandora_console/include/class/NetworkMap.class.php @@ -751,7 +751,7 @@ class NetworkMap // Empty map returns no data. $nodes = []; } else { - if ($this->mapOptions['map_filter']['dont_show_subgroups'] == 'true' + if ($this->mapOptions['map_filter']['dont_show_subgroups'] === 'true' || $this->mapOptions['map_filter']['dont_show_subgroups'] == 1 ) { // Show only current selected group. From db39c3921bc3a35a95ccdece4f0e2ca918078f41 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin <daniel.barbero@artica.es> Date: Tue, 26 Mar 2019 17:22:14 +0100 Subject: [PATCH 17/21] fixed minor error tasklist Former-commit-id: 1ee10794b09e17c3b8403dfe5540195047595577 --- .../include/ajax/task_list.ajax.php | 181 +++++++++--------- .../include/javascript/pandora_taskList.js | 6 +- 2 files changed, 97 insertions(+), 90 deletions(-) diff --git a/pandora_console/include/ajax/task_list.ajax.php b/pandora_console/include/ajax/task_list.ajax.php index 353083390a..33dc3e6b5f 100644 --- a/pandora_console/include/ajax/task_list.ajax.php +++ b/pandora_console/include/ajax/task_list.ajax.php @@ -44,57 +44,16 @@ if ($progress_task_discovery) { $summary = json_decode($task['summary'], true); $result = '<div id = progress_task_'.$id_task.'>'; - $result .= '<ul class="progress_task_discovery">'; - $result .= '<li><h1>'._('Overall Progress').'</h1></li>'; - $result .= '<li>'; - $result .= d3_progress_bar( - $id_task, - ($global_progress < 0) ? 100 : $global_progress, - 460, - 30, - '#EA5434', - '%', - '', - '#FFFFFF', - 0, - 0, - 0 - ); - - if ($global_progress > 0) { - switch ($summary['step']) { - case STEP_SCANNING: - $str = __('Scanning network'); - break; - - case STEP_AFT: - $str = __('Finding AFT connectivity'); - break; - - case STEP_TRACEROUTE: - $str = __('Finding traceroute connectivity'); - break; - - case STEP_GATEWAY: - $str = __('Finding gateway connectivity'); - break; - - default: - $str = __('Searching for devices...'); - break; - } - - $result .= '</li>'; - $result .= '<li><h1>'.$str.' '; - $result .= $summary['c_network_name']; - $result .= '</h1></li>'; + if ($task['utimestamp']) { + $result .= '<ul class="progress_task_discovery">'; + $result .= '<li><h1>'._('Overall Progress').'</h1></li>'; $result .= '<li>'; $result .= d3_progress_bar( - $id_task.'_detail', - $summary['c_network_percent'], + $id_task, + ($global_progress < 0) ? 100 : $global_progress, 460, 30, - '#2751E1', + '#EA5434', '%', '', '#FFFFFF', @@ -102,47 +61,97 @@ if ($progress_task_discovery) { 0, 0 ); - $result .= '</li>'; + + if ($global_progress > 0) { + switch ($summary['step']) { + case STEP_SCANNING: + $str = __('Scanning network'); + break; + + case STEP_AFT: + $str = __('Finding AFT connectivity'); + break; + + case STEP_TRACEROUTE: + $str = __('Finding traceroute connectivity'); + break; + + case STEP_GATEWAY: + $str = __('Finding gateway connectivity'); + break; + + default: + $str = __('Searching for devices...'); + break; + } + + $result .= '</li>'; + $result .= '<li><h1>'.$str.' '; + $result .= $summary['c_network_name']; + $result .= '</h1></li>'; + $result .= '<li>'; + $result .= d3_progress_bar( + $id_task.'_detail', + $summary['c_network_percent'], + 460, + 30, + '#2751E1', + '%', + '', + '#FFFFFF', + 0, + 0, + 0 + ); + $result .= '</li>'; + } + + $result .= '</ul>'; + + $i = 0; + $table = new StdClasS(); + $table->class = 'databox data'; + $table->width = '75%'; + $table->styleTable = 'margin: 2em auto 0;border: 1px solid #ddd;background: white;'; + $table->rowid = []; + $table->data = []; + + // Content. + $table->data[$i][0] = '<b>'.__('Hosts discovered').'</b>'; + $table->data[$i][1] = '<span id="discovered">'; + $table->data[$i][1] .= $summary['summary']['discovered']; + $table->data[$i++][1] .= '</span>'; + + $table->data[$i][0] = '<b>'.__('Alive').'</b>'; + $table->data[$i][1] = '<span id="alive">'; + $table->data[$i][1] .= $summary['summary']['alive']; + $table->data[$i++][1] .= '</span>'; + + $table->data[$i][0] = '<b>'.__('Not alive').'</b>'; + $table->data[$i][1] = '<span id="not_alive">'; + $table->data[$i][1] .= $summary['summary']['not_alive']; + $table->data[$i++][1] .= '</span>'; + + $table->data[$i][0] = '<b>'.__('Responding SNMP').'</b>'; + $table->data[$i][1] = '<span id="SNMP">'; + $table->data[$i][1] .= $summary['summary']['SNMP']; + $table->data[$i++][1] .= '</span>'; + + $table->data[$i][0] = '<b>'.__('Responding WMI').'</b>'; + $table->data[$i][1] = '<span id="WMI">'; + $table->data[$i][1] .= $summary['summary']['WMI']; + $table->data[$i++][1] .= '</span>'; + + $result .= html_print_table($table, true).'</div>'; + } else { + $global_progress = -1; + $result .= ui_print_error_message( + __('No data to show'), + '', + true + ).'</div>'; } - $result .= '</ul>'; - - $i = 0; - $table = new StdClasS(); - $table->class = 'databox data'; - $table->width = '75%'; - $table->styleTable = 'margin: 2em auto 0;border: 1px solid #ddd;background: white;'; - $table->rowid = []; - $table->data = []; - - // Content. - $table->data[$i][0] = '<b>'.__('Hosts discovered').'</b>'; - $table->data[$i][1] = '<span id="discovered">'; - $table->data[$i][1] .= $summary['summary']['discovered']; - $table->data[$i++][1] .= '</span>'; - - $table->data[$i][0] = '<b>'.__('Alive').'</b>'; - $table->data[$i][1] = '<span id="alive">'; - $table->data[$i][1] .= $summary['summary']['alive']; - $table->data[$i++][1] .= '</span>'; - - $table->data[$i][0] = '<b>'.__('Not alive').'</b>'; - $table->data[$i][1] = '<span id="not_alive">'; - $table->data[$i][1] .= $summary['summary']['not_alive']; - $table->data[$i++][1] .= '</span>'; - - $table->data[$i][0] = '<b>'.__('Responding SNMP').'</b>'; - $table->data[$i][1] = '<span id="SNMP">'; - $table->data[$i][1] .= $summary['summary']['SNMP']; - $table->data[$i++][1] .= '</span>'; - - $table->data[$i][0] = '<b>'.__('Responding WMI').'</b>'; - $table->data[$i][1] = '<span id="WMI">'; - $table->data[$i][1] .= $summary['summary']['WMI']; - $table->data[$i++][1] .= '</span>'; - - $result .= html_print_table($table, true).'</div>'; - $result_array['status'] = $global_progress; $result_array['html'] = $result; diff --git a/pandora_console/include/javascript/pandora_taskList.js b/pandora_console/include/javascript/pandora_taskList.js index 270fec67a0..f151c9003a 100644 --- a/pandora_console/include/javascript/pandora_taskList.js +++ b/pandora_console/include/javascript/pandora_taskList.js @@ -35,10 +35,8 @@ function progress_task_list(id, title) { // TODO: Show info about the problem. } - if (data.status > 0) { - $elem.html(data.html); - if (!$elem.dialog("isOpen")) $elem.dialog("open"); - } + $elem.html(data.html); + if (!$elem.dialog("isOpen")) $elem.dialog("open"); if (data.status != -1) { timeoutRef = setTimeout(function() { From 08a240746c5e07706c04dd74411457949d577937 Mon Sep 17 00:00:00 2001 From: fbsanchez <fborja.sanchez@artica.es> Date: Tue, 26 Mar 2019 17:28:31 +0100 Subject: [PATCH 18/21] breadcrum improvement discovery Former-commit-id: af861b0601e50dbe45ed1cab77ce5ab6f26d3fad --- .../godmode/wizards/HostDevices.class.php | 12 +++++++++--- .../include/class/CustomNetScan.class.php | 13 +++++++++---- .../include/class/ManageNetScanScripts.class.php | 13 +++++++++---- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/pandora_console/godmode/wizards/HostDevices.class.php b/pandora_console/godmode/wizards/HostDevices.class.php index 8fd7f6a60e..e4e0e97fdc 100755 --- a/pandora_console/godmode/wizards/HostDevices.class.php +++ b/pandora_console/godmode/wizards/HostDevices.class.php @@ -512,9 +512,15 @@ class HostDevices extends Wizard $task_url = '&task='.$this->task['id_rt']; } - $breadcrum[] = [ - 'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd', - 'label' => __($this->label), + $breadcrum = [ + [ + 'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery', + 'label' => 'Discovery', + ], + [ + 'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd', + 'label' => __($this->label), + ], ]; for ($i = 0; $i < $this->maxPagesNetScan; $i++) { $breadcrum[] = [ diff --git a/pandora_console/include/class/CustomNetScan.class.php b/pandora_console/include/class/CustomNetScan.class.php index a758789721..7477594637 100644 --- a/pandora_console/include/class/CustomNetScan.class.php +++ b/pandora_console/include/class/CustomNetScan.class.php @@ -337,9 +337,15 @@ class CustomNetScan extends Wizard $task_url = '&task='.$this->task['id_rt']; } - $breadcrum[] = [ - 'link' => $run_url.'&wiz=hd', - 'label' => __('Host & Devices'), + $breadcrum = [ + [ + 'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery', + 'label' => 'Discovery', + ], + [ + 'link' => $run_url.'&wiz=hd', + 'label' => __('Host & Devices'), + ], ]; for ($i = 0; $i < $this->MAXPAGES; $i++) { @@ -356,7 +362,6 @@ class CustomNetScan extends Wizard // Header ui_print_page_header(__('NetScan Custom'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); - } $task_url = ''; diff --git a/pandora_console/include/class/ManageNetScanScripts.class.php b/pandora_console/include/class/ManageNetScanScripts.class.php index 7c7ed8c9c9..f3ca4c92b5 100644 --- a/pandora_console/include/class/ManageNetScanScripts.class.php +++ b/pandora_console/include/class/ManageNetScanScripts.class.php @@ -92,9 +92,15 @@ class ManageNetScanScripts extends Wizard $run_url = 'index.php?sec=gservers&sec2=godmode/servers/discovery'; - $breadcrum[] = [ - 'link' => $run_url.'&wiz=hd', - 'label' => __('Host & Devices'), + $breadcrum = [ + [ + 'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery', + 'label' => 'Discovery', + ], + [ + 'link' => $run_url.'&wiz=hd', + 'label' => __('Host & Devices'), + ], ]; for ($i = 0; $i < $this->MAXPAGES; $i++) { @@ -111,7 +117,6 @@ class ManageNetScanScripts extends Wizard // Header ui_print_page_header(__('Net scan scripts'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); - } $id_script = get_parameter('id_script', 0); From ba0ddfb8260c90c90853597a2368b329b4e72df5 Mon Sep 17 00:00:00 2001 From: fbsanchez <fborja.sanchez@artica.es> Date: Tue, 26 Mar 2019 19:29:48 +0100 Subject: [PATCH 19/21] style revission Former-commit-id: d223662de64194115cf56264ceda987e732eb79a --- .../general/firts_task/collections.php | 2 +- .../general/firts_task/custom_fields.php | 2 +- .../general/firts_task/custom_graphs.php | 2 +- .../general/firts_task/fields_manager.php | 2 +- .../general/firts_task/incidents.php | 2 +- .../general/firts_task/map_builder.php | 2 +- .../general/firts_task/network_map.php | 2 +- .../general/firts_task/planned_downtime.php | 2 +- .../general/firts_task/recon_view.php | 2 +- .../general/firts_task/service_list.php | 2 +- .../general/firts_task/snmp_filters.php | 2 +- pandora_console/general/firts_task/tags.php | 2 +- .../general/firts_task/transactional_list.php | 2 +- pandora_console/general/login_page.php | 6 +-- pandora_console/include/functions_menu.php | 26 ++++++--- pandora_console/include/styles/discovery.css | 41 ++++++++++++-- pandora_console/include/styles/firts_task.css | 1 + pandora_console/include/styles/menu.css | 20 ++++--- pandora_console/include/styles/pandora.css | 53 +++++-------------- pandora_console/operation/menu.php | 5 -- 20 files changed, 95 insertions(+), 83 deletions(-) diff --git a/pandora_console/general/firts_task/collections.php b/pandora_console/general/firts_task/collections.php index 269de3ba12..8e27ce6ee3 100755 --- a/pandora_console/general/firts_task/collections.php +++ b/pandora_console/general/firts_task/collections.php @@ -22,7 +22,7 @@ ui_require_css_file('firts_task'); <?php echo html_print_image('images/icono_grande_reconserver.png', true, ['title' => __('Collections')]); ?> </div> <div class="text_task"> - <h3> <?php echo __('Create Collections'); ?> <p id="description_task"> + <h3> <?php echo __('Create Collections'); ?></h3><p id="description_task"> <?php echo __( "A file collection is a group of files (e.g. scripts or executables) which are diff --git a/pandora_console/general/firts_task/custom_fields.php b/pandora_console/general/firts_task/custom_fields.php index da5b30f274..7d07ff9495 100644 --- a/pandora_console/general/firts_task/custom_fields.php +++ b/pandora_console/general/firts_task/custom_fields.php @@ -24,7 +24,7 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no custom <?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Custom Fields')]); ?> </div> <div class="text_task"> - <h3> <?php echo __('Create Custom Fields'); ?> <p id="description_task"> + <h3> <?php echo __('Create Custom Fields'); ?></h3><p id="description_task"> <?php echo __( "Custom fields are an easy way to personalized agent's information. diff --git a/pandora_console/general/firts_task/custom_graphs.php b/pandora_console/general/firts_task/custom_graphs.php index 80d64300aa..e22187c6f5 100644 --- a/pandora_console/general/firts_task/custom_graphs.php +++ b/pandora_console/general/firts_task/custom_graphs.php @@ -24,7 +24,7 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no custom <?php echo html_print_image('images/firts_task/icono_grande_custom_reporting.png', true, ['title' => __('Custom Graphs')]); ?> </div> <div class="text_task"> - <h3> <?php echo __('Create Custom Graph'); ?> <p id="description_task"> + <h3> <?php echo __('Create Custom Graph'); ?></h3><p id="description_task"> <?php echo __( "Graphs are designed to show the data collected by %s in a temporary scale defined by the user. diff --git a/pandora_console/general/firts_task/fields_manager.php b/pandora_console/general/firts_task/fields_manager.php index db2b3ee0c2..f81de216db 100755 --- a/pandora_console/general/firts_task/fields_manager.php +++ b/pandora_console/general/firts_task/fields_manager.php @@ -22,7 +22,7 @@ ui_require_css_file('firts_task'); <?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Fields Manager')]); ?> </div> <div class="text_task"> - <h3> <?php echo __('Create Fields Manager'); ?> <p id="description_task"> + <h3> <?php echo __('Create Fields Manager'); ?></h3><p id="description_task"> <?php echo __( "Custom fields are an easy way to personalized agent's information. diff --git a/pandora_console/general/firts_task/incidents.php b/pandora_console/general/firts_task/incidents.php index a8acde2829..daa83588e3 100644 --- a/pandora_console/general/firts_task/incidents.php +++ b/pandora_console/general/firts_task/incidents.php @@ -28,7 +28,7 @@ if ($incident_w || $incident_m) { <?php echo html_print_image('images/firts_task/icono_grande_incidencia.png', true, ['title' => __('Incidents')]); ?> </div> <div class="text_task"> - <h3> <?php echo __('Create Incidents'); ?> <p id="description_task"> + <h3> <?php echo __('Create Incidents'); ?></h3><p id="description_task"> <?php echo __( "Besides receiving and processing data to monitor systems or applications, diff --git a/pandora_console/general/firts_task/map_builder.php b/pandora_console/general/firts_task/map_builder.php index b6a5a147a9..352f7374e5 100755 --- a/pandora_console/general/firts_task/map_builder.php +++ b/pandora_console/general/firts_task/map_builder.php @@ -31,7 +31,7 @@ if ($vconsoles_write || $vconsoles_manage) { <?php echo html_print_image('images/firts_task/icono_grande_visualconsole.png', true, ['title' => __('Visual Console')]); ?> </div> <div class="text_task"> - <h3> <?php echo __('Create Visual Console'); ?> <p id="description_task"> + <h3> <?php echo __('Create Visual Console'); ?></h3><p id="description_task"> <?php echo __( '%s allows users to create visual maps on which each user is able to create his or her '.'own monitoring map. The new visual console editor is much more practical, although the prior '."visual console editor had its advantages. On the new visual console, we've been successful in "."imitating the sensation and touch of a drawing application like GIMP. We've also simplified the "."editor by dividing it into several subject-divided tabs named 'Data', 'Preview', 'Wizard', 'List of "."Elements' and 'Editor'. The items the %s Visual Map was designed to handle are "."'static images', 'percentage bars', 'module graphs' and 'simple values'.", diff --git a/pandora_console/general/firts_task/network_map.php b/pandora_console/general/firts_task/network_map.php index bdf0cb38f6..0526f936aa 100755 --- a/pandora_console/general/firts_task/network_map.php +++ b/pandora_console/general/firts_task/network_map.php @@ -26,7 +26,7 @@ $networkmap_types = networkmap_get_types($strict_user); <?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Network Map')]); ?> </div> <div class="text_task"> - <h3> <?php echo __('Create Network Map'); ?> <p id="description_task"> + <h3> <?php echo __('Create Network Map'); ?></h3><p id="description_task"> <?php echo __( 'There is also an open-source version of the network map. diff --git a/pandora_console/general/firts_task/planned_downtime.php b/pandora_console/general/firts_task/planned_downtime.php index a2499bd3c1..dcd98fdebb 100644 --- a/pandora_console/general/firts_task/planned_downtime.php +++ b/pandora_console/general/firts_task/planned_downtime.php @@ -22,7 +22,7 @@ ui_require_css_file('firts_task'); <?php echo html_print_image('images/firts_task/icono_grande_visualconsole.png', true, ['title' => __('Planned Downtime')]); ?> </div> <div class="text_task"> - <h3> <?php echo __('Create Planned Downtime'); ?> <p id="description_task"> + <h3> <?php echo __('Create Planned Downtime'); ?></h3><p id="description_task"> <?php echo __( "%s contains a scheduled downtime management system. diff --git a/pandora_console/general/firts_task/recon_view.php b/pandora_console/general/firts_task/recon_view.php index 2377ce7c20..282a6b75be 100755 --- a/pandora_console/general/firts_task/recon_view.php +++ b/pandora_console/general/firts_task/recon_view.php @@ -22,7 +22,7 @@ ui_require_css_file('firts_task'); <?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Discovery server')]); ?> </div> <div class="text_task"> - <h3> <?php echo __('Create Discovery Task'); ?><p id="description_task"> + <h3> <?php echo __('Create Discovery Task'); ?></h3><p id="description_task"> <?php echo __( 'Discovery Task are used to find new elements in the network. diff --git a/pandora_console/general/firts_task/service_list.php b/pandora_console/general/firts_task/service_list.php index f3971ca786..424bc60400 100755 --- a/pandora_console/general/firts_task/service_list.php +++ b/pandora_console/general/firts_task/service_list.php @@ -25,7 +25,7 @@ ui_require_css_file('firts_task'); <?php echo html_print_image('images/firts_task/icono_grande_servicios.png', true, ['title' => __('Services')]); ?> </div> <div class="text_task"> - <h3> <?php echo __('Create Services'); ?> <p id="description_task"> + <h3> <?php echo __('Create Services'); ?></h3><p id="description_task"> <?php echo __( "A service is a way to group your IT resources based on their functionalities. diff --git a/pandora_console/general/firts_task/snmp_filters.php b/pandora_console/general/firts_task/snmp_filters.php index 8b1795505a..602702da69 100755 --- a/pandora_console/general/firts_task/snmp_filters.php +++ b/pandora_console/general/firts_task/snmp_filters.php @@ -22,7 +22,7 @@ ui_require_css_file('firts_task'); <?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('SNMP Filter')]); ?> </div> <div class="text_task"> - <h3> <?php echo __('Create SNMP Filter'); ?> <p id="description_task"> + <h3> <?php echo __('Create SNMP Filter'); ?></h3><p id="description_task"> <?php echo __( "Some systems receive a high number of traps. diff --git a/pandora_console/general/firts_task/tags.php b/pandora_console/general/firts_task/tags.php index bbf77c5d2a..38c006d3b2 100755 --- a/pandora_console/general/firts_task/tags.php +++ b/pandora_console/general/firts_task/tags.php @@ -22,7 +22,7 @@ ui_require_css_file('firts_task'); <?php echo html_print_image('images/firts_task/icono_grande_gestiondetags.png', true, ['title' => __('Tags')]); ?> </div> <div class="text_task"> - <h3> <?php echo __('Create Tags'); ?> <p id="description_task"> + <h3> <?php echo __('Create Tags'); ?></h3><p id="description_task"> <?php echo __( "Access to modules can be configured by a tagging system. diff --git a/pandora_console/general/firts_task/transactional_list.php b/pandora_console/general/firts_task/transactional_list.php index 74066fe7bf..6edc964ad7 100644 --- a/pandora_console/general/firts_task/transactional_list.php +++ b/pandora_console/general/firts_task/transactional_list.php @@ -28,7 +28,7 @@ if ($networkmaps_write || $networkmaps_manage) { <?php echo html_print_image('images/firts_task/icono_grande_topology.png', true, ['title' => __('Transactions')]); ?> </div> <div class="text_task"> - <h3> <?php echo __('Create Transactions'); ?> <p id="description_task"> + <h3> <?php echo __('Create Transactions'); ?></h3><p id="description_task"> <?php echo __( 'The new transactional server allows you to execute tasks dependent on the others following a user-defined design. This means that it is possible to coordinate several executions to check a target at a given time. diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php index ea73318e2a..d8e28223c6 100755 --- a/pandora_console/general/login_page.php +++ b/pandora_console/general/login_page.php @@ -305,12 +305,12 @@ if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) { echo '<div class ="img_banner_login">'; if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) { if (isset($config['custom_splash_login'])) { - html_print_image('enterprise/images/custom_splash_login/'.$config['custom_splash_login'], false, [ 'alt' => 'splash', 'border' => 0, 'title' => $splash_title], false, true); + html_print_image('enterprise/images/custom_splash_login/'.$config['custom_splash_login'], false, [ 'alt' => 'splash', 'border' => 0], false, true); } else { - html_print_image('enterprise/images/custom_splash_login/splash_image_default.png', false, ['alt' => 'logo', 'border' => 0, 'title' => $splash_title], false, true); + html_print_image('enterprise/images/custom_splash_login/splash_image_default.png', false, ['alt' => 'logo', 'border' => 0], false, true); } } else { - html_print_image('images/splash_image_default.png', false, ['alt' => 'logo', 'border' => 0, 'title' => $splash_title], false, true); + html_print_image('images/splash_image_default.png', false, ['alt' => 'logo', 'border' => 0], false, true); } echo '</div>'; diff --git a/pandora_console/include/functions_menu.php b/pandora_console/include/functions_menu.php index 7944a92d7b..fe26e72fd7 100644 --- a/pandora_console/include/functions_menu.php +++ b/pandora_console/include/functions_menu.php @@ -19,8 +19,10 @@ // Set session variable to store menu type (classic or collapsed) within this session -if (!empty(get_parameter('menuType'))) - $_SESSION['menu_type'] = get_parameter('menuType', 'collapsed'); +if (!empty(get_parameter('menuType'))) { + $_SESSION['menu_type'] = get_parameter('menuType', 'classic'); +} + /** * Prints a complete menu structure. @@ -80,10 +82,17 @@ function menu_print_menu(&$menu) $submenu = false; - if ($_SESSION['menu_type']=='classic') - $classes = ['menu_icon', 'no_hidden_menu']; - else - $classes = ['menu_icon', 'menu_icon_collapsed']; + if ($_SESSION['menu_type'] == 'classic') { + $classes = [ + 'menu_icon', + 'no_hidden_menu', + ]; + } else { + $classes = [ + 'menu_icon', + 'menu_icon_collapsed', + ]; + } if (isset($main['sub'])) { $classes[] = ''; @@ -383,10 +392,11 @@ function menu_print_menu(&$menu) $length = strlen(__($main['text'])); $padding_top = ( $length >= 18) ? 6 : 12; - if ($_SESSION['menu_type']=='classic') + if ($_SESSION['menu_type'] == 'classic') { $output .= '<div id="title_menu" class="title_menu_classic" style="padding-top:'.$padding_top.'px; display:none;">'.$main['text'].'</div>'; - else + } else { $output .= '<div id="title_menu" class="title_menu_collapsed" style="padding-top:'.$padding_top.'px; display:none;">'.$main['text'].'</div>'; + } // Add the notification ball if defined if (isset($main['notification'])) { diff --git a/pandora_console/include/styles/discovery.css b/pandora_console/include/styles/discovery.css index b851999f9a..34e9b98255 100644 --- a/pandora_console/include/styles/discovery.css +++ b/pandora_console/include/styles/discovery.css @@ -99,10 +99,44 @@ div.arrow_box:before { .arrow_box:hover { color: #000; } + +/* + * Breadcrum + */ + +#menu_tab_frame_view_bc { + display: flex; + justify-content: space-between; + border-bottom: 2px solid #82b92e; + max-height: 70px; + min-height: 55px; + width: 100%; + padding-right: 0px; + margin-left: 0px !important; + margin-bottom: 20px; + height: 55px; + box-sizing: border-box; + background-color: #fafafa; + border-top-right-radius: 7px; + border-top-left-radius: 7px; + box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.1); + flex-direction: column; +} + +#menu_tab_frame_view_bc .breadcrumbs_container { + align-self: flex-start; +} + +.breadcrumbs_container { + padding-left: 10px; + padding-top: 4px; + text-indent: 0.25em; +} + .breadcrumb_link { - color: #d0d0d0; - font-size: 12pt !important; - font-family: "Open Sans", sans-serif !important; + color: #848484; + font-size: 10pt !important; + font-family: "lato-bolder", "Open Sans", sans-serif !important; text-decoration: none !important; } @@ -130,4 +164,3 @@ span.breadcrumb_link { box-sizing: border-box; padding: 10px; } - diff --git a/pandora_console/include/styles/firts_task.css b/pandora_console/include/styles/firts_task.css index 32be0eb832..1b26b2bfbe 100755 --- a/pandora_console/include/styles/firts_task.css +++ b/pandora_console/include/styles/firts_task.css @@ -72,6 +72,7 @@ div.new_task_cluster > div { } #description_task { font-size: 12px; + line-height: 1.8em; } #fuerte { diff --git a/pandora_console/include/styles/menu.css b/pandora_console/include/styles/menu.css index 9a51451b70..dcb9db06cb 100644 --- a/pandora_console/include/styles/menu.css +++ b/pandora_console/include/styles/menu.css @@ -31,8 +31,7 @@ .operation .menu_icon ul.submenu > li, .godmode .menu_icon ul.submenu > li { background-color: #282828; - padding-left: 10px; - padding-right: 10px; + padding-left: 1.5em; } .menu ul { @@ -58,7 +57,7 @@ li:hover ul { .submenu_text { margin-left: 0px; width: 100%; - color: #9ca4a6; + color: #b9b9b9; font-family: "Open Sans", sans-serif; font-size: 9.4pt; } @@ -71,21 +70,20 @@ li:hover ul { margin: 0px 0px 0px 0px; position: absolute; z-index: 999; - width: 214px; + width: 240px; } .submenu2 { position: absolute; z-index: 999; - left: 214px; - width: 214px; + left: 240px; + width: 240px; } .sub_subMenu { font-weight: normal !important; background-color: #202020; - padding-left: 10px; - padding-right: 10px; + padding-left: 1.5em; } .sub_subMenu.selected { @@ -291,7 +289,7 @@ ul li a:hover { } .operation { - background-color: #343434 !important; + background-color: #3d3d3d !important; padding-top: 20px !important; } @@ -468,11 +466,11 @@ ul li a:hover { } .header_table_classic { - padding-left: 250px !important; /* 215 + 35 */ + padding-left: 235px !important; /* 215 + 35 */ } .header_table_collapsed { - padding-left: 95px !important; /* 60 + 35 */ + padding-left: 80px !important; /* 60 + 35 */ } .title_menu_classic { diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 9ea2d02c03..bc9e4c6357 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -404,10 +404,10 @@ div#page { background-image: none; clear: both; width: auto; - padding-top: 20px !important; + padding-top: 5px !important; padding-left: 60px; /* This is overwritten by the classic menu (215px)*/ padding-right: 35px; - margin-left: 35px; + margin-left: 20px; } body.pure { @@ -1266,40 +1266,12 @@ div.title_line { margin-bottom: 20px; height: 50px; box-sizing: border-box; - background-color: #fff; + background-color: #fafafa; border-top-right-radius: 7px; border-top-left-radius: 7px; box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1); } -#menu_tab_frame_view_bc { - display: flex; - justify-content: space-between; - border-bottom: 2px solid #82b92e; - max-height: 70px; - min-height: 50px; - width: 100%; - padding-right: 0px; - margin-left: 0px !important; - margin-bottom: 20px; - height: 70px; - box-sizing: border-box; - background-color: #fff; - border-top-right-radius: 7px; - border-top-left-radius: 7px; - box-shadow: 1px 1px 8px rgba(0, 0, 0, 0.1); - flex-direction: column; -} - -#menu_tab_frame_view_bc .breadcrumbs_container { - align-self: flex-start; -} - -.breadcrumbs_container { - padding-left: 10px; - padding-top: 4px; -} - #menu_tab { margin-right: 10px; } @@ -1333,6 +1305,7 @@ div.title_line { text-decoration: none; padding: 0px; margin: 0px; + padding-top: 6px; } #menu_tab li.nomn:hover a, #menu_tab li:hover ul a:hover { @@ -1438,7 +1411,8 @@ div#agent_wizard_subtabs { #menu_tab_left li a, #menu_tab_left li span { color: #343434; - font-size: 14pt; + font-size: 16pt; + line-height: 16pt; } /* @@ -2047,6 +2021,7 @@ div#pandora_logo_header { #header_table_inner { height: 60px; + min-width: 790px; /*width: 100%;*/ display: flex; align-items: center; @@ -3279,7 +3254,7 @@ div.div_groups_status { } #title_menu { - color: #9ca4a6; + color: #b9b9b9; float: right; width: 72%; letter-spacing: 0pt; @@ -3295,16 +3270,15 @@ div.div_groups_status { #menu_tab li.nomn, #menu_tab li.nomn_high { - background-color: #fff; - padding-right: 3px; - padding-left: 3px; + padding-right: 8px; + padding-left: 8px; padding-top: 6px; font-weight: bold; text-decoration: none; font-size: 14px; margin-top: 0; min-width: 30px; - height: 29px; + height: 40px; } #menu_tab li:hover { @@ -3315,6 +3289,7 @@ div.div_groups_status { #menu_tab li.nomn_high span { color: #fff; box-shadow: inset 0px 4px #82b92e; + background-color: #fff; } #menu_tab li.nomn img, @@ -4772,8 +4747,8 @@ input:checked + .p-slider:before { /* New white rounded boxes */ .white_box { background-color: #fff; - border: 1px solid #d7d9da; - border-radius: 10px; + border: 1px solid #f3f3f3; + border-radius: 5px; padding: 20px 50px; } diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index bf81ae5110..997bfed3cb 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -335,11 +335,6 @@ if (check_acl($config['id_user'], 0, 'ER') $sub['operation/events/events_marquee.php']['type'] = 'direct'; } - // CSV - $sub['operation/events/export_csv.php?search=&event_type=&severity=-1&status=3&id_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0§ion=list&open_filter=0&pure=']['text'] = __('CSV File'); - $sub['operation/events/export_csv.php?search=&event_type=&severity=-1&status=3&id_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0§ion=list&open_filter=0&pure=']['id'] = 'CSV File'; - $sub['operation/events/export_csv.php?search=&event_type=&severity=-1&status=3&id_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0§ion=list&open_filter=0&pure=']['type'] = 'direct'; - // Sound Events $javascript = "javascript: window.open('operation/events/sound_events.php');"; $javascript = 'javascript: alert(111);'; From 3038de3a9d7094205d96fe4543390f139ee82eb4 Mon Sep 17 00:00:00 2001 From: fbsanchez <fborja.sanchez@artica.es> Date: Wed, 27 Mar 2019 11:06:57 +0100 Subject: [PATCH 20/21] minor fixes Former-commit-id: 73dbbaa42f3b6120400da688dee7a0499bf31796 --- pandora_console/include/class/ConsoleSupervisor.php | 2 +- pandora_console/include/functions_reporting_xml.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index fa06770f31..b33a208c5a 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -36,7 +36,7 @@ require_once $config['homedir'].'/include/functions_servers.php'; // Enterprise includes. enterprise_include_once('include/functions_metaconsole.php'); enterprise_include_once('include/functions_license.php'); -enterprise_include_once('extensions/cron/functions.php'); +enterprise_include_once('include/functions_cron.php'); /** * Base class to run scheduled tasks in cron extension diff --git a/pandora_console/include/functions_reporting_xml.php b/pandora_console/include/functions_reporting_xml.php index d1b28ac2a0..1873859bdb 100644 --- a/pandora_console/include/functions_reporting_xml.php +++ b/pandora_console/include/functions_reporting_xml.php @@ -11,10 +11,10 @@ // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -require_once 'include/functions_modules.php'; -require_once 'include/functions_events.php'; -require_once 'include/functions_groups.php'; -require_once 'include/functions_netflow.php'; +require_once __DIR__.'/functions_modules.php'; +require_once __DIR__.'/functions_events.php'; +require_once __DIR__.'/functions_groups.php'; +require_once __DIR__.'/functions_netflow.php'; enterprise_include_once('include/functions_metaconsole.php'); From 3c853ff508e448868705a2c048a2384f0a3bebb3 Mon Sep 17 00:00:00 2001 From: fbsanchez <fborja.sanchez@artica.es> Date: Wed, 27 Mar 2019 11:47:09 +0100 Subject: [PATCH 21/21] widget networkmap simple working Former-commit-id: 7a922350fbedefae374f89517e69863d60a8fbee --- .../include/class/NetworkMap.class.php | 20 ++++++++++++++++++- .../functions_pandora_networkmap.js | 3 +++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php index 25a50d9b7b..1191063bdd 100644 --- a/pandora_console/include/class/NetworkMap.class.php +++ b/pandora_console/include/class/NetworkMap.class.php @@ -212,6 +212,13 @@ class NetworkMap */ public $tooltipParams; + /** + * Shows the map using 100% of height and width if is a widget. + * + * @var boolean + */ + public $isWidget; + /** * Defines a custom method to parse Graphviz output and generate Graph. * Function pointer. @@ -369,6 +376,13 @@ class NetworkMap $this->noPandoraNode = $options['no_pandora_node']; } + // Initialize as widget? + if (isset($options['widget'])) { + $this->isWidget = (bool) $options['widget']; + } else { + $this->isWidget = true; + } + // Use a custom parser. if (isset($options['custom_parser'])) { $this->customParser = $options['custom_parser']; @@ -3323,7 +3337,11 @@ class NetworkMap // Open networkconsole_id div. $output .= '<div id="networkconsole_'.$networkmap['id'].'"'; - $output .= ' style="width: '.$this->mapOptions['width'].'; height: '.$this->mapOptions['height'].';position: relative; overflow: hidden; background: #FAFAFA">'; + if ($this->isWidget) { + $output .= ' style="width: 100%; height: 100%;position: relative; overflow: hidden; background: #FAFAFA">'; + } else { + $output .= ' style="width: '.$this->mapOptions['width'].'px; height: '.$this->mapOptions['height'].'px;position: relative; overflow: hidden; background: #FAFAFA">'; + } $output .= '<div style="display: '.$minimap_display.';">'; $output .= '<canvas id="minimap_'.$networkmap['id'].'"'; diff --git a/pandora_console/include/javascript/functions_pandora_networkmap.js b/pandora_console/include/javascript/functions_pandora_networkmap.js index 54a53bb5fb..5c5f5026e5 100644 --- a/pandora_console/include/javascript/functions_pandora_networkmap.js +++ b/pandora_console/include/javascript/functions_pandora_networkmap.js @@ -2955,6 +2955,9 @@ function init_graph(parameter_object) { window.height_svg = $(window).height() - $("#menu_tab_frame_view").height() - 20; // 20 of margin } + if (!window.height_svg) { + window.height_svg = $("#networkconsole_" + networkmap_id).height(); + } if (typeof parameter_object.font_size != "undefined") { window.font_size = parameter_object.font_size;