2010-07-30 Sergio Martin <sergio.martin@artica.es>

* include/functions_networkmap.php
	include/help/en/help_network_map.php
	include/help/es/help_network_map.php
	pandoradb.sql
	operation/agentes/networkmap.topology.php
	operation/agentes/networkmap.groups.php
	operation/agentes/ver_agente.php
	operation/agentes/networkmap.php
	extras/pandoradb_migrate_v3.1_to_v3.2.sql: Created network maps
	storage on database, clean the network maps code and fixed some
	little bugs of the same section



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3078 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2010-07-30 09:03:23 +00:00
parent b40c7b00d7
commit 08adfae6d0
10 changed files with 616 additions and 327 deletions

View File

@ -1,3 +1,17 @@
2010-07-30 Sergio Martin <sergio.martin@artica.es>
* include/functions_networkmap.php
include/help/en/help_network_map.php
include/help/es/help_network_map.php
pandoradb.sql
operation/agentes/networkmap.topology.php
operation/agentes/networkmap.groups.php
operation/agentes/ver_agente.php
operation/agentes/networkmap.php
extras/pandoradb_migrate_v3.1_to_v3.2.sql: Created network maps
storage on database, clean the network maps code and fixed some
little bugs of the same section
2010-07-29 Ramon Novoa <rnovoa@artica.es>
* include/functions_reporting.php: Updated reporting functions to work

View File

