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

* extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
	extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
	extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql, pandoradb.sql,
	pandoradb.postgreSQL.sql, pandoradb.oracle.sql: added flag field
	"pandoras_children" into the table "tnetwork_map".
	
	* extras/check_other_languages.sh, include/functions_agents.php,
	operation/agentes/networkmap_list.php: cleaned source code style.
	
	* include/functions_networkmap.php: a lot of fixes for the
	metaconsole, and other changes now generate a graphviz code more
	clean and human readble (good for maintenaince).
	
	* include/ajax/networkmap.ajax.php: into the ajax call
	"get_networkmap_summary" started to adapt to call from the
	metaconsole (WIP).
	
	* include/functions_ui.php: fixes for metaconsole links to images in
	the functions "ui_print_message", "ui_print_group_icon" and
	"ui_toggle". And added the parameter $return in the function
	"ui_toggle" for to return the html code as string.
	
	* operation/agentes/ver_agente.php: into the ajax call
	"get_agent_status_tooltip" adapt to call from the metaconsole.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7057 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-10-09 15:51:33 +00:00
parent e86a0e68ef
commit c6b977c0a5
14 changed files with 406 additions and 192 deletions

View File

@ -1,3 +1,30 @@
2012-10-09 Miguel de Dios <miguel.dedios@artica.es>
* extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql, pandoradb.sql,
pandoradb.postgreSQL.sql, pandoradb.oracle.sql: added flag field
"pandoras_children" into the table "tnetwork_map".
* extras/check_other_languages.sh, include/functions_agents.php,
operation/agentes/networkmap_list.php: cleaned source code style.
* include/functions_networkmap.php: a lot of fixes for the
metaconsole, and other changes now generate a graphviz code more
clean and human readble (good for maintenaince).
* include/ajax/networkmap.ajax.php: into the ajax call
"get_networkmap_summary" started to adapt to call from the
metaconsole (WIP).
* include/functions_ui.php: fixes for metaconsole links to images in
the functions "ui_print_message", "ui_print_group_icon" and
"ui_toggle". And added the parameter $return in the function
"ui_toggle" for to return the html code as string.
* operation/agentes/ver_agente.php: into the ajax call
"get_agent_status_tooltip" adapt to call from the metaconsole.
2012-10-09 Hirofumi Kosaka <kosaka@rworks.jp>
* pandoradb.sql: cleaned code style, to be acceptable by

View File

@ -310,6 +310,7 @@ ALTER TABLE tlayout_data ADD COLUMN `enable_link` tinyint(1) UNSIGNED NOT NULL
------------------------------------------------------------------------
ALTER TABLE tnetwork_map ADD `text_filter` VARCHAR(100) NOT NULL DEFAULT "";
ALTER TABLE tnetwork_map ADD `dont_show_subgroups` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE tnetwork_map ADD `pandoras_children` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
-- ----------------------------------------------------------------------
-- Table `tagente_estado`

View File

