From 58c2bb89b00404c95e1fb188bb4844108eb093e1 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 25 Oct 2012 08:53:44 +0000 Subject: [PATCH] 2012-10-25 Miguel de Dios * include/functions_networkmap.php: added two parameters (flag metaconsole, id_server) into the functions "networkmap_create_group_node" and "networkmap_create_networkmap" for to extract data in the metaconsole enviroments. And in the function "networkmap_create_module_node" fixes the default value of flag for metaconsole and the links and url tooltips for the metaconsole networkmap. * operation/agentes/ver_agente.php: in the request for the "get_agentmodule_status_tooltip" added code for get data in the metaconsole. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7088 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 14 +++++ .../include/functions_networkmap.php | 63 ++++++++++++++----- .../operation/agentes/ver_agente.php | 17 +++++ 3 files changed, 80 insertions(+), 14 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 0fc5ba6e62..1dcbd9ad4c 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,17 @@ +2012-10-25 Miguel de Dios + + * include/functions_networkmap.php: added two parameters + (flag metaconsole, id_server) into the functions + "networkmap_create_group_node" and "networkmap_create_networkmap" + for to extract data in the metaconsole enviroments. And in the + function "networkmap_create_module_node" fixes the default value of + flag for metaconsole and the links and url tooltips for the + metaconsole networkmap. + + * operation/agentes/ver_agente.php: in the request for the + "get_agentmodule_status_tooltip" added code for get data in the + metaconsole. + 2012-10-24 Miguel de Dios * extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql, diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index 2bf6a6fe6f..5fb0530c49 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -416,7 +416,7 @@ function networkmap_create_edge ($head, $tail, $layout, $nooverlap, $pure, $zoom } // Returns a group node definition -function networkmap_create_group_node ($group, $simple = 0, $font_size = 10) { +function networkmap_create_group_node ($group, $simple = 0, $font_size = 10, $metaconsole = false, $id_server = null) { $status = groups_get_status ($group['id_grupo']); // Set node status @@ -547,38 +547,73 @@ function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cu } // Returns a module node definition -function networkmap_create_module_node ($module, $simple = 0, $font_size = 10, $metaconsole = true, $id_server = null) { +function networkmap_create_module_node ($module, $simple = 0, $font_size = 10, $metaconsole = false, $id_server = null) { + $status = modules_get_agentmodule_status($module['id_agente_modulo'], false, $metaconsole, $id_server); // Set node status switch($status) { case 0: - $status_color = '#8DFF1D'; // Normal monitor + $status_color = '#8DFF1D'; // Normal monitor break; case 1: - $status_color = '#FF1D1D'; // Critical monitor + $status_color = '#FF1D1D'; // Critical monitor break; case 2: - $status_color = '#FFE308'; // Warning monitor + $status_color = '#FFE308'; // Warning monitor break; case 4: - $status_color = '#FFA300'; // Alert fired + $status_color = '#FFA300'; // Alert fired break; default: - $status_color = '#BBBBBB'; // Unknown monitor + $status_color = '#BBBBBB'; // Unknown monitor break; } - if ($simple == 0){ - $node = $module['id_node'].' [ color="'.$status_color.'", fontsize='.$font_size.', style="filled", fixedsize=true, width=0.30, height=0.30, label=< -
' . ui_print_moduletype_icon ($module['id_tipo_modulo'], true, true, false). '
'.io_safe_output($module['nombre']).'
>, - shape="circle", URL="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$module['id_agente'].'", - tooltip="ajax.php?page=operation/agentes/ver_agente&get_agentmodule_status_tooltip=1&id_module='.$module['id_agente_modulo'].'"];'; + if ($simple == 0) { + if (defined("METACONSOLE")) { + $url = 'TODO'; + $url_tooltip = '../../ajax.php?' . + 'page=operation/agentes/ver_agente&' . + 'get_agentmodule_status_tooltip=1&' . + 'id_module='.$module['id_agente_modulo'] . + '&metaconsole=1' . + '&id_server=' . $module['id_server']; + } + else { + $url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$module['id_agente']; + $url_tooltip = 'ajax.php?page=operation/agentes/ver_agente&get_agentmodule_status_tooltip=1&id_module='.$module['id_agente_modulo']; + } + + $node = $module['id_node'].' [ color="' . $status_color . + '", fontsize='.$font_size.', style="filled", ' . + 'fixedsize=true, width=0.30, height=0.30, ' . + 'label=< +
' . + ui_print_moduletype_icon ($module['id_tipo_modulo'], true, true, false). '
' . io_safe_output($module['nombre']) . '
>, + shape="circle", URL="' . $url . '", + tooltip="' . $url_tooltip . '"];'; } else { - $node = $module['id_node'] . ' [ color="'.$status_color.'", fontsize='.$font_size.', shape="circle", URL="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$module['id_agente'].'", style="filled", fixedsize=true, width=0.20, height=0.20, label="", tooltip="ajax.php?page=operation/agentes/ver_agente&get_agentmodule_status_tooltip=1&id_module='.$module['id_agente_modulo'].'"];'; + if (defined("METACONSOLE")) { + $url = 'TODO'; + $url_tooltip = '../../ajax.php?page=operation/agentes/ver_agente' . + '&get_agentmodule_status_tooltip=1' . + '&id_module=' . $module['id_agente_modulo'] . + '&metaconsole=1' . + '&id_server=' . $module['id_server']; + } + else { + $url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$module['id_agente']; + $url_tooltip = 'ajax.php?page=operation/agentes/ver_agente&get_agentmodule_status_tooltip=1&id_module='.$module['id_agente_modulo']; + } + + $node = $module['id_node'] . ' [ color="'.$status_color . + '", fontsize='.$font_size.', shape="circle", URL="' . $url . '", ' . + 'style="filled", fixedsize=true, width=0.20, ' . + 'height=0.20, label="", tooltip="' . $url_tooltip . '"];'; } return $node; } @@ -725,7 +760,7 @@ function networkmap_get_filter ($layout) { * * @return mixed New networkmap id if created. False if it could not be created. */ -function networkmap_create_networkmap ($name, $type = 'topology', $layout = 'radial', $nooverlap = true, $simple = false, $regenerate = true, $font_size = 12, $id_group = 0, $id_module_group = 0, $depth = 'all', $only_modules_with_alerts = false, $hide_policy_modules = false, $zoom = 1, $distance_nodes = 2.5, $center = 0, $text_filter = '', $dont_show_subgroups = 0) { +function networkmap_create_networkmap ($name, $type = 'topology', $layout = 'radial', $nooverlap = true, $simple = false, $regenerate = true, $font_size = 12, $id_group = 0, $id_module_group = 0, $depth = 'all', $only_modules_with_alerts = false, $hide_policy_modules = false, $zoom = 1, $distance_nodes = 2.5, $center = 0, $text_filter = '', $dont_show_subgroups = 0, $show_groups = false, $show_modules = false) { global $config; diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 694e5db5d7..5a090ab96a 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -513,7 +513,19 @@ if (is_ajax ()) { if ($get_agentmodule_status_tooltip) { $id_module = (int) get_parameter ('id_module'); + $metaconsole = (bool)get_parameter('metaconsole'); + $id_server = (int)get_parameter('id_server'); + + if ($metaconsole) { + $server = db_get_row('tmetaconsole_setup', 'id', $id_server); + + if (metaconsole_connect($server) != NOERR) { + return; + } + } + $module = db_get_row ('tagente_modulo', 'id_agente_modulo', $id_module); + echo '

'; echo html_print_image("images/brick.png", true) . ' '; echo ui_print_truncate_text($module['nombre'], 'module_small', false, true, false).'

'; @@ -552,6 +564,11 @@ if (is_ajax ()) { echo ''; } } + + if ($metaconsole) { + metaconsole_restore_db(); + } + return; }