@ -35,3 +35,29 @@ ALTER TABLE `treport_content` ADD COLUMN `thursday` tinyint(1) default 1;
ALTER TABLE `treport_content` ADD COLUMN `friday` tinyint(1) default 1;
ALTER TABLE `treport_content` ADD COLUMN `saturday` tinyint(1) default 1;
ALTER TABLE `treport_content` ADD COLUMN `sunday` tinyint(1) default 1;
-- -----------------------------------------------------
-- Table `tnetwork_map`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `tnetwork_map2` (
`id_networkmap` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`id_user` VARCHAR(60) NOT NULL,
`name` VARCHAR(100) NOT NULL,
`type` VARCHAR(20) NOT NULL,
`layout` VARCHAR(20) NOT NULL,
`nooverlap` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
`simple` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
`regenerate` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
`font_size` INT UNSIGNED NOT NULL DEFAULT 12,
`id_group` INT NOT NULL DEFAULT 0,
`id_module_group` INT NOT NULL DEFAULT 0,
`id_policy` INT NOT NULL DEFAULT 0,
`depth` VARCHAR(20) NOT NULL,
`only_modules_with_alerts` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
`hide_policy_modules` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
`zoom` FLOAT UNSIGNED NOT NULL DEFAULT 1,
`distance_nodes` FLOAT UNSIGNED NOT NULL DEFAULT 2.5,
`contracted_nodes` TEXT,
PRIMARY KEY (`id_networkmap`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -40,7 +40,7 @@ function is_descendant ($node, $ascendant, $parents) {
}
// Generate a dot graph definition for graphviz
function generate_dot ($pandora_name, $group = 0, $simple = 0, $font_size = 12, $layout = 'radial', $nooverlap = 0, $zoom = 1, $ranksep = 2.5, $center = 0, $regen = 1, $pure = 0) {
function generate_dot ($pandora_name, $group = 0, $simple = 0, $font_size = 12, $layout = 'radial', $nooverlap = 0, $zoom = 1, $ranksep = 2.5, $center = 0, $regen = 1, $pure = 0, $id_networkmap = 0) {
$parents = array();
$orphans = array();
@ -67,6 +67,8 @@ function generate_dot ($pandora_name, $group = 0, $simple = 0, $font_size = 12,
} else {
$orphans[$agent['id_agente']] = 1;
}
$agent['id_node'] = $agent['id_agente'];
// Add node
$nodes[$agent['id_agente']] = $agent;
@ -84,14 +86,14 @@ function generate_dot ($pandora_name, $group = 0, $simple = 0, $font_size = 12,
continue;
}
$graph .= create_node ($node , $simple, $font_size)."\n\t\t";
$graph .= create_agent_node ($node , $simple, $font_size)."\n\t\t";
}
// Define edges
foreach ($parents as $node => $parent_id) {
// Verify that the parent is in the graph
if (isset ($nodes[$parent_id])) {
$graph .= create_edge ($node, $parent_id, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group);
$graph .= create_edge ($node, $parent_id, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group, 'operation/agentes/networkmap', 'topology', $id_networkmap);
} else {
$orphans[$node] = 1;
}
@ -104,7 +106,7 @@ function generate_dot ($pandora_name, $group = 0, $simple = 0, $font_size = 12,
// Define edges for orphan nodes
foreach (array_keys($orphans) as $node) {
$graph .= create_edge ('0', $node, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group);
$graph .= create_edge ('0', $node, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group, 'operation/agentes/networkmap', 'topology', $id_networkmap);
}
// Close graph
@ -114,7 +116,7 @@ function generate_dot ($pandora_name, $group = 0, $simple = 0, $font_size = 12,
}
// Generate a dot graph definition for graphviz with groups
function generate_dot_groups ($pandora_name, $group = 0, $simple = 0, $font_size = 12, $layout = 'radial', $nooverlap = 0, $zoom = 1, $ranksep = 2.5, $center = 0, $regen = 1, $pure = 0, $modwithalerts = 0, $module_group = 0, $hidepolicymodules = 0, $depth = 'all') {
function generate_dot_groups ($pandora_name, $group = 0, $simple = 0, $font_size = 12, $layout = 'radial', $nooverlap = 0, $zoom = 1, $ranksep = 2.5, $center = 0, $regen = 1, $pure = 0, $modwithalerts = 0, $module_group = 0, $hidepolicymodules = 0, $depth = 'all', $id_networkmap = 0) {
global $config;
@ -254,7 +256,7 @@ function generate_dot_groups ($pandora_name, $group = 0, $simple = 0, $font_size
foreach ($parents as $node => $parent_id) {
// Verify that the parent is in the graph
if (isset ($nodes[$parent_id])) {
$graph .= create_edge ($node, $parent_id, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group, 'operation/agentes/networkmap2');
$graph .= create_edge ($node, $parent_id, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group, 'operation/agentes/networkmap', 'groups', $id_networkmap);
} else {
$orphans[$node] = 1;
}
@ -267,7 +269,7 @@ function generate_dot_groups ($pandora_name, $group = 0, $simple = 0, $font_size
// Define edges for orphan nodes
foreach (array_keys($orphans) as $node) {
$graph .= create_edge ('0', $node, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group, 'operation/agentes/networkmap2');
$graph .= create_edge ('0', $node, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group, 'operation/agentes/networkmap', 'groups', $id_networkmap);
}
// Close graph
@ -277,74 +279,18 @@ function generate_dot_groups ($pandora_name, $group = 0, $simple = 0, $font_size
}
// Returns an edge definition
function create_edge ($head, $tail, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group, $sec2 = 'operation/agentes/networkmap') {
function 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.'&center='.$head.
edgeURL="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.'"];';
'&font_size='.$font_size.'&group='.$group.'&id_networkmap='.$id_networkmap.'"];';
return $edge;
}
// Returns a node definition
function create_node ($agent, $simple = 0, $font_size = 10) {
$sql = sprintf ('SELECT COUNT(tagente_modulo.id_agente)
FROM tagente_estado, tagente_modulo
WHERE tagente_modulo.id_agente = %d
AND tagente_modulo.id_tipo_modulo in (2, 6, 9, 18, 21, 100)
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND tagente_modulo.disabled = 0
AND tagente_estado.estado = 1',
$agent['id_agente']);
$bad_modules = get_db_sql ($sql);
// Set node status
if ($bad_modules) {
$status_color = '#FF1D1D';
} else {
$status_color = '#8DFF1D';
}
// Check for alert
$sql = sprintf ('SELECT COUNT(talert_template_modules.id)
FROM talert_template_modules, tagente_modulo, tagente
WHERE tagente.id_agente = %d
AND tagente.disabled = 0
AND tagente.id_agente = tagente_modulo.id_agente
AND tagente_modulo.disabled = 0
AND tagente_modulo.id_agente_modulo = talert_template_modules.id_agent_module
AND talert_template_modules.times_fired > 0 ',
$agent['id_agente']);
$alert_modules = get_db_sql ($sql);
if ($alert_modules)
$status_color = '#FFE308';
// Short name
$name = strtolower ($agent["nombre"]);
if (strlen ($name) > 16)
$name = substr ($name, 0, 16);
if ($simple == 0){
// Set node icon
if (file_exists ('images/networkmap/'.$agent['id_os'].'.png')) {
$img_node = 'images/networkmap/'.$agent['id_os'].'.png';
} else {
$img_node = 'images/networkmap/0.png';
}
$node = $agent['id_agente'].' [ 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 SRC="'.$img_node.'"/></TD></TR>
<TR><TD>'.$name.'</TD></TR></TABLE>>,
shape="ellipse", 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'].'"];';
} else {
$node = $agent['id_agente'] . ' [ color="' . $status_color . '", fontsize='.$font_size.', 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'].'"];';
}
return $node;
}
// Returns a group node definition
function create_group_node ($group, $simple = 0, $font_size = 10) {
$status = get_group_status ($group['id_grupo']);
@ -382,10 +328,10 @@ function create_group_node ($group, $simple = 0, $font_size = 10) {
$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>
<TR><TD>'.$name.'</TD></TR></TABLE>>,
shape="ellipse", URL="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.$group['id_grupo'].'",
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'].'"];';
} else {
$node = $group['id_node'] . ' [ color="'.$status_color.'", fontsize='.$font_size.', 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 = $group['id_node'] . ' [ color="'.$status_color.'", fontsize='.$font_size.', shape="invtrapezium", 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'].'"];';
}
return $node;
}
@ -413,20 +359,6 @@ function create_agent_node ($agent, $simple = 0, $font_size = 10) {
break;
}
// Check for alert
/*$sql = sprintf ('SELECT COUNT(talert_template_modules.id)
FROM talert_template_modules, tagente_modulo, tagente
WHERE tagente.id_agente = %d
AND tagente.disabled = 0
AND tagente.id_agente = tagente_modulo.id_agente
AND tagente_modulo.disabled = 0
AND tagente_modulo.id_agente_modulo = talert_template_modules.id_agent_module
AND talert_template_modules.times_fired > 0 ',
$agent['id_agente']);
$alert_modules = get_db_sql ($sql);
if ($alert_modules)
$status_color = '#FFE308';*/
// Short name
$name = strtolower ($agent["nombre"]);
if (strlen ($name) > 16)
@ -442,10 +374,10 @@ function create_agent_node ($agent, $simple = 0, $font_size = 10) {
$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 SRC="'.$img_node.'"/></TD></TR>
<TR><TD>'.$name.'</TD></TR></TABLE>>,
shape="ellipse", URL="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'",
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'].'"];';
} else {
$node = $agent['id_node'] . ' [ color="' . $status_color . '", fontsize='.$font_size.', 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'].'"];';
$node = $agent['id_node'] . ' [ color="' . $status_color . '", fontsize='.$font_size.', shape="doublecircle", 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'].'"];';
}
return $node;
}
@ -477,10 +409,10 @@ function create_module_node ($module, $simple = 0, $font_size = 10) {
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>'.print_moduletype_icon ($module['id_tipo_modulo'], true).'</TD></TR>
<TR><TD>'.$module['nombre'].'</TD></TR></TABLE>>,
shape="ellipse", URL="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$module['id_agente'].'",
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'].'"];';
} else {
$node = $module['id_node'] . ' [ color="'.$status_color.'", fontsize='.$font_size.', 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'].'"];';
$node = $module['id_node'] . ' [ color="'.$status_color.'", fontsize='.$font_size.', shape="circle", 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'].'"];';
}
return $node;
}
@ -526,13 +458,17 @@ function open_graph ($layout, $nooverlap, $pure, $zoom, $ranksep, $font_size) {
$size_x = 8;
$size_y = 5.4;
$size = '';
if ($layout == 'radial')
$overlap = 'true';
if ($layout == 'flat' || $layout == 'radial' || $layout == 'spring1' || $layout == "spring2")
if ($nooverlap != '')
if ($layout == 'radial') {
$overlap = 'true';
}
if ($layout == 'flat' || $layout == 'radial' || $layout == 'spring1' || $layout == "spring2") {
if ($nooverlap != '') {
$overlap = 'scalexy';
}
}
if ($zoom > 0) {
$size_x *= $zoom;
@ -577,6 +513,153 @@ function get_filter ($layout) {
}
}
/**
* Creates a networkmap.
*
* @param string Network map name.
* @param string Network map type (topology, groups or policies).
* @param layout Network map layout (circular, flat, radial, spring1 or spring2).
* @param bool overlapping activate flag.
* @param bool simple view activate flag.
* @param bool regenerate file activate flag.
* @param int font size.
* @param int group id filter (0 for all).
* @param int module group id filter (0 for all).
* @param int policy id filter (0 for all).
* @param string depth level.
* @param bool only modules with alerts flag.
* @param bool hide policy modules flag
* @param float zoom factor
*
* @return mixed New networkmap id if created. False if it could not be created.
*/
function 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) {
global $config;
$values = array();
$values['name'] = $name;
$values['type'] = $type;
$values['layout'] = $layout;
$values['nooverlap'] = $nooverlap;
$values['simple'] = $simple;
$values['regenerate'] = $regenerate;
$values['font_size'] = $font_size;
$values['id_group'] = $id_group;
$values['id_module_group'] = $id_module_group;
$values['depth'] = $depth;
$values['only_modules_with_alerts'] = $only_modules_with_alerts;
$values['hide_policy_modules'] = $hide_policy_modules;
$values['zoom'] = $zoom;
$values['distance_nodes'] = $distance_nodes;
$values['center'] = $center;
$values['id_user'] = $config['id_user'];
return @process_sql_insert ('tnetwork_map', $values);
}
/**
* Get a network map report.
*
* @param int Networkmap id to get.
* @param array Extra filter.
* @param array Fields to get.
*
* @return Networkmap with the given id. False if not available or readable.
*/
function get_networkmap ($id_networkmap, $filter = false, $fields = false) {
global $config;
$id_networkmap = safe_int ($id_networkmap);
if (empty ($id_networkmap))
return false;
if (! is_array ($filter))
$filter = array ();
$filter['id_networkmap'] = $id_networkmap;
$filter['id_user'] = $config['id_user'];
$networkmap = get_db_row_filter ('tnetwork_map', $filter, $fields);
return $networkmap;
}
/**
* Get a user networkmaps.
*
* @param int Networkmap id to get.
* @param array Extra filter.
* @param array Fields to get.
*
* @return Networkmap with the given id. False if not available or readable.
*/
function get_networkmaps ($id_user = '', $type = '', $optgrouped = true) {
global $config;
if($id_user == '') {
$id_user = $config['id_user'];
}
$type_cond = '';
if($type != '') {
$type_cond = ' AND type = "'.$type.'"';
}
$networkmaps_raw = get_db_all_rows_filter ('tnetwork_map', 'id_user = "'.$id_user.'"'.$type_cond.' ORDER BY type DESC, name ASC', array('id_networkmap','name', 'type'));
if($networkmaps_raw === false){
return false;
}
$networkmaps = array();
foreach($networkmaps_raw as $key => $networkmapitem) {
if($optgrouped) {
$networkmaps[$networkmapitem['id_networkmap']] = array('name' => $networkmapitem['name'],
'optgroup' => $networkmapitem['type']);
}
else {
$networkmaps[$networkmapitem['id_networkmap']] = $networkmapitem['name'];
}
}
return $networkmaps;
}
/**
* Deletes a network map.
*
* @param int Map id to be deleted.
*
* @return bool True if the map was deleted, false otherwise.
*/
function delete_networkmap ($id_networkmap) {
$id_networkmap = safe_int ($id_networkmap);
if (empty ($id_networkmap))
return false;
$networkmap = get_networkmap ($id_networkmap);
if ($networkmap === false)
return false;
return @process_sql_delete ('tnetwork_map', array ('id_networkmap' => $id_networkmap));
}
/**
* Updates a network map.
*
* @param int Map id.
* @param array Extra values to be set.
*
* @return bool True if the map was updated. False otherwise.
*/
function update_networkmap ($id_networkmap, $values) {
$networkmap = get_networkmap ($id_networkmap);
if ($networkmap === false)
return false;
return (process_sql_update ('tnetwork_map',
$values,
array ('id_networkmap' => $id_networkmap))) !== false;
}
?>
<script language="javascript" type="text/javascript">
/* <![CDATA[ */

View File

@ -0,0 +1,12 @@
<?php
/**
* @package Include/help/en
*/
?>
<h1>Network map</h1>
<p>This is the Network map section.</p>
<p>To save a created map, you must update it first.</p>
<p>To buid a submap, you must click on the edges.</p>

View File

@ -0,0 +1,11 @@
<?php
/**
* @package Include/help/en
*/
?>
<h1>Mapa de red</h1>
<p>Esta es la sección de Mapas de red.</p>
<p>Para salvar un mapa creado, tu debes actualizarlo primero.</p>
<p>Para construir un submapa, debes hacer click en los bordes.</p>

View File

@ -28,118 +28,11 @@ if (! give_acl ($config['id_user'], 0, "AR")) {
require_once ('include/functions_networkmap.php');
// Load variables
$layout = (string) get_parameter ('layout', 'radial');
$depth = (string) get_parameter ('depth', 'all'); // 0 to all
$nooverlap = (int) get_parameter ('nooverlap', 0);
$modwithalerts = (int) get_parameter ('modwithalerts', 0);
$showmodules = (int) get_parameter ('showmodules', 0);
$hidepolicymodules = (int) get_parameter ('hidepolicymodules', 0);
$pure = (int) get_parameter ('pure');
$zoom = (float) get_parameter ('zoom');
$ranksep = (float) get_parameter ('ranksep', 2.5);
$simple = (int) get_parameter ('simple', 0);
$regen = (int) get_parameter ('regen',1); // Always regen by default
$font_size = (int) get_parameter ('font_size', 12);
$group = (int) get_parameter ('group', 0);
$module_group = (int) get_parameter ('module_group', 0);
$center = (int) get_parameter ('center', 0);
// Layout selection
$layout_array = array (
'circular' => 'circular',
'radial' => 'radial',
'spring1' => 'spring 1',
'spring2' => 'spring 2',
'flat' => 'flat');
echo '<form action="index.php?sec=estado&amp;sec2=operation/agentes/networkmap&amp;tab=groups&amp;pure='.$pure.'&amp;center='.$center.'" method="post">';
echo '<table cellpadding="4" cellspacing="4" class="databox" width="99%">';
echo '<tr><td>';
echo '<table cellpadding="0" cellspacing="0" border="0" width="100%">';
echo '<tr>';
echo '<td valign="top">' . __('Group') . '<br />';
print_select_from_sql ('SELECT id_grupo, nombre FROM tgrupo WHERE id_grupo > 0 ORDER BY nombre', 'group', $group, '', 'All', 0, false);
echo '</td>';
echo '<td valign="top">' . __('Module group') . '<br />';
print_select_from_sql ('SELECT id_mg, name FROM tmodule_group', 'module_group', $module_group, '', 'All', 0, false);
echo '</td>';
echo '<td valign="top">' . __('Layout') . '<br />';
print_select ($layout_array, 'layout', $layout, '', '', '');
echo '</td>';
echo '<td valign="top">' . __('Depth') . '<br />';
$depth_levels = array('all' => __('All'), 'agent' => __('Agents'), 'group' => __('Groups'));
print_select ($depth_levels, 'depth', $depth, '', '', '', 0, false, false);
echo '</td>';
echo '</tr></table>';
echo '</td></tr><tr><td>';
echo '<table cellpadding="0" cellspacing="0" border="0" width="100%">';
echo '<tr>';
echo '<td valign="top">' . __('No Overlap') . '<br />';
print_checkbox ('nooverlap', '1', $nooverlap);
echo '</td>';
echo '<td valign="top">' . __('Only modules with alerts') . '<br />';
print_checkbox ('modwithalerts', '1', $modwithalerts);
echo '</td>';
if(($depth == 'all') && $config['enterprise_installed']) {
echo '<td valign="top">' . __('Hide policy modules') . '<br />';
print_checkbox ('hidepolicymodules', '1', $hidepolicymodules);
echo '</td>';
}
echo '<td valign="top">' . __('Simple') . '<br />';
print_checkbox ('simple', '1', $simple);
echo '</td>';
echo '<td valign="top">' . __('Regenerate') . '<br />';
print_checkbox ('regen', '1', $regen);
echo '</td>';
if ($pure == "1") {
// Zoom
$zoom_array = array (
'1' => 'x1',
'1.2' => 'x2',
'1.6' => 'x3',
'2' => 'x4',
'2.5' => 'x5',
'5' => 'x10',
);
echo '<td valign="top">' . __('Zoom') . '<br />';
print_select ($zoom_array, 'zoom', $zoom, '', '', '', 0, false, false, false);
echo '</td>';
}
if ($nooverlap == 1){
echo "<td>";
echo __('Distance between nodes') . '<br />';
print_input_text ('ranksep', $ranksep, $alt = 'Separation between elements in the map (in Non-overlap mode)', 3, 4, 0);
echo "</td>";
}
echo "<td>";
echo __('Font') . '<br />';
print_input_text ('font_size', $font_size, $alt = 'Font size (in pt)', 2, 4, 0);
echo "</td>";
//echo ' Display groups <input type="checkbox" name="group" value="group" class="chk"/>';
echo '<td>';
print_submit_button (__('Update'), "updbutton", false, 'class="sub upd"');
echo '</td></tr>';
echo '</table>';
echo '</table></form>';
// Set filter
$filter = get_filter ($layout);
// Generate dot file
$graph = generate_dot_groups (__('Pandora FMS'), $group, $simple, $font_size, $layout, $nooverlap, $zoom, $ranksep, $center, $regen, $pure, $modwithalerts, $module_group, $hidepolicymodules, $depth);
$graph = generate_dot_groups (__('Pandora FMS'), $group, $simple, $font_size, $layout, $nooverlap, $zoom, $ranksep, $center, $regen, $pure, $modwithalerts, $module_group, $hidepolicymodules, $depth, $id_networkmap);
if ($graph === false) {
print_error_message (__('Map could not be generated'));
@ -162,9 +55,9 @@ if ($nooverlap) {
$filename_img .= "_nooverlap";
$filename_dot .= "_nooverlap";
}
$filename_map .= ".map";
$filename_img .= ".png";
$filename_dot .= ".dot";
$filename_map .= "_".$id_networkmap.".map";
$filename_img .= "_".$id_networkmap.".png";
$filename_dot .= "_".$id_networkmap.".dot";
if ($regen != 1 && file_exists ($filename_img) && filemtime ($filename_img) > get_system_time () - 300) {
$result = true;

View File

@ -26,23 +26,121 @@ if (! give_acl ($config['id_user'], 0, "AR")) {
exit;
}
require_once ('include/functions_networkmap.php');
// Load variables
$layout = (string) get_parameter ('layout', 'radial');
$nooverlap = (int) get_parameter ('nooverlap', 0);
$pure = (int) get_parameter ('pure');
$zoom = (float) get_parameter ('zoom');
$ranksep = (float) get_parameter ('ranksep', 2.5);
$simple = (int) get_parameter ('simple', 0);
$regen = (int) get_parameter ('regen',1); // Always regen by default
$font_size = (int) get_parameter ('font_size', 12);
$group = (int) get_parameter ('group', 0);
$center = (int) get_parameter ('center', 0);
require_once ('include/functions_networkmap.php');
$pure = (int) get_parameter ('pure', 0);
$activeTab = get_parameter ('tab', 'topology');
$id_networkmap = get_parameter ('id_networkmap', 0);
$save_networkmap = get_parameter ('save_networkmap', 0);
$delete_networkmap = get_parameter ('delete_networkmap', 0);
$add_networkmap = get_parameter ('add_networkmap', 0);
$update_networkmap = get_parameter ('update_networkmap', 0);
$recenter_networkmap = get_parameter ('recenter_networkmap', 0);
if($delete_networkmap) {
$result = delete_networkmap($id_networkmap);
$message = print_result_message ($result,
__('Network map deleted successfully'),
__('Could not delete network map'), '', true);
$id_networkmap = 0;
}
if($add_networkmap) {
// Load variables
$layout = 'radial';
$depth = 'all';
$nooverlap = 0;
$modwithalerts = 0;
$hidepolicymodules = 0;
$zoom = 1;
$ranksep = 2.5;
$simple = 0;
$regen = 1;
$font_size = 12;
$group = 0;
$module_group = 0;
$center = 0;
$name = $activeTab;
$id_networkmap = create_networkmap($name, $activeTab, $layout, $nooverlap, $simple, $regen, $font_size, $group, $module_group, $depth, $modwithalerts, $hidepolicymodules, $zoom, $ranksep, $center);
$message = print_result_message ($id_networkmap,
__('Network map created successfully'),
__('Could not create network map'), '', true);
}
if($save_networkmap || $update_networkmap) {
// Load variables
$layout = (string) get_parameter ('layout', 'radial');
$depth = (string) get_parameter ('depth', 'all');
$nooverlap = (bool) get_parameter ('nooverlap', 0);
$modwithalerts = (int) get_parameter ('modwithalerts', 0);
$hidepolicymodules = (int) get_parameter ('hidepolicymodules', 0);
$zoom = (float) get_parameter ('zoom', 1);
$ranksep = (float) get_parameter ('ranksep', 2.5);
$simple = (int) get_parameter ('simple', 0);
$regen = (int) get_parameter ('regen', 0);
$font_size = (int) get_parameter ('font_size', 12);
$group = (int) get_parameter ('group', 0);
$module_group = (int) get_parameter ('module_group', 0);
$center = (int) get_parameter ('center', 0);
$name = (string) get_parameter ('name', $activeTab);
if($save_networkmap){
$result = update_networkmap($id_networkmap, array('name' => $name, 'type' => $activeTab, 'layout' => $layout,
'nooverlap' => $nooverlap, 'simple' => $simple, 'regenerate' => $regen, 'font_size' => $font_size,
'id_group' => $group, 'id_module_group' => $module_group, 'depth' => $depth, 'only_modules_with_alerts' => $modwithalerts,
'hide_policy_modules' => $hidepolicymodules, 'zoom' => $zoom, 'distance_nodes' => $ranksep, 'center' => $center));
$message = print_result_message ($result,
__('Network map saved successfully'),
__('Could not save network map'), '', true);
}
}
$networkmaps = get_networkmaps();
$nomaps = false;
if($networkmaps === false) {
$nomaps = true;
}
/*// When is the first map, we create one
if($nomaps && $id_networkmap == 0) {
$add_networkmap = 1;
}*/
// If the map id is not defined, we set the first id of the active type
if(!$nomaps && $id_networkmap == 0) {
$networkmaps_of_type = get_networkmaps('', $activeTab);
if($networkmaps_of_type !== false){
$id_networkmap = reset(array_keys($networkmaps_of_type));
}
}
if(!$update_networkmap && !$save_networkmap && $id_networkmap != 0) {
$networkmap_data = get_networkmap($id_networkmap);
$layout = $networkmap_data['layout'];
$depth = $networkmap_data['depth'];
$nooverlap = (bool)$networkmap_data['nooverlap'];
$modwithalerts = $networkmap_data['only_modules_with_alerts'];
$hidepolicymodules = $networkmap_data['hide_policy_modules'];
$zoom = $networkmap_data['zoom'];
$ranksep = $networkmap_data['distance_nodes'];
$simple = $networkmap_data['simple'];
$regen = $networkmap_data['regenerate'];
$font_size = $networkmap_data['font_size'];
$group = $networkmap_data['id_group'];
$module_group = $networkmap_data['id_module_group'];
$center = $networkmap_data['center'];
$name = $networkmap_data['name'];
$activeTab = $networkmap_data['type'];
}
if($recenter_networkmap) {
$center = (int) get_parameter ('center', 0);
}
/* Main code */
if ($pure == 1) {
$buttons['screen'] = array('active' => false,
'text' => '<a href="index.php?sec=estado&amp;sec2=operation/agentes/networkmap&amp;tab='.$activeTab.'">' .
@ -66,6 +164,35 @@ $buttons['groups'] = array('active' => $activeTab == 'groups',
$buttons['topology'] = array('active' => $activeTab == 'topology',
'text' => '<a href="index.php?sec=estado&amp;sec2=operation/agentes/networkmap&amp;tab=topology&amp;pure='.$pure.'">' .
print_image("images/recon.png", true, array ("title" => __('Topology view'))) .'</a>');
$buttons['separator'] = array('separator' => '');
$combolist = '<form name="query_sel" method="post" action="index.php?sec=estado&sec2=operation/agentes/networkmap">';
$combolist .= print_select($networkmaps, 'id_networkmap', $id_networkmap, 'onchange:this.form.submit()', __('No selected'), 0, true, false, false, '', false, 'margin-top:4px; margin-left:3px; width:150px;');
$combolist .= '</form>';
$buttons['combolist'] = $combolist;
$buttons['addmap'] = array('active' => $activeTab == false,
'text' => '<a href="index.php?sec=estado&amp;sec2=operation/agentes/networkmap&amp;add_networkmap=1&amp;tab='.$activeTab.'&amp;pure='.$pure.'">' .
print_image("images/add.png", true, array ("title" => __('Add map'))) .'</a>');
if(!$nomaps && $id_networkmap != 0) {
$buttons['deletemap'] = array('active' => $activeTab == false,
'text' => '<a href="index.php?sec=estado&amp;sec2=operation/agentes/networkmap&amp;id_networkmap='.$id_networkmap.'&amp;delete_networkmap=1&amp;tab='.$activeTab.'&amp;pure='.$pure.'">' .
print_image("images/cross.png", true, array ("title" => __('Delete map'))) .'</a>');
$buttons['savemap'] = array('active' => $activeTab == false,
'text' => '<a href="index.php?sec=estado&amp;sec2=operation/agentes/networkmap&amp;id_networkmap='.$id_networkmap.'&amp;save_networkmap=1
&amp;tab='.$activeTab.'&amp;save_networkmap=1&amp;name='.$name.'&amp;group='.$group.'
&amp;layout='.$layout.'&amp;nooverlap='.$nooverlap.'&amp;simple='.$simple.'&amp;regen='.$regen.'
&amp;zoom='.$zoom.'&amp;ranksep='.$ranksep.'&amp;fontsize='.$font_size.'&amp;depth='.$depth.'
&amp;modwithalerts='.$modwithalerts.'&amp;hidepolicymodules='.$hidepolicymodules.'
&amp;module_group='.$module_group.'&amp;pure='.$pure.'">' .
print_image("images/file.png", true, array ("title" => __('Save map'))) .'</a>');
}
switch($activeTab){
case 'topology':
@ -79,21 +206,147 @@ switch($activeTab){
break;
}
print_page_header (__('Network map')." - ".$title, "images/bricks.png", false, "", false, $buttons);
print_page_header (__('Network map')." - ".$title, "images/bricks.png", false, "network_map", false, $buttons);
switch ($activeTab) {
case 'topology':
require_once('operation/agentes/networkmap.topology.php');
break;
case 'groups':
require_once('operation/agentes/networkmap.groups.php');
break;
case 'policies':
require_once(''.ENTERPRISE_DIR.'/operation/policies/networkmap.policies.php');
break;
default:
enterprise_selectTab($activeTab);
break;
//echo $layout." ".$depth." ".$nooverlap." ".$modwithalerts." ".$hidepolicymodules." ".$zoom." ".
// $ranksep." ".$simple." ".$regen." ".$font_size." ".$group." ".$module_group." ".$center." ".$name;
if($delete_networkmap || $add_networkmap || $save_networkmap) {
echo $message;
}
if($id_networkmap == 0) {
echo "<div class='nf'>".__('There are no defined maps in this view')."</div>";
}
if(!empty($name)) {
echo "<h3>".__('Name').": ".$name."</h3>";
}
// CONFIGURATION FORM
// Layout selection
$layout_array = array (
'circular' => 'circular',
'radial' => 'radial',
'spring1' => 'spring 1',
'spring2' => 'spring 2',
'flat' => 'flat');
echo '<form action="index.php?sec=estado&amp;sec2=operation/agentes/networkmap&amp;id_networkmap='.$id_networkmap.'&amp;tab='.$activeTab.'&amp;pure='.$pure.'&amp;center='.$center.'" method="post">';
echo '<table cellpadding="4" cellspacing="4" class="databox" width="99%">';
echo '<tr><td>';
echo '<table cellpadding="0" cellspacing="0" border="0" width="100%">';
echo '<tr>';
echo '<td>';
echo __('Name') . '<br />';
print_input_text ('name', $name, '', 10, 25, 0);
echo '</td>';
echo '<td valign="top">' . __('Group') . '<br />';
print_select_groups(false, false, false, 'group', $group, '', 'All', 0, false);
echo '</td>';
if($activeTab == 'groups' || $activeTab == 'policies'){
echo '<td valign="top">' . __('Module group') . '<br />';
print_select_from_sql ('SELECT id_mg, name FROM tmodule_group', 'module_group', $module_group, '', 'All', 0, false);
echo '</td>';
}
echo '<td valign="top">' . __('Layout') . '<br />';
print_select ($layout_array, 'layout', $layout, '', '', '');
echo '</td>';
if($activeTab == 'groups'){
echo '<td valign="top">' . __('Depth') . '<br />';
$depth_levels = array('all' => __('All'), 'agent' => __('Agents'), 'group' => __('Groups'));
print_select ($depth_levels, 'depth', $depth, '', '', '', 0, false, false);
echo '</td>';
}
if($activeTab == 'policies'){
echo '<td valign="top">' . __('Depth') . '<br />';
$depth_levels = array('all' => __('All'), 'agent' => __('Agents'), 'policy' => __('Policies'));
print_select ($depth_levels, 'depth', $depth, '', '', '', 0, false, false);
echo '</td>';
}
echo '</tr></table>';
echo '</td></tr><tr><td>';
echo '<table cellpadding="0" cellspacing="0" border="0" width="100%">';
echo '<tr><td valign="top">' . __('No Overlap') . '<br />';
print_checkbox ('nooverlap', '1', $nooverlap);
echo '</td>';
if(($activeTab == 'groups' || $activeTab == 'policies') && $depth == 'all') {
echo '<td valign="top">' . __('Only modules with alerts') . '<br />';
print_checkbox ('modwithalerts', '1', $modwithalerts);
echo '</td>';
if($activeTab == 'groups') {
if($config['enterprise_installed']) {
echo '<td valign="top">' . __('Hide policy modules') . '<br />';
print_checkbox ('hidepolicymodules', '1', $hidepolicymodules);
echo '</td>';
}
}
}
echo '<td valign="top">' . __('Simple') . '<br />';
print_checkbox ('simple', '1', $simple);
echo '</td>';
echo '<td valign="top">' . __('Regenerate') . '<br />';
print_checkbox ('regen', '1', $regen);
echo '</td>';
if ($pure == "1") {
// Zoom
$zoom_array = array (
'1' => 'x1',
'1.2' => 'x2',
'1.6' => 'x3',
'2' => 'x4',
'2.5' => 'x5',
'5' => 'x10',
);
echo '<td valign="top">' . __('Zoom') . '<br />';
print_select ($zoom_array, 'zoom', $zoom, '', '', '', 0, false, false, false);
echo '</td>';
}
if ($nooverlap == 1){
echo "<td>";
echo __('Distance between nodes') . '<br />';
print_input_text ('ranksep', $ranksep, $alt = 'Separation between elements in the map (in Non-overlap mode)', 3, 4, 0);
echo "</td>";
}
echo "<td>";
echo __('Font') . '<br />';
print_input_text ('font_size', $font_size, $alt = 'Font size (in pt)', 2, 4, 0);
echo "</td>";
echo '<td>';
print_input_hidden('update_networkmap',1);
print_submit_button (__('Update'), "updbutton", false, 'class="sub upd"');
echo '</td></tr>';
echo '</table></table></form>';
if($id_networkmap != 0) {
switch ($activeTab) {
case 'topology':
require_once('operation/agentes/networkmap.topology.php');
break;
case 'groups':
require_once('operation/agentes/networkmap.groups.php');
break;
case 'policies':
require_once(''.ENTERPRISE_DIR.'/operation/policies/networkmap.policies.php');
break;
default:
enterprise_selectTab($activeTab);
break;
}
}
?>

View File

@ -28,88 +28,11 @@ if (! give_acl ($config['id_user'], 0, "AR")) {
require_once ('include/functions_networkmap.php');
// Load variables
$layout = (string) get_parameter ('layout', 'radial');
$nooverlap = (int) get_parameter ('nooverlap', 0);
$pure = (int) get_parameter ('pure');
$zoom = (float) get_parameter ('zoom');
$ranksep = (float) get_parameter ('ranksep', 2.5);
$simple = (int) get_parameter ('simple', 0);
$regen = (int) get_parameter ('regen',1); // Always regen by default
$font_size = (int) get_parameter ('font_size', 12);
$group = (int) get_parameter ('group', 0);
$center = (int) get_parameter ('center', 0);
// Layout selection
$layout_array = array (
'circular' => 'circular',
'radial' => 'radial',
'spring1' => 'spring 1',
'spring2' => 'spring 2',
'flat' => 'flat');
echo '<form action="index.php?sec=estado&amp;sec2=operation/agentes/networkmap&amp;tab=topology&amp;pure='.$pure.'&amp;center='.$center.'" method="post">';
echo '<table cellpadding="4" cellspacing="4" class="databox" width="100%">';
echo '<tr>';
echo '<td valign="top">' . __('Group') . '<br />';
print_select_groups(false, false, false, 'group', $group, '', 'All', 0, false);
echo '</td>';
echo '<td valign="top">' . __('Layout') . '<br />';
print_select ($layout_array, 'layout', $layout, '', '', '');
echo '</td>';
echo '<td valign="top">' . __('No Overlap') . '<br />';
print_checkbox ('nooverlap', '1', $nooverlap);
echo '</td>';
echo '<td valign="top">' . __('Simple') . '<br />';
print_checkbox ('simple', '1', $simple);
echo '</td>';
echo '<td valign="top">' . __('Regenerate') . '<br />';
print_checkbox ('regen', '1', $regen);
echo '</td>';
if ($pure == "1") {
// Zoom
$zoom_array = array (
'1' => 'x1',
'1.2' => 'x2',
'1.6' => 'x3',
'2' => 'x4',
'2.5' => 'x5',
'5' => 'x10',
);
echo '<td valign="top">' . __('Zoom') . '<br />';
print_select ($zoom_array, 'zoom', $zoom, '', '', '', 0, false, false, false);
echo '</td>';
}
if ($nooverlap == 1){
echo "<td>";
echo __('Distance between nodes') . '<br />';
print_input_text ('ranksep', $ranksep, $alt = 'Separation between elements in the map (in Non-overlap mode)', 3, 4, 0);
echo "</td>";
}
echo "<td>";
echo __('Font') . '<br />';
print_input_text ('font_size', $font_size, $alt = 'Font size (in pt)', 2, 4, 0);
echo "</td>";
//echo ' Display groups <input type="checkbox" name="group" value="group" class="chk"/>';
echo '<td>';
print_submit_button (__('Update'), "updbutton", false, 'class="sub upd"');
echo '</td></tr>';
echo '</table></form>';
// Set filter
$filter = get_filter ($layout);
// Generate dot file
$graph = generate_dot (__('Pandora FMS'), $group, $simple, $font_size, $layout, $nooverlap, $zoom, $ranksep, $center, $regen, $pure);
$graph = generate_dot (__('Pandora FMS'), $group, $simple, $font_size, $layout, $nooverlap, $zoom, $ranksep, $center, $regen, $pure, $id_networkmap);
if ($graph === false) {
print_error_message (__('Map could not be generated'));
@ -132,9 +55,9 @@ if ($nooverlap) {
$filename_img .= "_nooverlap";
$filename_dot .= "_nooverlap";
}
$filename_map .= ".map";
$filename_img .= ".png";
$filename_dot .= ".dot";
$filename_map .= "_".$id_networkmap.".map";
$filename_img .= "_".$id_networkmap.".png";
$filename_dot .= "_".$id_networkmap.".dot";
if ($regen != 1 && file_exists ($filename_img) && filemtime ($filename_img) > get_system_time () - 300) {
$result = true;
@ -147,7 +70,7 @@ if ($regen != 1 && file_exists ($filename_img) && filemtime ($filename_img) > ge
$cmd = "$filter -Tcmapx -o".$filename_map." -Tpng -o".$filename_img." ".$filename_dot;
$result = system ($cmd);
fclose ($fh);
unlink ($filename_dot);
//unlink ($filename_dot);
}
}

View File

@ -33,7 +33,9 @@ if (is_ajax ()) {
$get_agents_group_json = (bool) get_parameter ("get_agents_group_json");
$get_agent_modules_json_for_multiple_agents = (bool) get_parameter("get_agent_modules_json_for_multiple_agents");
$get_agent_modules_json_for_multiple_agents_id = (bool) get_parameter("get_agent_modules_json_for_multiple_agents_id");
$get_agentmodule_status_tooltip = (bool) get_parameter ("get_agentmodule_status_tooltip");
$get_group_status_tooltip = (bool) get_parameter ("get_group_status_tooltip");
if ($get_agents_group_json) {
$id_group = get_parameter('id_group');
@ -130,7 +132,6 @@ if (is_ajax ()) {
$sql = sprintf ('SELECT tagente_modulo.descripcion, tagente_modulo.nombre
FROM tagente_estado, tagente_modulo
WHERE tagente_modulo.id_agente = %d
AND tagente_modulo.id_tipo_modulo in (2, 6, 9, 18, 21, 100)
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND tagente_modulo.disabled = 0
AND tagente_estado.estado = 1', $id_agent);
@ -138,8 +139,8 @@ if (is_ajax ()) {
$sql = sprintf ('SELECT COUNT(*)
FROM tagente_modulo
WHERE id_agente = %d
AND disabled = 0
AND id_tipo_modulo in (2, 6, 9, 18, 21, 100)', $id_agent);
AND disabled = 0', $id_agent);
//AND id_tipo_modulo in (2, 6, 9, 18, 21, 100)', $id_agent);
$total_modules = get_db_sql ($sql);
if ($bad_modules === false)
@ -153,10 +154,7 @@ if (is_ajax ()) {
echo '<ul>';
foreach ($bad_modules as $module) {
echo '<li>';
$name = $module['nombre'];
echo substr ($name, 0, 25);
if (strlen ($name) > 25)
echo '(...)';
echo printTruncateText($module['nombre']);
echo '</li>';
}
echo '</ul>';
@ -188,12 +186,8 @@ if (is_ajax ()) {
echo "<ul>";
foreach ($alerts as $alert_item) {
echo '<li>';
$name = $alert_item[0];
echo substr ($name, 0, 25);
if (strlen ($name) > 25)
echo '(...)';
echo "&nbsp;";
echo human_time_comparation($alert_item[1]);
echo printTruncateText($alert_item['nombre']).' -> ';
echo human_time_comparation($alert_item['last_fired']);
echo '</li>';
}
echo '</ul>';
@ -201,6 +195,60 @@ if (is_ajax ()) {
return;
}
if ($get_agentmodule_status_tooltip) {
$id_module = (int) get_parameter ('id_module');
$module = get_db_row ('tagente_modulo', 'id_agente_modulo', $id_module);
echo '<h3>';
echo '<img src="images/brick.png" />&nbsp;';
echo printTruncateText($module['nombre'],25,false,true,false).'</h3>';
echo '<strong>'.__('Type').':</strong> ';
$agentmoduletype = get_agentmodule_type ($module['id_agente_modulo']);
echo get_moduletype_name ($agentmoduletype).'&nbsp;';
echo '<img src="images/'.get_module_type_icon ($agentmoduletype).'" /> <br />';
echo '<strong>'.__('Module group').':</strong> ';
$modulegroup = get_modulegroup_name (get_agentmodule_modulegroup ($module['id_agente_modulo']));
if($modulegroup === false){
echo __('None').'<br />';
}
else{
echo $modulegroup.'<br />';
}
echo '<strong>'.__('Agent').':</strong> ';
echo printTruncateText(get_agentmodule_agent_name ($module['id_agente_modulo']),25,false,true,false).'<br />';
return;
}
if ($get_group_status_tooltip) {
$id_group = (int) get_parameter ('id_group');
$group = get_db_row ('tgrupo', 'id_grupo', $id_group);
echo '<h3><img src="images/groups_small/'.get_group_icon ($group['id_grupo']).'.png" /> ';
echo printTruncateText($group['nombre'],25,false,true,false).'</h3>';
echo '<strong>'.__('Parent').':</strong> ';
if($group['parent'] == 0) {
echo __('None').'<br />';
}
else {
$group_parent = get_db_row ('tgrupo', 'id_grupo', $group['parent']);
echo '<img src="images/groups_small/'.get_group_icon ($group['parent']).'.png" /> ';
echo $group_parent['nombre'].'<br />';
}
echo '<strong>'.__('Sons').':</strong> ';
$groups_sons = get_db_all_fields_in_table ('tgrupo', 'parent', $group['id_grupo']);
if($groups_sons === false){
echo __('None').'<br />';
}
else{
echo '<br /><br />';
foreach($groups_sons as $group_son) {
echo '<img src="images/groups_small/'.get_group_icon ($group_son['id_grupo']).'.png" /> ';
echo $group_son['nombre'].'<br />';
}
}
return;
}
return;
}

View File

@ -1097,4 +1097,30 @@ CREATE TABLE IF NOT EXISTS `tgroup_stat` (
COMMENT = 'Table to store global system stats per group'
DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `tnetwork_map`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `tnetwork_map` (
`id_networkmap` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`id_user` VARCHAR(60) NOT NULL,
`name` VARCHAR(100) NOT NULL,
`type` VARCHAR(20) NOT NULL,
`layout` VARCHAR(20) NOT NULL,
`nooverlap` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
`simple` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
`regenerate` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
`font_size` INT UNSIGNED NOT NULL DEFAULT 12,
`id_group` INT NOT NULL DEFAULT 0,
`id_module_group` INT NOT NULL DEFAULT 0,
`id_policy` INT NOT NULL DEFAULT 0,
`depth` VARCHAR(20) NOT NULL,
`only_modules_with_alerts` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
`hide_policy_modules` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
`zoom` FLOAT UNSIGNED NOT NULL DEFAULT 1,
`distance_nodes` FLOAT UNSIGNED NOT NULL DEFAULT 2.5,
`contracted_nodes` TEXT,
PRIMARY KEY (`id_networkmap`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;