@ -18,9 +18,9 @@ ALTER TABLE tusuario ADD COLUMN (metaconsole_access VARCHAR2(100) DEFAULT 'only_
ALTER TABLE tusuario ADD CONSTRAINT t_usuario_metaconsole_access_cons CHECK (metaconsole_access IN ('basic','advanced','custom','all','only_console'));
ALTER TABLE tusuario ADD COLUMN (not_login NUMBER(5,0) default 0 NOT NULL);
-- -----------------------------------------------------
-- ---------------------------------------------------------------------
-- Table "tnetflow_filter"
-- -----------------------------------------------------
-- ---------------------------------------------------------------------
CREATE TABLE tnetflow_filter (
id_sg NUMBER(10, 0) NOT NULL PRIMARY KEY,
id_name VARCHAR2(600) NOT NULL,
@ -341,6 +341,7 @@ evento
------------------------------------------------------------------------
ALTER TABLE tnetwork_map ADD (text_filter VARCHAR(100) DEFAULT '');
ALTER TABLE tnetwork_map ADD (dont_show_subgroups NUMBER(10, 0) default 0 NOT NULL);
ALTER TABLE tnetwork_map ADD (pandoras_children NUMBER(10, 0) default 0 NOT NULL);
------------------------------------------------------------------------
-- Table `tagente_estado`

View File

@ -332,6 +332,7 @@ ALTER TABLE "tnetwork_component" ADD COLUMN "warning_inverse" SMALLINT NOT NULL
------------------------------------------------------------------------
ALTER TABLE "tnetwork_map" ADD COLUMN "text_filter" VARCHAR(100) DEFAULT '';
ALTER TABLE "tnetwork_map" ADD COLUMN "dont_show_subgroups" INTEGER NOT NULL DEFAULT 0;
ALTER TABLE "tnetwork_map" ADD COLUMN "pandoras_children" INTEGER NOT NULL DEFAULT 0;
------------------------------------------------------------------------
-- Table `tagente_estado`

View File

@ -32,20 +32,32 @@ switch($action) {
case 'get_networkmap_summary':
$stats = get_parameter('stats', array());
$stats = json_decode(base64_decode($stats),true);
$metaconsole = (bool)get_parameter('metaconsole', false);
$hack_metaconsole = '';
if ($metaconsole) {
$hack_metaconsole = '../../';
}
$summary = '<br>';
if (isset($stats['policies'])) {
$summary .= count($stats['policies'])." x ".html_print_image('images/policies.png',true).' '.__('Policies')."<br>";
$summary .= count($stats['policies']) . " x " .
html_print_image($hack_metaconsole . 'images/policies.png',true) . ' '.
__('Policies') . "<br>";
}
if (isset($stats['groups'])) {
// TODO: GET STATUS OF THE GROUPS AND ADD IT TO SUMMARY
$summary .= count($stats['groups'])." x ".html_print_image('images/group.png',true).' '.__('Groups')."<br>";
$summary .= count($stats['groups']) . " x " .
html_print_image($hack_metaconsole . 'images/group.png',true) . ' ' .
__('Groups') . "<br>";
}
if (isset($stats['agents'])) {
$summary .= count($stats['agents'])." x ".html_print_image('images/bricks.png',true).' '.__('Agents')."<br>";
$summary .= count($stats['agents']) .
" x " . html_print_image($hack_metaconsole . 'images/bricks.png',true) .
' ' . __('Agents') . "<br>";
// TODO: GET STATUS OF THE AGENTS AND ADD IT TO SUMMARY
//~ $status_agents = array();
//~ foreach($stats['agents'] as $id_agent) {

View File

@ -26,7 +26,10 @@ require_once ('functions_agents.php');
require_once($config['homedir'] . "/include/functions_modules.php");
require_once($config['homedir'] . "/include/functions_groups.php");
ui_require_css_file ('cluetip');
ui_require_jquery_file ('cluetip');
$hack_metaconsole = '';
if (defined('METACONSOLE'))
$hack_metaconsole = '../../';
ui_require_jquery_file ('cluetip', $hack_metaconsole . 'include/javascript/');
// Check if a node descends from a given node
function networkmap_is_descendant ($node, $ascendant, $parents) {
@ -394,12 +397,19 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0, $simple = 0,
// Returns an edge definition
function networkmap_create_edge ($head, $tail, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group, $sec2 = 'operation/agentes/networkmap', $tab = 'topology', $id_networkmap = 0) {
// edgeURL allows node navigation
$edge = $head.' -- '.$tail.'[color="#BDBDBD", headclip=false, tailclip=false,
edgeURL="index.php?sec=estado&sec2='.$sec2.'&tab='.$tab.'&recenter_networkmap=1&center='.$head.
if (defined("METACONSOLE")) {
$url = '';
}
else {
$url = 'index.php?sec=estado&sec2='.$sec2.'&tab='.$tab.'&recenter_networkmap=1&center='.$head.
'&layout='.$layout.'&nooverlap=' .$nooverlap.'&pure='.$pure.
'&zoom='.$zoom.'&ranksep='.$ranksep.'&simple='.$simple.'&regen=1'.
'&font_size='.$font_size.'&group='.$group.'&id_networkmap='.$id_networkmap.'"];';
'&font_size='.$font_size.'&group='.$group.'&id_networkmap='.$id_networkmap;
}
// edgeURL allows node navigation
$edge = "\n" . $head.' -- '.$tail.'[color="#BDBDBD", headclip=false, tailclip=false,
edgeURL=""];' . "\n";
return $edge;
}
@ -445,13 +455,13 @@ function networkmap_create_group_node ($group, $simple = 0, $font_size = 10) {
$name = groups_get_name($group['id_grupo']);
}
$node = $group['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>'.$img_node.'</TD></TR>
$node = "\n" . $group['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>'.$img_node.'</TD></TR>
<TR><TD>'.io_safe_output($name).'</TD></TR></TABLE>>,
shape="invtrapezium", URL="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.$group['id_grupo'].'",
tooltip="ajax.php?page=operation/agentes/ver_agente&get_group_status_tooltip=1&id_group='.$group['id_grupo'].'"];';
tooltip="ajax.php?page=operation/agentes/ver_agente&get_group_status_tooltip=1&id_group='.$group['id_grupo'].'"];' . "\n";
}
else {
$node = $group['id_node'] . ' [ color="'.$status_color.'", fontsize='.$font_size.', shape="invtrapezium", URL="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.$group['id_grupo'].'", style="filled", fixedsize=true, width=0.20, height=0.20, label="", tooltip="ajax.php?page=operation/agentes/ver_agente&get_group_status_tooltip=1&id_group='.$group['id_grupo'].'"];';
$node = "\n" . $group['id_node'] . ' [ color="'.$status_color.'", fontsize='.$font_size.', shape="invtrapezium", URL="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.$group['id_grupo'].'", style="filled", fixedsize=true, width=0.20, height=0.20, label="", tooltip="ajax.php?page=operation/agentes/ver_agente&get_group_status_tooltip=1&id_group='.$group['id_grupo'].'"];' . "\n";
}
return $node;
}
@ -492,6 +502,10 @@ function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cu
$img_node = ui_print_os_icon ($agent['id_os'], false, true, true, true, true, $relative);
$img_node = str_replace($config['homeurl'] . '/', '', $img_node);
if (defined('METACONSOLE')) {
$img_node = '../../' . $img_node;
}
if ($relative) {
$img_node = html_print_image($img_node, true, false, false, true);
}
@ -499,13 +513,27 @@ function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cu
$img_node = html_print_image($img_node, true, false, false, false);
}
$node = $agent['id_node'].' [ color="'.$status_color.'", fontsize='.$font_size.', style="filled", fixedsize=true, width=0.40, height=0.40, label=<<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR><TD>' . $img_node . '</TD></TR>
<TR><TD>'.io_safe_output($name).'</TD></TR></TABLE>>,
shape="doublecircle", URL="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'",
tooltip="ajax.php?page=operation/agentes/ver_agente&get_agent_status_tooltip=1&id_agent='.$agent['id_agente'].'"];';
if (defined("METACONSOLE")) {
$url = 'TODO'; //TODO
$url_tooltip = '../../ajax.php?' .
'page=operation/agentes/ver_agente&' .
'get_agent_status_tooltip=1&' .
'id_agent='.$agent['id_agente'] . '&' .
'metaconsole=1&' .
'id_server=' . $agent['id_server'];
}
else {
$node = $agent['id_node'] . ' [ color="' . $status_color . '", fontsize='.$font_size.', shape="doublecircle", URL="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'",style="filled", fixedsize=true, width=0.20, height=0.20, label="", tooltip="ajax.php?page=operation/agentes/ver_agente&get_agent_status_tooltip=1&id_agent='.$agent['id_agente'].'"];';
$url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'];
$url_tooltip = 'ajax.php?page=operation/agentes/ver_agente&get_agent_status_tooltip=1&id_agent='.$agent['id_agente'];
}
$node = "\n" . $agent['id_node'].' [ color="'.$status_color.'", fontsize='.$font_size.', style="filled", fixedsize=true, width=0.40, height=0.40, label=<<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR><TD>' . $img_node . '</TD></TR>
<TR><TD>'.io_safe_output($name).'</TD></TR></TABLE>>,
shape="doublecircle", URL="'.$url.'",
tooltip="' . $url_tooltip . '"];' . "\n";
}
else {
$node = $agent['id_node'] . ' [ color="' . $status_color . '", fontsize='.$font_size.', shape="doublecircle", URL="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'",style="filled", fixedsize=true, width=0.20, height=0.20, label="", tooltip="ajax.php?page=operation/agentes/ver_agente&get_agent_status_tooltip=1&id_agent='.$agent['id_agente'].'"];' . "\n";
}
return $node;
@ -549,17 +577,36 @@ function networkmap_create_module_node ($module, $simple = 0, $font_size = 10) {
// Returns the definition of the central module
function networkmap_create_pandora_node ($name, $font_size = 10, $simple = 0, $stats = array()) {
$img = '<TR><TD>' . html_print_image("images/networkmap/pandora_node.png", true, false, false, true) . '</TD></TR>';
$stats_json = base64_encode(json_encode($stats));
$img_src = "images/networkmap/pandora_node.png";
if (defined('METACONSOLE')) {
$img_src = '../../' . $img_src;
$url_tooltip = '../../ajax.php?' .
'page=include/ajax/networkmap.ajax&' .
'action=get_networkmap_summary&' .
'stats='.$stats_json . '&' .
'metaconsole=1';
$url = 'index.php?sec=monitoring&sec2=monitoring/tree_view';
}
else {
$url_tooltip = 'ajax.php?page=include/ajax/networkmap.ajax&action=get_networkmap_summary&stats='.$stats_json.'", URL="index.php?sec=estado&sec2=operation/agentes/group_view';
$url = 'index.php?sec=estado&sec2=operation/agentes/group_view';
}
$img_tag = html_print_image($img_src, true, false, false, true);
$img = '<TR><TD>' . $img_tag . '</TD></TR>';
$name = '<TR><TD BGCOLOR="#FFFFFF">'.$name.'</TD></TR>';
$label = '<TABLE BORDER="0">'.$img.$name.'</TABLE>';
if ($simple == 1) {
$label = '';
}
$stats_json = base64_encode(json_encode($stats));
$node = '0 [ color="#364D1F", fontsize='.$font_size.', style="filled", fixedsize=true, width=0.8, height=0.6, label=<'.$label.'>,
shape="ellipse", tooltip="ajax.php?page=include/ajax/networkmap.ajax&action=get_networkmap_summary&stats='.$stats_json.'", URL="index.php?sec=estado&sec2=operation/agentes/group_view" ];';
shape="ellipse", tooltip="' . $url_tooltip . '", URL="' . $url . '" ];';
return $node;
}

