From ea8662c7bc76dd0af470de02ad287fc49a9a415d Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Mon, 2 Mar 2015 11:40:45 +0100 Subject: [PATCH 1/3] Fixed the connection to node in metaconsole when show the data module dialog. TICKET: #1870 (cherry picked from commit eea8e0d8aec49aa43cd3a2f6491bbbcc66a998fc) --- pandora_console/include/functions_modules.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index 1bc432c898..c90a50e766 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -1555,7 +1555,9 @@ function modules_get_next_data ($id_agent_module, $utimestamp = 0, $string = 0) * * @return array The module value and the timestamp */ -function modules_get_agentmodule_data ($id_agent_module, $period, $date = 0, $trash=false, $conexion = false, $order = 'ASC') { +function modules_get_agentmodule_data ($id_agent_module, $period, + $date = 0, $trash=false, $conexion = false, $order = 'ASC') { + $module = db_get_row('tagente_modulo', 'id_agente_modulo', $id_agent_module); @@ -1580,7 +1582,7 @@ function modules_get_agentmodule_data ($id_agent_module, $period, $date = 0, $tr WHERE id_agente_modulo = %d AND utimestamp > %d AND utimestamp <= %d ORDER BY utimestamp %s", - $id_agent_module, $datelimit, $date, $order); + $id_agent_module, $datelimit, $date, $order); break; //log4x case 24: @@ -1589,7 +1591,7 @@ function modules_get_agentmodule_data ($id_agent_module, $period, $date = 0, $tr WHERE id_agente_modulo = %d AND utimestamp > %d AND utimestamp <= %d ORDER BY utimestamp %s", - $id_agent_module, $datelimit, $date, $order); + $id_agent_module, $datelimit, $date, $order); break; default: $sql = sprintf ("SELECT datos AS data, utimestamp @@ -1597,7 +1599,7 @@ function modules_get_agentmodule_data ($id_agent_module, $period, $date = 0, $tr WHERE id_agente_modulo = %d AND utimestamp > %d AND utimestamp <= %d ORDER BY utimestamp %s", - $id_agent_module, $datelimit, $date, $order); + $id_agent_module, $datelimit, $date, $order); break; } From 52e3926c7130dac81eccba0d3a64d9503316e091 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Mon, 2 Mar 2015 13:12:50 +0100 Subject: [PATCH 2/3] Fixed the icons of menu on combined charts. TICKET: #1869 (cherry picked from commit 380cddc4d47a4bb8f9024c3fb66944ab9b5ce5db) --- pandora_console/include/functions_custom_graphs.php | 4 +++- pandora_console/include/graphs/flot/pandora.flot.js | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/functions_custom_graphs.php b/pandora_console/include/functions_custom_graphs.php index 039af0c502..6ea8e9f07b 100644 --- a/pandora_console/include/functions_custom_graphs.php +++ b/pandora_console/include/functions_custom_graphs.php @@ -206,7 +206,9 @@ function custom_graphs_print($id_graph, $height, $width, $period, return; } - + if (empty($homeurl)) { + $homeurl = ui_get_full_url(false, false, false, false); + } $output = graphic_combined_module($modules, $weights, diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index de39d22bef..fd96a42a34 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -1053,7 +1053,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, $('#menu_cancelzoom_' + graph_id).click(function() { // cancel the zooming - plot = $.plot($('#'+graph_id), data_base, + plot = $.plot($('#' + graph_id), data_base, $.extend(true, {}, options, { xaxis: {max: max_x }, legend: { show: false } @@ -1075,9 +1075,11 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, // Add bottom margin in the legend // Estimated height of 24 (works fine with this data in all browsers) menu_height = 24; - var legend_margin_bottom = parseInt($('#legend_'+graph_id).css('margin-bottom').split('px')[0]); + var legend_margin_bottom = parseInt( + $('#legend_'+graph_id).css('margin-bottom').split('px')[0]); $('#legend_'+graph_id).css('margin-bottom', menu_height+legend_margin_bottom+'px'); - parent_height = parseInt($('#menu_'+graph_id).parent().css('height').split('px')[0]); + parent_height = parseInt( + $('#menu_'+graph_id).parent().css('height').split('px')[0]); adjust_menu(graph_id, plot, parent_height); } From 3da480908b2f4af402741428b994b3f3b4726a01 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Mon, 2 Mar 2015 14:21:09 +0100 Subject: [PATCH 3/3] The network interfaces table now accepts the 'ifOperStatus' modules with more types The types are remote_snmp_proc, remote_icmp_proc, remote_tcp_proc and generic_proc. --- pandora_console/include/functions_agents.php | 26 +++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 21dfbce04e..23df51ce87 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -2228,18 +2228,32 @@ function agents_get_network_interfaces ($agents = false, $agents_filter = false) $agent_group_id = $agent['id_grupo']; $agent_name = $agent['nombre']; $agent_interfaces = array(); - + + $accepted_module_types = array(); + $remote_snmp_proc = (int) db_get_value("id_tipo", "ttipo_modulo", "nombre", "remote_snmp_proc"); + if ($remote_snmp_proc) + $accepted_module_types[] = $remote_snmp_proc; + $remote_icmp_proc = (int) db_get_value("id_tipo", "ttipo_modulo", "nombre", "remote_icmp_proc"); + if ($remote_icmp_proc) + $accepted_module_types[] = $remote_icmp_proc; + $remote_tcp_proc = (int) db_get_value("id_tipo", "ttipo_modulo", "nombre", "remote_tcp_proc"); + if ($remote_tcp_proc) + $accepted_module_types[] = $remote_tcp_proc; + $generic_proc = (int) db_get_value("id_tipo", "ttipo_modulo", "nombre", "generic_proc"); + if ($generic_proc) + $accepted_module_types[] = $generic_proc; + + if (empty($accepted_module_types)) + $accepted_module_types[] = 0; // No modules will be returned + $columns = array( "id_agente_modulo", "nombre", "descripcion", "ip_target" ); - $filter = array( - "id_agente" => $agent_id, - "id_tipo_modulo" => (int) db_get_value("id_tipo", "ttipo_modulo", "nombre", "remote_snmp_proc"), - "disabled" => 0 - ); + $filter = " id_agente = $agent_id AND disabled = 0 AND id_tipo_modulo IN (".implode(",", $accepted_module_types).")"; + $modules = agents_get_modules($agent_id, $columns, $filter, true, false); if (!empty($modules)) {