From 9b1cbf3c9bd5139833b981eaba5ef63c4eb8d75d Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 24 Oct 2017 13:10:07 +0200 Subject: [PATCH 01/11] Changed column in tuser_task_scheduled --- pandora_console/extras/mr/9.sql | 13 +++++++++++++ .../extras/pandoradb_migrate_6.0_to_7.0.mysql.sql | 4 ++++ 2 files changed, 17 insertions(+) create mode 100644 pandora_console/extras/mr/9.sql diff --git a/pandora_console/extras/mr/9.sql b/pandora_console/extras/mr/9.sql new file mode 100644 index 0000000000..90f8cde128 --- /dev/null +++ b/pandora_console/extras/mr/9.sql @@ -0,0 +1,13 @@ +START TRANSACTION; + +SET @st_oum708 = (SELECT IF( + (SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'tuser_task_scheduled') > 0, + "ALTER TABLE tuser_task_scheduled MODIFY args TEXT NOT NULL", + "SELECT 1" +)); + +PREPARE pr_oum708 FROM @st_oum708; +EXECUTE pr_oum708; +DEALLOCATE PREPARE pr_oum708; + +COMMIT; \ No newline at end of file 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 4e31057a89..18b93b8eac 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 @@ -1326,6 +1326,10 @@ SET @vv1 = (SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = IF @vv1>0 THEN ALTER TABLE tbackup ADD COLUMN `filepath` varchar(512) NOT NULL DEFAULT ""; END IF; +SET @vv2 = (SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'tuser_task_scheduled'); +IF @vv2>0 THEN + ALTER TABLE tuser_task_scheduled MODIFY args TEXT NOT NULL; +END IF; END; // delimiter ; From d1a4458aad6efa90547965ac23e57fa38aa252dd Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Tue, 24 Oct 2017 13:51:34 +0200 Subject: [PATCH 02/11] Added new section to menu --- pandora_console/operation/menu.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index 6c27ce428d..b7c57882a8 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -59,6 +59,8 @@ if (check_acl ($config['id_user'], 0, "AR")) { $sub2["operation/agentes/status_monitor"]["text"] = __('Monitor detail'); $sub2["operation/agentes/status_monitor"]["refr"] = 0; + enterprise_hook ('tag_view_submenu'); + $sub2["operation/agentes/alerts_status"]["text"] = __('Alert detail'); $sub2["operation/agentes/alerts_status"]["refr"] = 0; From f1cbaec98be1a7909b9afb527af7d017d1a21b14 Mon Sep 17 00:00:00 2001 From: fermin831 Date: Wed, 25 Oct 2017 12:11:56 +0200 Subject: [PATCH 03/11] Added safe_output to server events --- pandora_server/lib/PandoraFMS/Core.pm | 32 ++++++++++++-------- pandora_server/lib/PandoraFMS/DataServer.pm | 9 ++++-- pandora_server/lib/PandoraFMS/ReconServer.pm | 2 +- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 77db28e6e7..e6ef632f73 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -525,7 +525,7 @@ Process an alert given the status returned by pandora_evaluate_alert. ########################################################################## sub pandora_process_alert ($$$$$$$$;$) { my ($pa_config, $data, $agent, $module, $alert, $rc, $dbh, $timestamp, $extra_macros) = @_; - + if (defined ($agent)) { logger ($pa_config, "Processing alert '" . safe_output($alert->{'name'}) . "' for agent '" . safe_output($agent->{'nombre'}) . "': " . (defined ($AlertStatus[$rc]) ? $AlertStatus[$rc] : 'Unknown status') . ".", 10); } @@ -565,12 +565,12 @@ sub pandora_process_alert ($$$$$$$$;$) { # Generate an event if ($table eq 'tevent_alert') { pandora_event ($pa_config, "Alert ceased (" . - $alert->{'name'} . ")", 0, 0, $alert->{'priority'}, $id, + safe_output($alert->{'name'}) . ")", 0, 0, $alert->{'priority'}, $id, (defined ($alert->{'id_agent_module'}) ? $alert->{'id_agent_module'} : 0), "alert_ceased", 0, $dbh, 'Pandora', '', '', '', '', $critical_instructions, $warning_instructions, $unknown_instructions); } else { pandora_event ($pa_config, "Alert ceased (" . - $alert->{'name'} . ")", $agent->{'id_grupo'}, + safe_output($alert->{'name'}) . ")", $agent->{'id_grupo'}, $agent->{'id_agente'}, $alert->{'priority'}, $id, (defined ($alert->{'id_agent_module'}) ? $alert->{'id_agent_module'} : 0), "alert_ceased", 0, $dbh, 'Pandora', '', '', '', '', $critical_instructions, $warning_instructions, $unknown_instructions); @@ -1611,9 +1611,8 @@ sub pandora_planned_downtime_disabled_once_stop($$) { db_do($dbh, 'UPDATE tplanned_downtime SET executed = 0 WHERE id = ?', $downtime->{'id'}); - pandora_event ($pa_config, - '(Created by ' . $downtime->{'id_user'} . ') Server ' . $pa_config->{'servername'} . ' stopped planned downtime: ' . $downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh); + '(Created by ' . $downtime->{'id_user'} . ') Server ' . $pa_config->{'servername'} . ' stopped planned downtime: ' . safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh); pandora_planned_downtime_unset_disabled_elements($pa_config, $dbh, $downtime); @@ -1658,8 +1657,9 @@ sub pandora_planned_downtime_disabled_once_start($$) { SET executed = 1 WHERE id = ?', $downtime->{'id'}); + print"pandora_planned_downtime_disabled_once_start\n"; pandora_event ($pa_config, - "(Created by " . $downtime->{'id_user'} . ") Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh); + "(Created by " . $downtime->{'id_user'} . ") Server ".$pa_config->{'servername'}." started planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh); pandora_planned_downtime_set_disabled_elements($pa_config, $dbh, $downtime); @@ -1849,7 +1849,7 @@ sub pandora_planned_downtime_quiet_once_stop($$) { SET executed = 0 WHERE id = ?', $downtime->{'id'}); pandora_event ($pa_config, - "(Created by " . $downtime->{'id_user'} . ") Server ".$pa_config->{'servername'}." stopped planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh); + "(Created by " . $downtime->{'id_user'} . ") Server ".$pa_config->{'servername'}." stopped planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh); pandora_planned_downtime_unset_quiet_elements($pa_config, $dbh, $downtime->{'id'}); @@ -1890,8 +1890,9 @@ sub pandora_planned_downtime_quiet_once_start($$) { db_do($dbh, 'UPDATE tplanned_downtime SET executed = 1 WHERE id = ?', $downtime->{'id'}); + print"pandora_planned_downtime_quiet_once_start\n"; pandora_event ($pa_config, - "(Created by " . $downtime->{'id_user'} . ") Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh); + "(Created by " . $downtime->{'id_user'} . ") Server ".$pa_config->{'servername'}." started planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh); pandora_planned_downtime_set_quiet_elements($pa_config, $dbh, $downtime->{'id'}); @@ -1944,8 +1945,9 @@ sub pandora_planned_downtime_monthly_start($$) { db_do($dbh, 'UPDATE tplanned_downtime SET executed = 1 WHERE id = ?', $downtime->{'id'}); + print"pandora_planned_downtime_monthly_start\n"; pandora_event ($pa_config, - "Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh); + "Server ".$pa_config->{'servername'}." started planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh); if ($downtime->{'type_downtime'} eq "quiet") { @@ -2020,8 +2022,9 @@ sub pandora_planned_downtime_monthly_stop($$) { db_do($dbh, 'UPDATE tplanned_downtime SET executed = 0 WHERE id = ?', $downtime->{'id'}); + print"pandora_planned_downtime_monthly_stop\n"; pandora_event ($pa_config, - "Server ".$pa_config->{'servername'}." stopped planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh); + "Server ".$pa_config->{'servername'}." stopped planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh); if ($downtime->{'type_downtime'} eq "quiet") { pandora_planned_downtime_unset_quiet_elements($pa_config, @@ -2129,8 +2132,9 @@ sub pandora_planned_downtime_weekly_start($$) { db_do($dbh, 'UPDATE tplanned_downtime SET executed = 1 WHERE id = ?', $downtime->{'id'}); + print"pandora_planned_downtime_weekly_start\n"; pandora_event ($pa_config, - "Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh); + "Server ".$pa_config->{'servername'}." started planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh); if ($downtime->{'type_downtime'} eq "quiet") { pandora_planned_downtime_set_quiet_elements($pa_config, @@ -2243,8 +2247,10 @@ sub pandora_planned_downtime_weekly_stop($$) { db_do($dbh, 'UPDATE tplanned_downtime SET executed = 0 WHERE id = ?', $downtime->{'id'}); + + print"pandora_planned_downtime_weekly_stop\n"; pandora_event ($pa_config, - "Server ".$pa_config->{'servername'}." stopped planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh); + "Server ".$pa_config->{'servername'}." stopped planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh); if ($downtime->{'type_downtime'} eq "quiet") { pandora_planned_downtime_unset_quiet_elements($pa_config, @@ -2974,7 +2980,7 @@ sub pandora_create_agent ($$$$$$$$$$;$$$$$$$$$) { } logger ($pa_config, "Server '$server_name' CREATED agent '$agent_name' address '$address'.", 10); - pandora_event ($pa_config, "Agent [$alias] created by $server_name", $group_id, $agent_id, 2, 0, 0, 'new_agent', 0, $dbh); + pandora_event ($pa_config, "Agent [" . safe_output($alias) . "] created by $server_name", $group_id, $agent_id, 2, 0, 0, 'new_agent', 0, $dbh); return $agent_id; } diff --git a/pandora_server/lib/PandoraFMS/DataServer.pm b/pandora_server/lib/PandoraFMS/DataServer.pm index ebd8f860ee..dd4256e96d 100644 --- a/pandora_server/lib/PandoraFMS/DataServer.pm +++ b/pandora_server/lib/PandoraFMS/DataServer.pm @@ -333,19 +333,22 @@ sub process_xml_data ($$$$$) { if (defined ($data->{'group_id'}) && $data->{'group_id'} ne '') { $group_id = $data->{'group_id'}; if (! defined (get_group_name ($dbh, $group_id))) { - pandora_event ($pa_config, "Unable to create agent '$agent_name': group ID '" . $group_id . "' does not exist.", 0, 0, 0, 0, 0, 'error', 0, $dbh); + print "UNABLE GROUP ID\n"; + pandora_event ($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': group ID '" . $group_id . "' does not exist.", 0, 0, 0, 0, 0, 'error', 0, $dbh); logger($pa_config, "Group ID " . $group_id . " does not exist.", 3); return; } } elsif (defined ($data->{'group'}) && $data->{'group'} ne '') { $group_id = get_group_id ($dbh, $data->{'group'}); if (! defined (get_group_name ($dbh, $group_id))) { - pandora_event ($pa_config, "Unable to create agent '$agent_name': group '" . $data->{'group'} . "' does not exist.", 0, 0, 0, 0, 0, 'error', 0, $dbh); + print "UNABLE GROUP\n"; + pandora_event ($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': group '" . safe_output($data->{'group'}) . "' does not exist.", 0, 0, 0, 0, 0, 'error', 0, $dbh); logger($pa_config, "Group " . $data->{'group'} . " does not exist.", 3); return; } } else { - pandora_event ($pa_config, "Unable to create agent '$agent_name': autocreate_group $group_id does not exist. Edit the pandora_server.conf file and change it.", 0, 0, 0, 0, 0, 'error', 0, $dbh); + print "UNABLE AUTOCREATE\n"; + pandora_event ($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': autocreate_group $group_id does not exist. Edit the pandora_server.conf file and change it.", 0, 0, 0, 0, 0, 'error', 0, $dbh); logger($pa_config, "Group id $group_id does not exist (check autocreate_group config token).", 3); return; } diff --git a/pandora_server/lib/PandoraFMS/ReconServer.pm b/pandora_server/lib/PandoraFMS/ReconServer.pm index b25c222bf7..3261729569 100644 --- a/pandora_server/lib/PandoraFMS/ReconServer.pm +++ b/pandora_server/lib/PandoraFMS/ReconServer.pm @@ -421,7 +421,7 @@ sub PandoraFMS::Recon::Base::create_agent($$) { $agent_id = pandora_create_agent($self->{'pa_config'}, $self->{'pa_config'}->{'servername'}, $host_name, $device, $self->{'group_id'}, 0, $id_os, '', 300, $self->{'dbh'}); return undef unless defined ($agent_id) and ($agent_id > 0); - pandora_event($self->{'pa_config'}, "[RECON] New " . $self->get_device_type($device) . " found (" . join(',', $self->get_addresses($device)) . ").", $self->{'group_id'}, $agent_id, 2, 0, 0, 'recon_host_detected', 0, $self->{'dbh'}); + pandora_event($self->{'pa_config'}, "[RECON] New " . safe_output($self->get_device_type($device)) . " found (" . join(',', safe_output($self->get_addresses($device))) . ").", $self->{'group_id'}, $agent_id, 2, 0, 0, 'recon_host_detected', 0, $self->{'dbh'}); $agent_learning = 1; # Create network profile modules for the agent From 74753918c381ee7558f930b867386a82329e828e Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Fri, 27 Oct 2017 12:43:46 +0200 Subject: [PATCH 04/11] Added function to update link to other map --- pandora_console/include/functions_pandora_networkmap.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pandora_console/include/functions_pandora_networkmap.php b/pandora_console/include/functions_pandora_networkmap.php index 0bbb4dd124..a16455462b 100644 --- a/pandora_console/include/functions_pandora_networkmap.php +++ b/pandora_console/include/functions_pandora_networkmap.php @@ -212,6 +212,7 @@ function networkmap_process_networkmap($id = 0) { $style['width'] = $node['width']; $style['height'] = $node['height']; $style['label'] = $node['text']; + $style['id_networkmap'] = $node['networkmap']; $nodes_and_relations['nodes'][$index]['style'] = json_encode($style); $index++; @@ -398,6 +399,13 @@ function networkmap_db_node_to_js_node($node, &$count, &$count_item_holding_area if (isset($node['id_map'])) { $item['map_id'] = $node['id_map']; } + + if (!isset($node['style']['id_networkmap']) || $node['style']['id_networkmap'] == '' || $node['style']['id_networkmap'] == 0) { + $item['networkmap_id'] = 0; + } + else { + $item['networkmap_id'] = $node['style']['id_networkmap']; + } $count++; From 385685de8a9cf886fb21b84d2ccea568475e3311 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Tue, 31 Oct 2017 09:35:13 +0100 Subject: [PATCH 05/11] Added safe input to agent name --- pandora_console/include/functions_networkmap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index e1417ceec1..aea248e829 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -1111,7 +1111,7 @@ function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cu } $node = "\n" . $agent['id_node'].' [ parent="' . $agent['id_parent'] . '", color="'.$status_color.'", fontsize='.$font_size.', style="filled", fixedsize=true, width=0.40, height=0.40, label=< -
' . $img_node . '
'.io_safe_output($name).'
>, + '.io_safe_input($name).'>, shape="doublecircle", URL="'.$url.'", tooltip="' . $url_tooltip . '"];' . "\n"; } From 3ead7ca3daeaa8edef370265ff256ab52ffa8e81 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Tue, 31 Oct 2017 11:11:30 +0100 Subject: [PATCH 06/11] Added the options in networkmap editor --- .../agentes/pandora_networkmap.editor.php | 22 ++++++++++++-- .../operation/agentes/pandora_networkmap.php | 29 +++++++++---------- .../agentes/pandora_networkmap.view.php | 10 +++++-- 3 files changed, 42 insertions(+), 19 deletions(-) diff --git a/pandora_console/operation/agentes/pandora_networkmap.editor.php b/pandora_console/operation/agentes/pandora_networkmap.editor.php index eea978db77..3c401b2985 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.editor.php +++ b/pandora_console/operation/agentes/pandora_networkmap.editor.php @@ -38,6 +38,9 @@ if ($new_networkmap) { $source = 'group'; $ip_mask = ''; $dont_show_subgroups = false; + $offset_x = ""; + $offset_y = ""; + $scale_z = 0.5; } $disabled_generation_method_select = false; @@ -75,6 +78,10 @@ if ($edit_networkmap) { $description = $values['description']; $filter = json_decode($values['filter'], true); + + $offset_x = $filter['x_offs']; + $offset_y = $filter['y_offs']; + $scale_z = $filter['z_dash']; $node_radius = $filter['node_radius']; @@ -190,6 +197,17 @@ else { $table->data[3][0] = __('Description'); $table->data[3][1] = html_print_textarea ('description', 7, 25, $description, '', true); + + $table->data[4][0] = __('Position X'); + $table->data[4][1] = html_print_input_text ('pos_x', $offset_x, '', 2, 10,true); + $table->data[5][0] = __('Position Y'); + $table->data[5][1] = html_print_input_text ('pos_y', $offset_y, '', 2, 10,true); + + $table->data[6][0] = __('Zoom scale'); + if ($scale_z == "") { + $scale_z = 0.5; + } + $table->data[6][1] = html_print_input_text ('scale_z', $scale_z, '', 2, 10,true) . ui_print_help_tip (__('Introduce zoom level. 1 = Highest resolution. Figures may include decimals'), true); $table->data['source'][0] = __('Source'); $table->data['source'][1] = @@ -222,8 +240,8 @@ else { 'radial_dinamic' => 'radial dinamic' ); - $table->data[4][0] = __('Method generation networkmap'); - $table->data[4][1] = html_print_select($methods, 'method', $method, + $table->data[7][0] = __('Method generation networkmap'); + $table->data[7][1] = html_print_select($methods, 'method', $method, '', '', 'twopi', true, false, true, '', $disabled_generation_method_select); diff --git a/pandora_console/operation/agentes/pandora_networkmap.php b/pandora_console/operation/agentes/pandora_networkmap.php index 9e44b92338..d1a053f6dc 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.php +++ b/pandora_console/operation/agentes/pandora_networkmap.php @@ -84,6 +84,10 @@ if ($new_networkmap || $save_networkmap) { $dont_show_subgroups = (int)get_parameter('dont_show_subgroups', 0); $node_radius = (int)get_parameter('node_radius', 40); $description = get_parameter('description', ''); + + $offset_x = get_parameter('pos_x'); + $offset_y = get_parameter('pos_y'); + $scale_z = get_parameter('scale_z', 0.5); $values = array(); $values['name'] = $name; @@ -141,6 +145,9 @@ if ($new_networkmap || $save_networkmap) { $filter = array(); $filter['dont_show_subgroups'] = $dont_show_subgroups; $filter['node_radius'] = $node_radius; + $filter['x_offs'] = $offset_x; + $filter['y_offs'] = $offset_y; + $filter['z_dash'] = $scale_z; $values['filter'] = json_encode($filter); $result = false; @@ -209,26 +216,15 @@ else if ($update_networkmap || $copy_networkmap || $delete) { 'recon_task_id', 0); $source = (string)get_parameter('source', 'group'); + + $offset_x = get_parameter('pos_x'); + $offset_y = get_parameter('pos_y'); + $scale_z = get_parameter('scale_z', 0.5); $values = array(); $values['name'] = $name; $values['id_group'] = $id_group; - /* - if ($source == 'group') { - $values['source'] = 0; - $values['source_data'] = $id_group; - } - else if ($source == 'recon_task') { - $values['source'] = 1; - $values['source_data'] = $recon_task_id; - } - else if ($source == 'ip_mask') { - $values['source'] = 2; - $values['source_data'] = $ip_mask; - } - */ - switch ($method) { case 'twopi': $values['generation_method'] = 2; @@ -262,6 +258,9 @@ else if ($update_networkmap || $copy_networkmap || $delete) { $filter = json_decode($row['filter'], true); $filter['dont_show_subgroups'] = $dont_show_subgroups; $filter['node_radius'] = $node_radius; + $filter['x_offs'] = $offset_x; + $filter['y_offs'] = $offset_y; + $filter['z_dash'] = $scale_z; $values['filter'] = json_encode($filter); diff --git a/pandora_console/operation/agentes/pandora_networkmap.view.php b/pandora_console/operation/agentes/pandora_networkmap.view.php index 5c5d2969c4..ef839b2b63 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.view.php +++ b/pandora_console/operation/agentes/pandora_networkmap.view.php @@ -681,6 +681,8 @@ $id = (int) get_parameter('id_networkmap', 0); $dash_mode = 0; $map_dash_details = array(); +$networkmap = db_get_row('tmap', 'id', $id); + if (enterprise_installed()) { include_once("enterprise/dashboard/widgets/network_map.php"); if ($id_networkmap) { @@ -693,10 +695,14 @@ if (enterprise_installed()) { $map_dash_details['y_offs'] = $y_offs; $map_dash_details['z_dash'] = $z_dash; } + else { + $networkmap_filter = json_decode($networkmap['filter'], true); + $map_dash_details['x_offs'] = $networkmap_filter['x_offs']; + $map_dash_details['y_offs'] = $networkmap_filter['y_offs']; + $map_dash_details['z_dash'] = $networkmap_filter['z_dash']; + } } -$networkmap = db_get_row('tmap', 'id', $id); - if ($networkmap === false) { ui_print_page_header(__('Networkmap'), "images/bricks.png", false, "network_map_enterprise", false); From cffbfd3fb30d9554e1e8e94b3a2bdd8645afed54 Mon Sep 17 00:00:00 2001 From: enriquecd Date: Mon, 6 Nov 2017 12:19:31 +0100 Subject: [PATCH 07/11] Add visual console macros - #1413 --- pandora_console/include/functions_visual_map.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 2391dc30a5..c1869798b5 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -3275,7 +3275,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, 'proportion_width' => $proportion_width); } - $layout_data['label'] = visual_map_macro($layout_data['label']); + $layout_data['label'] = visual_map_macro($layout_data['label'],$layout_data["id_agente_modulo"]); switch ($layout_data['type']) { case LINE_ITEM: @@ -3661,9 +3661,14 @@ function visual_map_type_in_js($type) { } } -function visual_map_macro($label){ +function visual_map_macro($label,$module){ $label = str_replace('_date_',strftime("%x"),$label); $label = str_replace('_time_',strftime("%T"),$label); + $label = str_replace('_agent_',agents_get_alias(modules_get_agentmodule_agent($module)),$label); + $label = str_replace('_module_',modules_get_agentmodule_name($module),$label); + $label = str_replace('_agentdescription_',agents_get_description(modules_get_agentmodule_agent($module)),$label); + $label = str_replace('_address_',agents_get_address(modules_get_agentmodule_agent($module)),$label); + $label = str_replace('_moduledescription_',modules_get_agentmodule_descripcion($module),$label); return $label; } From 35ec64e2eae0c132ce2a7bb1a6dd97cddf4203c5 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Tue, 7 Nov 2017 11:41:40 +0100 Subject: [PATCH 08/11] Changed flow --- pandora_console/operation/agentes/pandora_networkmap.php | 6 ++++-- .../operation/agentes/pandora_networkmap.view.php | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pandora_console/operation/agentes/pandora_networkmap.php b/pandora_console/operation/agentes/pandora_networkmap.php index 9e44b92338..5f83ca4b9a 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.php +++ b/pandora_console/operation/agentes/pandora_networkmap.php @@ -153,8 +153,10 @@ if ($new_networkmap || $save_networkmap) { __('Succesfully created'), __('Could not be created'), '', true); - // Force the tab = 'list' - $tab = "list"; + $id = $result; + + // Force the tab = 'view' + $tab = "view"; } } // The networkmap exists diff --git a/pandora_console/operation/agentes/pandora_networkmap.view.php b/pandora_console/operation/agentes/pandora_networkmap.view.php index 2ebc1447d2..31acea9986 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.view.php +++ b/pandora_console/operation/agentes/pandora_networkmap.view.php @@ -677,7 +677,9 @@ if (is_ajax ()) { } } //--------------END AJAX------------------------------------------------ -$id = (int) get_parameter('id_networkmap', 0); +if ($id == 0) { + $id = (int) get_parameter('id_networkmap', 0); +} $dash_mode = 0; $map_dash_details = array(); From cea0f901174de7652d74622412d2518c358f4f91 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Wed, 8 Nov 2017 09:14:26 +0100 Subject: [PATCH 09/11] Remove HTML entities from the SNMP community. Ref. pandora_enterprise#1565. --- pandora_console/include/functions.php | 2 +- pandora_console/include/functions_snmp_browser.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index f8edfd1d27..4edfe2c512 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -1594,7 +1594,7 @@ function get_snmpwalk($ip_target, $snmp_version, $snmp_community = '', case '2c': case '1': default: - $command_str = $snmpwalk_bin . ' -m ALL -Oa -v ' . escapeshellarg($snmp_version) . ' -c ' . escapeshellarg($snmp_community) . ' ' . escapeshellarg($ip_target) . ' ' . $base_oid . ' 2> ' . $error_redir_dir; + $command_str = $snmpwalk_bin . ' -m ALL -Oa -v ' . escapeshellarg($snmp_version) . ' -c ' . escapeshellarg(io_safe_output($snmp_community)) . ' ' . escapeshellarg($ip_target) . ' ' . $base_oid . ' 2> ' . $error_redir_dir; break; } diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php index b98d66789b..1f80421fa5 100644 --- a/pandora_console/include/functions_snmp_browser.php +++ b/pandora_console/include/functions_snmp_browser.php @@ -196,7 +196,7 @@ function snmp_browser_get_tree ($target_ip, $community, $starting_oid = '.', $ve } } else { - $command = $snmpwalk_bin . " -m ALL -M +" . escapeshellarg($config['homedir'] . "/attachment/mibs") . " -Cc -c " . escapeshellarg($community) . " -v " . escapeshellarg($version) . " " . escapeshellarg($target_ip) . " " . escapeshellarg($starting_oid) . " 2> " . $error_redir_dir; + $command = $snmpwalk_bin . " -m ALL -M +" . escapeshellarg($config['homedir'] . "/attachment/mibs") . " -Cc -c " . escapeshellarg(io_safe_output($community)) . " -v " . escapeshellarg($version) . " " . escapeshellarg($target_ip) . " " . escapeshellarg($starting_oid) . " 2> " . $error_redir_dir; } exec("ssh pandora_exec_proxy@" . $server_data['ip_address'] . " \"" . $command . "\"", $output, $rc); } @@ -216,7 +216,7 @@ function snmp_browser_get_tree ($target_ip, $community, $starting_oid = '.', $ve } } else { - exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg($community) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc); + exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg(io_safe_output($community)) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc); } } } @@ -236,7 +236,7 @@ function snmp_browser_get_tree ($target_ip, $community, $starting_oid = '.', $ve } } else { - exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg($community) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc); + exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg(io_safe_output($community)) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc); } } @@ -348,7 +348,7 @@ function snmp_browser_get_oid ($target_ip, $community, $target_oid, $version = ' exec ($snmpget_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -A ' . escapeshellarg($snmp3_auth_pass) . ' -l ' . escapeshellarg($snmp3_security_level) . ' -a ' . escapeshellarg($snmp3_auth_method) . ' -x ' . escapeshellarg($snmp3_privacy_method) . ' -X ' . escapeshellarg($snmp3_privacy_pass) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($target_oid) . ' 2> ' . $error_redir_dir, $output, $rc); } else { - exec ($snmpget_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -On -c ' . escapeshellarg($community) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($target_oid) . ' 2> ' . $error_redir_dir, $output, $rc); + exec ($snmpget_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -On -c ' . escapeshellarg(io_safe_output($community)) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($target_oid) . ' 2> ' . $error_redir_dir, $output, $rc); } if ($rc != 0) { From f77693bce95c5a0da22303a6c2f3330417e26fc3 Mon Sep 17 00:00:00 2001 From: danielmaya Date: Fri, 10 Nov 2017 13:19:23 +0100 Subject: [PATCH 10/11] Fixed margin left and top in visual console --- .../operation/visual_console/public_console.php | 5 +++++ pandora_console/operation/visual_console/pure_ajax.php | 5 ++++- pandora_console/operation/visual_console/render_view.php | 7 +++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/pandora_console/operation/visual_console/public_console.php b/pandora_console/operation/visual_console/public_console.php index 5b955def1f..21bf94fe65 100755 --- a/pandora_console/operation/visual_console/public_console.php +++ b/pandora_console/operation/visual_console/public_console.php @@ -208,6 +208,11 @@ $ignored_params['refr'] = ''; $(".overlay").removeClass("overlay").addClass("overlaydisabled"); + // Start the map fetch + //~ fetchMap(); + }); + + $(window).load (function () { $('.item:not(.icon) img:not(.b64img)').each( function() { if ($(this).css('float')=='left' || $(this).css('float')=='right') { if( $(this).parent()[0].tagName == 'DIV'){ diff --git a/pandora_console/operation/visual_console/pure_ajax.php b/pandora_console/operation/visual_console/pure_ajax.php index 08b5460067..58e920550f 100644 --- a/pandora_console/operation/visual_console/pure_ajax.php +++ b/pandora_console/operation/visual_console/pure_ajax.php @@ -183,7 +183,10 @@ $ignored_params['refr'] = ''; }); $(".overlay").removeClass("overlay").addClass("overlaydisabled"); - + + }); + + $(window).load (function () { $('.item:not(.icon) img').each(function(){ diff --git a/pandora_console/operation/visual_console/render_view.php b/pandora_console/operation/visual_console/render_view.php index 261205818b..885f326238 100755 --- a/pandora_console/operation/visual_console/render_view.php +++ b/pandora_console/operation/visual_console/render_view.php @@ -279,7 +279,10 @@ $ignored_params['refr'] = ''; }); $(".overlay").removeClass("overlay").addClass("overlaydisabled"); - + + }); + + $(window).load (function () { $('.item:not(.icon) img:not(.b64img)').each( function() { if ($(this).css('float')=='left' || $(this).css('float')=='right') { if( $(this).parent()[0].tagName == 'DIV'){ @@ -332,6 +335,6 @@ $ignored_params['refr'] = ''; height = parseInt($(this).css("height")) - 30; $(this).css('height', height); }); - + }); \ No newline at end of file From 66547d28b03bc17c38795a109836334842df46d8 Mon Sep 17 00:00:00 2001 From: danielmaya Date: Wed, 15 Nov 2017 11:15:12 +0100 Subject: [PATCH 11/11] Updated to MR 9 --- pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql | 4 ++-- pandora_console/pandoradb_data.sql | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 8142f190f4..8033c055d2 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 @@ -1157,10 +1157,10 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned; INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30'); -INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 8); +INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 9); UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager'; DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise'; -INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '714'); +INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '716'); -- --------------------------------------------------------------------- -- Table `tplanned_downtime_agents` diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index c272912ad7..476750758f 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -109,10 +109,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_report_front_logo', 'images/pandora_logo_white.jpg'), ('custom_report_front_header', ''), ('custom_report_front_footer', ''), -('MR', 8), +('MR', 9), ('identification_reminder', 1), ('identification_reminder_timestamp', 0), -('current_package_enterprise', '715'), +('current_package_enterprise', '716'), ('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.0009765625":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}'); UNLOCK TABLES;