View File

@ -181,6 +181,10 @@ function printSmallFont ($string, $return = true) {
* @return string HTML code if return parameter is true.
*/
function ui_print_message ($message, $class = '', $attributes = '', $return = false, $tag = 'h3') {
$hack_metaconsole = '';
if (defined('METACONSOLE'))
$hack_metaconsole = '../../';
static $first_execution = true;
$text_title = '';
@ -232,6 +236,8 @@ function ui_print_message ($message, $class = '', $attributes = '', $return = fa
$icon_image = 'images/suc.png';
break;
}
$icon_image = $hack_metaconsole . $icon_image;
}
$id = 'info_box_' . uniqid();
@ -244,7 +250,7 @@ function ui_print_message ($message, $class = '', $attributes = '', $return = fa
<td class="icon">';
if (!$no_close_bool) {
$output .= '<a href="javascript: close_info_box(\'' . $id . '\')">' .
html_print_image('images/cross.disabled.png', true) . '</a>';
html_print_image($hack_metaconsole . 'images/cross.disabled.png', true) . '</a>';
}
$output .= '</td>
@ -482,8 +488,14 @@ function ui_print_group_icon ($id_group, $return = false, $path = "groups_small"
if (empty ($icon))
$output .= '<span title="'. groups_get_name($id_group, true).'">&nbsp;-&nbsp</span>';
else
$output .= html_print_image("images/" . $path . "/" . $icon . ".png", true, array("style" => $style, "class" => "bot", "alt" => groups_get_name($id_group, true), "title" => groups_get_name ($id_group, true)));
else {
$hack_metaconsole = '';
if (defined('METACONSOLE'))
$hack_metaconsole = '../../';
$output .= html_print_image($hack_metaconsole . "images/" . $path . "/" . $icon . ".png",
true, array("style" => $style, "class" => "bot", "alt" => groups_get_name($id_group, true), "title" => groups_get_name ($id_group, true)));
}
if ($link)
$output .= '</a>';
@ -1712,10 +1724,15 @@ function ui_print_status_image ($type, $title = "", $return = false, $options =
* @param string name of the link
* @param string title of the link
* @param bool if the div will be hidden by default (default: true)
* @param bool Whether to return an output string or echo now (default: true)
*
*/
function ui_toggle($code, $name, $title = '', $hidde_default = true) {
function ui_toggle($code, $name, $title = '', $hidde_default = true, $return = false) {
$hack_metaconsole = '';
if (defined('METACONSOLE'))
$hack_metaconsole = '../../';
// Generate unique Id
$uniqid = uniqid('');
@ -1724,41 +1741,49 @@ function ui_toggle($code, $name, $title = '', $hidde_default = true) {
$style = 'display:none';
$toggle_a = "$('#tgl_div_".$uniqid."').show();";
$toggle_b = "$('#tgl_div_".$uniqid."').hide();";
$image_a = html_print_image("images/go.png", true, false, true);
$image_b = html_print_image("images/down.png", true, false, true);
$original = "images/down.png";
$image_a = html_print_image($hack_metaconsole . "images/go.png", true, false, true);
$image_b = html_print_image($hack_metaconsole . "images/down.png", true, false, true);
$original = $hack_metaconsole . "images/down.png";
}
else {
$style = '';
$toggle_a = "$('#tgl_div_".$uniqid."').hide();";
$toggle_b = "$('#tgl_div_".$uniqid."').show();";
$image_a = html_print_image("images/down.png", true, false, true);
$image_b = html_print_image("images/go.png", true, false, true);
$original = "images/go.png";
$image_a = html_print_image($hack_metaconsole . "images/down.png", true, false, true);
$image_b = html_print_image($hack_metaconsole . "images/go.png", true, false, true);
$original = $hack_metaconsole . "images/go.png";
}
// Link to toggle
echo '<a href="#" id="tgl_ctrl_'.$uniqid.'"><b>'.$name.'</b>&nbsp;'.html_print_image ($original, true, array ("title" => $title, "id" => "image_".$uniqid)).'</a><br /><br />';
$output = '';
$output .= '<a href="#" id="tgl_ctrl_'.$uniqid.'"><b>'.$name.'</b>&nbsp;'.html_print_image ($original, true, array ("title" => $title, "id" => "image_".$uniqid)).'</a><br /><br />';
// Code into a div
echo "<div id='tgl_div_".$uniqid."' style='".$style."'>\n";
echo $code;
echo "</div>";
$output .= "<div id='tgl_div_".$uniqid."' style='".$style."'>\n";
$output .= $code;
$output .= "</div>";
// JQuery Toggle
echo '<script type="text/javascript">';
echo '/* <![CDATA[ */';
echo "$(document).ready (function () {";
echo "$('#tgl_ctrl_".$uniqid."').toggle(function() {";
echo $toggle_a;
echo "$('#image_".$uniqid."').attr({src: '".$image_a."'});";
echo "}, function() {";
echo $toggle_b;
echo "$('#image_".$uniqid."').attr({src: '".$image_b."'});";
echo "});";
echo "});";
echo '/* ]]> */';
echo '</script>';
$output .= '<script type="text/javascript">';
$output .= '/* <![CDATA[ */';
$output .= "$(document).ready (function () {";
$output .= "$('#tgl_ctrl_".$uniqid."').toggle(function() {";
$output .= $toggle_a;
$output .= "$('#image_".$uniqid."').attr({src: '".$image_a."'});";
$output .= "}, function() {";
$output .= $toggle_b;
$output .= "$('#image_".$uniqid."').attr({src: '".$image_b."'});";
$output .= "});";
$output .= "});";
$output .= '/* ]]> */';
$output .= '</script>';
if (!$return) {
echo $output;
}
else {
return $output;
}
}
/**

View File

@ -49,22 +49,39 @@ if ($delete_networkmap) {
$group_search = get_parameter('group_search', '0');
$type_search = get_parameter('type_filter', '0');
echo '<form method="post" action="index.php?sec=network&amp;sec2=operation/agentes/networkmap_list">';
echo "<table style='width: 100%' class='databox'>";
echo "<tr><td class='datos' >";
echo __('Group');
echo "</td><td class='datos'>";
html_print_select_groups($config['id_user'], 'AR', true, 'group_search', $group_search);
echo "</td><td class='datos'>";
echo __('Type');
echo "</td><td class='datos'>";
?>
<form method="post" action="index.php?sec=network&amp;sec2=operation/agentes/networkmap_list">
<table style='width: 100%' class='databox'>
<tr>
<td class='datos' >
<?php echo __('Group'); ?>
</td>
<td class='datos'>
<?php
html_print_select_groups($config['id_user'], 'AR',
true, 'group_search', $group_search);
?>
</td>
<td class='datos'>
<?php echo __('Type'); ?>
</td>
<td class='datos'>
<?php
$networkmap_filter_types = networkmap_get_filter_types();
html_print_select($networkmap_filter_types, 'type_filter', $type_search, '', __('All'), 0, false);
echo "</td>";
echo "<td class='datos'>";
html_print_submit_button (__('Filter'), 'crt', false, 'class="sub search"');
echo "</td></tr></table>";
echo "</form>";
html_print_select($networkmap_filter_types, 'type_filter',
$type_search, '', __('All'), 0, false);
?>
</td>
<td class='datos'>
<?php
html_print_submit_button (__('Filter'), 'crt', false,
'class="sub search"');
?>
</td>
</tr>
</table>
</form>
<?php
// Display table
$table = null;
@ -150,14 +167,21 @@ else {
// Create networkmap form
$networkmap_types = networkmap_get_types();
echo "<table style='width: 100%' class='databox'>";
echo "<tr><td class='datos' style='width: 50%'>";
echo '<form method="post" action="index.php?sec=network&amp;sec2=operation/agentes/networkmap">';
?>
<form method="post" action="index.php?sec=network&amp;sec2=operation/agentes/networkmap">
<table style='width: 100%' class='databox'>
<tr>
<td class='datos' style='width: 50%'>
<?php
html_print_input_hidden('add_networkmap', 1);
html_print_select($networkmap_types, 'tab', 'topology', '');
echo "</td><td class='datos'>";
html_print_submit_button (__('Create networkmap'), 'crt', false, 'class="sub next"');
echo "</form>";
echo "</td></tr></table>";
?>
</td>
<td class='datos'>
<?php
html_print_submit_button (__('Create networkmap'), 'crt', false, 'class="sub next"');
?>
</td>
</tr>
</table>
</form>

View File

@ -357,16 +357,43 @@ if (is_ajax ()) {
if ($get_agent_status_tooltip) {
$id_agent = (int) get_parameter ('id_agent');
$metaconsole = (bool)get_parameter('metaconsole', false);
$id_server = (int)get_parameter('id_server', 0); //Metaconsole
$server = null;
if ($metaconsole) {
$server = db_get_row('tmetaconsole_setup', 'id', $id_server);
if (metaconsole_connect($server) != NOERR) {
return;
}
$agent = db_get_row ('tagente', 'id_agente', $id_agent);
metaconsole_restore_db();
}
else {
$agent = db_get_row ('tagente', 'id_agente', $id_agent);
}
echo '<h3>'.$agent['nombre'].'</h3>';
echo '<strong>'.__('Main IP').':</strong> '.$agent['direccion'].'<br />';
echo '<strong>'.__('Group').':</strong> ';
echo html_print_image('images/groups_small/'.groups_get_icon ($agent['id_grupo']).'.png', true);
$hack_metaconsole = '';
if ($metaconsole) {
$hack_metaconsole = '../../';
}
echo html_print_image($hack_metaconsole . 'images/groups_small/'.groups_get_icon ($agent['id_grupo']).'.png', true);
echo groups_get_name ($agent['id_grupo']).'<br />';
echo '<strong>'.__('Last contact').':</strong> '.human_time_comparation($agent['ultimo_contacto']).'<br />';
echo '<strong>'.__('Last remote contact').':</strong> '.human_time_comparation($agent['ultimo_contacto_remoto']).'<br />';
$sql = sprintf ('SELECT tagente_modulo.descripcion,
tagente_modulo.nombre
FROM tagente_estado, tagente_modulo
@ -374,13 +401,36 @@ if (is_ajax ()) {
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND tagente_modulo.disabled = 0
AND tagente_estado.estado = 1', $id_agent);
if ($metaconsole) {
if (metaconsole_connect($server) != NOERR) {
return;
}
$bad_modules = db_get_all_rows_sql ($sql);
metaconsole_restore_db();
}
else {
$bad_modules = db_get_all_rows_sql ($sql);
}
$sql = sprintf ('SELECT COUNT(*)
FROM tagente_modulo
WHERE id_agente = %d
AND disabled = 0', $id_agent);
if ($metaconsole) {
if (metaconsole_connect($server) != NOERR) {
return;
}
$total_modules = db_get_sql ($sql);
metaconsole_restore_db();
}
else {
$total_modules = db_get_sql ($sql);
}
if ($bad_modules === false)
$size_bad_modules = 0;
else
@ -408,7 +458,19 @@ if (is_ajax ()) {
AND tagente_modulo.id_agente_modulo = talert_template_modules.id_agent_module
AND talert_template_modules.times_fired > 0 ',
$id_agent);
if ($metaconsole) {
if (metaconsole_connect($server) != NOERR) {
return;
}
$alert_modules = db_get_sql ($sql);
metaconsole_restore_db();
}
else {
$alert_modules = db_get_sql ($sql);
}
if ($alert_modules > 0) {
$sql = sprintf ('SELECT tagente_modulo.nombre, talert_template_modules.last_fired
FROM talert_template_modules, tagente_modulo, tagente
@ -419,7 +481,18 @@ if (is_ajax ()) {
AND tagente_modulo.id_agente_modulo = talert_template_modules.id_agent_module
AND talert_template_modules.times_fired > 0 ',
$id_agent);
if ($metaconsole) {
if (metaconsole_connect($server) != NOERR) {
return;
}
$alerts = db_get_all_rows_sql ($sql);
metaconsole_restore_db();
}
else {
$alerts = db_get_all_rows_sql ($sql);
}
echo '<strong>'.__('Alerts fired').':</strong>';
echo "<ul>";
foreach ($alerts as $alert_item) {

View File

@ -40,9 +40,9 @@ CREATE SEQUENCE taddress_s INCREMENT BY 1 START WITH 1;
-- Triggers must end with double semicolons because Pandora installer need it
CREATE OR REPLACE TRIGGER taddress_inc BEFORE INSERT ON taddress REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT taddress_s.nextval INTO :NEW.ID_A FROM dual; END;;
-- -----------------------------------------------------
-- ---------------------------------------------------------------------
-- Table `taddress_agent`
-- -----------------------------------------------------
-- ---------------------------------------------------------------------
CREATE TABLE taddress_agent (
id_ag NUMBER(19, 0) NOT NULL PRIMARY KEY,
id_a NUMBER(19, 0) default 0 NOT NULL,
@ -1502,7 +1502,8 @@ CREATE TABLE tnetwork_map (
contracted_nodes CLOB,
show_snmp_modules NUMBER(5, 0) default 0 NOT NULL,
text_filter VARCHAR(100) DEFAULT '',
dont_show_subgroups NUMBER(10, 0) default 0 NOT NULL
dont_show_subgroups NUMBER(10, 0) default 0 NOT NULL,
pandoras_children NUMBER(10, 0) default 0 NOT NULL
);
CREATE SEQUENCE tnetwork_map_s INCREMENT BY 1 START WITH 1;

View File

@ -1280,7 +1280,8 @@ CREATE TABLE "tnetwork_map" (
"contracted_nodes" TEXT,
"show_snmp_modules" SMALLINT NOT NULL default 0,
"text_filter" VARCHAR(100) DEFAULT '',
"dont_show_subgroups" INTEGER NOT NULL default 0
"dont_show_subgroups" INTEGER NOT NULL default 0,
"pandoras_children" INTEGER NOT NULL default 0
);
------------------------------------------------------------------------

View File

@ -1311,9 +1311,9 @@ CREATE TABLE IF NOT EXISTS `tgis_map` (
ENGINE = InnoDB
COMMENT = 'Table containing information about a gis map';
-- -----------------------------------------------------
-- ---------------------------------------------------------------------
-- Table `tgis_map_connection`
-- -----------------------------------------------------
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tgis_map_connection` (
`id_tmap_connection` INT NOT NULL AUTO_INCREMENT COMMENT 'table id' ,
`conection_name` VARCHAR(45) NULL COMMENT 'Name of the connection (name of the base layer)' ,
@ -1445,6 +1445,7 @@ CREATE TABLE IF NOT EXISTS `tnetwork_map` (
`show_snmp_modules` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
`text_filter` VARCHAR(100) NOT NULL DEFAULT "",
`dont_show_subgroups` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
`pandoras_children` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (`id_networkmap`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -1558,9 +1559,9 @@ CREATE TABLE IF NOT EXISTS `tnetflow_report` (
PRIMARY KEY(`id_report`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- ---------------------------------------------------------------------
-- Table `tnetflow_report_content`
-- -----------------------------------------------------
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tnetflow_report_content` (
`id_rc` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
@ -1578,9 +1579,9 @@ CREATE TABLE IF NOT EXISTS `tnetflow_report_content` (
ON DELETE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- ---------------------------------------------------------------------
-- Table `tevent_filter`
-- -----------------------------------------------------
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tevent_filter` (
`id_filter` int(10) unsigned NOT NULL auto_increment,