2012-10-25 Miguel de Dios <miguel.dedios@artica.es>

* 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
This commit is contained in:
mdtrooper 2012-10-25 08:53:44 +00:00
parent 7d2d861527
commit 58c2bb89b0
3 changed files with 80 additions and 14 deletions

View File

@ -1,3 +1,17 @@
2012-10-25 Miguel de Dios <miguel.dedios@artica.es>
* 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 <miguel.dedios@artica.es>
* extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,

View File

@ -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=<<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR><TD>' . ui_print_moduletype_icon ($module['id_tipo_modulo'], true, true, false). '</TD></TR>
<TR><TD>'.io_safe_output($module['nombre']).'</TD></TR></TABLE>>,
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=<<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR><TD>' .
ui_print_moduletype_icon ($module['id_tipo_modulo'], true, true, false). '</TD></TR>
<TR><TD>' . io_safe_output($module['nombre']) . '</TD></TR></TABLE>>,
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;

View File

@ -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 '<h3>';
echo html_print_image("images/brick.png", true) . '&nbsp;';
echo ui_print_truncate_text($module['nombre'], 'module_small', false, true, false).'</h3>';
@ -552,6 +564,11 @@ if (is_ajax ()) {
echo '</ul>';
}
}
if ($metaconsole) {
metaconsole_restore_db();
}
return;
}