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

@ -19,7 +19,7 @@ mkdir "/tmp/$1" >> /dev/null 2> /dev/null
for a in `ls include/help/en`
do
ESTA=`find include/help/$1/$a 2> /dev/null | wc -l`
if [ $ESTA == 0 ]
if [ $ESTA == 0 ]
then
echo "Missing $a, and copying to /tmp/$1"
cp include/help/en/$a "/tmp/$1"

View File

@ -74,9 +74,9 @@ CREATE TABLE IF NOT EXISTS `talert_special_days` (
-- ---------------------------------------------------------------------
ALTER TABLE `talert_templates` ADD COLUMN `special_day` tinyint(1) DEFAULT '0';
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
-- Table `tplanned_downtime`
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
ALTER TABLE `tplanned_downtime` ADD COLUMN `monday` tinyint(1) default 0;
ALTER TABLE `tplanned_downtime` ADD COLUMN `tuesday` tinyint(1) default 0;
ALTER TABLE `tplanned_downtime` ADD COLUMN `wednesday` tinyint(1) default 0;
@ -92,9 +92,9 @@ ALTER TABLE `tplanned_downtime` ADD COLUMN `type_downtime` varchar(100) NOT NULL
ALTER TABLE `tplanned_downtime` ADD COLUMN `type_execution` varchar(100) NOT NULL default 'once';
ALTER TABLE `tplanned_downtime` ADD COLUMN `type_periodicity` varchar(100) NOT NULL default 'weekly';
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
-- Table `tplanned_downtime_agents`
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
DELETE FROM tplanned_downtime_agents
WHERE id_downtime NOT IN (SELECT id FROM tplanned_downtime);
ALTER TABLE tplanned_downtime_agents MODIFY `id_downtime` mediumint(8) NOT NULL;
@ -103,9 +103,9 @@ ALTER TABLE tplanned_downtime_agents
ON DELETE CASCADE;
ALTER TABLE `tplanned_downtime_agents` ADD COLUMN `all_modules` tinyint(1) default 1;
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
-- Table `tplanned_downtime_modules`
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tplanned_downtime_modules` (
`id` int(20) unsigned NOT NULL auto_increment,
`id_agent` mediumint(8) unsigned NOT NULL default '0',
@ -116,9 +116,9 @@ CREATE TABLE IF NOT EXISTS `tplanned_downtime_modules` (
ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
-- Table `tevento`
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
ALTER TABLE `tevento` ADD COLUMN (`source` tinytext NOT NULL, `id_extra` tinytext NOT NULL);
ALTER TABLE `tevento` MODIFY COLUMN `event_type` ENUM('going_unknown','unknown','alert_fired','alert_recovered','alert_ceased','alert_manual_validation','recon_host_detected','system','error','new_agent','going_up_warning','going_up_critical','going_down_warning','going_down_normal','going_down_critical','going_up_normal','configuration_change') CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT 'unknown';
ALTER TABLE `tevento` ADD COLUMN `critical_instructions` TEXT NOT NULL DEFAULT '';
@ -127,21 +127,21 @@ ALTER TABLE `tevento` ADD COLUMN `unknown_instructions` TEXT NOT NULL DEFAULT ''
ALTER TABLE `tevento` ADD COLUMN `owner_user` VARCHAR(100) NOT NULL DEFAULT '';
ALTER TABLE `tevento` ADD COLUMN `ack_utimestamp` BIGINT(20) NOT NULL DEFAULT '0';
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
-- Table `tgrupo`
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
ALTER TABLE `tgrupo` ADD COLUMN `description` text;
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
-- Table `talert_snmp`
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
ALTER TABLE `talert_snmp` ADD COLUMN (`_snmp_f1_` text, `_snmp_f2_` text, `_snmp_f3_` text,
`_snmp_f4_` text, `_snmp_f5_` text, `_snmp_f6_` text, `trap_type` int(11) NOT NULL default '-1',
`single_value` varchar(255) DEFAULT '');
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
-- Table `tagente_modulo`
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
ALTER TABLE `tagente_modulo` ADD COLUMN `module_ff_interval` int(4) unsigned DEFAULT '0';
ALTER TABLE `tagente_modulo` CHANGE COLUMN `post_process` `post_process` double(18,5) DEFAULT NULL;
ALTER TABLE `tagente_modulo` ADD COLUMN `wizard_level` enum('basic','advanced','custom','nowizard') DEFAULT 'nowizard';
@ -153,9 +153,9 @@ ALTER TABLE `tagente_modulo` ADD COLUMN `unknown_instructions` TEXT NOT NULL DEF
ALTER TABLE `tagente_modulo` ADD COLUMN `critical_inverse` tinyint(1) unsigned default '0';
ALTER TABLE `tagente_modulo` ADD COLUMN `warning_inverse` tinyint(1) unsigned default '0';
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
-- Table `tnetwork_component`
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
ALTER TABLE `tnetwork_component` CHANGE COLUMN `post_process` `post_process` double(18,5) default NULL;
ALTER TABLE `tnetwork_component` ADD COLUMN `unit` TEXT NOT NULL AFTER `post_process`;
ALTER TABLE tnetwork_component ADD `wizard_level` enum('basic','advanced','custom','nowizard') default 'nowizard';
@ -167,14 +167,14 @@ ALTER TABLE tnetwork_component ADD `unknown_instructions` TEXT NOT NULL default
ALTER TABLE `tnetwork_component` ADD COLUMN `critical_inverse` tinyint(1) unsigned default '0';
ALTER TABLE `tnetwork_component` ADD COLUMN `warning_inverse` tinyint(1) unsigned default '0';
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
-- Table `tgraph_source` Alter table to allow negative values in weight
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
ALTER TABLE tgraph_source MODIFY weight FLOAT(5,3) NOT NULL DEFAULT '0.000';
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
-- Table `tevent_filter`
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tevent_filter` (
`id_filter` int(10) unsigned NOT NULL auto_increment,
`id_group_filter` int(10) NOT NULL default 0,
@ -194,9 +194,9 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` (
PRIMARY KEY (`id_filter`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
-- Table `tconfig`
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
ALTER TABLE tconfig MODIFY value TEXT NOT NULL;
-- Join the all ips of "list_ACL_IPs_for_API_%" in one row (now We have a field "value" with hudge size)
INSERT INTO tconfig (token, `value`) SELECT 'list_ACL_IPs_for_API', GROUP_CONCAT(`value` SEPARATOR ';') AS `value` FROM tconfig WHERE token LIKE "list_ACL_IPs_for_API%";
@ -218,29 +218,29 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('enable_refr', 0);
UPDATE tconfig SET `value`='comparation' WHERE `token`= 'prominent_time';
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
-- Table `treport_content_item`
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
ALTER TABLE treport_content_item ADD FOREIGN KEY (`id_report_content`) REFERENCES treport_content(`id_rc`) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE `treport_content_item` ADD COLUMN `operation` TEXT;
ALTER TABLE treport ADD COLUMN `id_template` INTEGER UNSIGNED DEFAULT 0;
ALTER TABLE treport ADD COLUMN `id_group_edit` mediumint(8) unsigned NULL DEFAULT 0;
ALTER TABLE treport ADD COLUMN `metaconsole` tinyint(1) DEFAULT 0;
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
-- Table `tgraph`
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
ALTER TABLE `tgraph` ADD COLUMN `id_graph_template` int(11) NOT NULL DEFAULT 0;
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
-- Table `ttipo_modulo`
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
UPDATE ttipo_modulo SET descripcion='Generic data' WHERE id_tipo=1;
UPDATE ttipo_modulo SET descripcion='Generic data incremental' WHERE id_tipo=4;
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
-- Table `tusuario`
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
ALTER TABLE `tusuario` ADD COLUMN `section` TEXT NOT NULL;
INSERT INTO `tusuario` (`section`) VALUES ('Default');
ALTER TABLE `tusuario` ADD COLUMN `data_section` TEXT NOT NULL;
@ -255,24 +255,24 @@ ALTER TABLE `tusuario` ADD COLUMN `failed_attempt` int(4) NOT NULL DEFAULT 0;
ALTER TABLE `tusuario` ADD COLUMN `login_blocked` tinyint(1) DEFAULT 0;
ALTER TABLE `tusuario` ADD COLUMN `metaconsole_access` enum('basic','advanced','custom','all','only_console') DEFAULT 'only_console';
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
-- Table `tmensajes`
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
ALTER TABLE `tmensajes` MODIFY COLUMN `mensaje` TEXT NOT NULL;
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
-- Table `talert_compound`
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
ALTER TABLE `talert_compound` ADD COLUMN `special_day` tinyint(1) DEFAULT '0';
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
-- Table `talert_commands`
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
INSERT INTO `talert_commands` (`name`, `command`, `description`, `internal`) VALUES ('Validate Event','Internal type','This alert validate the events matched with a module given the agent name (_field1_) and module name (_field2_)', 1);
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
-- Table `tpassword_history`
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tpassword_history` (
`id_pass` int(10) unsigned NOT NULL auto_increment,
`id_user` varchar(60) NOT NULL,
@ -282,34 +282,35 @@ CREATE TABLE IF NOT EXISTS `tpassword_history` (
PRIMARY KEY (`id_pass`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
-- Table `tplugin`
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
ALTER TABLE tplugin ADD `macros` text;
ALTER TABLE tplugin ADD `parameters` text;
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
-- Table `trecon_script`
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
UPDATE trecon_script SET `description`='This&#x20;script&#x20;is&#x20;used&#x20;to&#x20;automatically&#x20;detect&#x20;SNMP&#x20;Interfaces&#x20;on&#x20;devices,&#x20;used&#x20;as&#x20;Recon&#x20;Custom&#x20;Script&#x20;in&#x20;the&#x20;recon&#x20;task.&#x20;Parameters&#x20;used&#x20;are:&#x0d;&#x0a;&#x0d;&#x0a;*&#x20;custom_field1&#x20;=&#x20;network.&#x20;i.e.:&#x20;192.168.100.0/24&#x0d;&#x0a;*&#x20;custom_field2&#x20;=&#x20;several&#x20;communities&#x20;separated&#x20;by&#x20;comma.&#x20;For&#x20;example:&#x20;snmp_community,public,private&#x20;&#x0d;&#x0a;*&#x20;custom_field3&#x20;=&#x20;optative&#x20;parameter&#x20;to&#x20;force&#x20;process&#x20;downed&#x20;interfaces&#x20;&#40;use:&#x20;&#039;-a&#039;&#41;.&#x20;Only&#x20;up&#x20;interfaces&#x20;are&#x20;processed&#x20;by&#x20;default&#x20;&#x0d;&#x0a;&#x0d;&#x0a;See&#x20;documentation&#x20;for&#x20;more&#x20;information.'
WHERE id_recon_script = 1;
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
-- Table `trecon_task
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
ALTER TABLE trecon_task MODIFY subnet TEXT NOT NULL DEFAULT '';
ALTER TABLE trecon_task MODIFY field1 TEXT NOT NULL DEFAULT '';
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
-- Table `tlayout_data
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
ALTER TABLE tlayout_data ADD COLUMN `enable_link` tinyint(1) UNSIGNED NOT NULL default 1;
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
-- Table `tnetwork_map`
-- ----------------------------------------------------------------------
------------------------------------------------------------------------
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>";
if (isset($stats['policies'])) {
$summary .= count($stats['policies']) . " x " .
html_print_image($hack_metaconsole . 'images/policies.png',true) . ' '.
__('Policies') . "<br>";
}
if(isset($stats['groups'])) {
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>";
if (isset($stats['agents'])) {
$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) {
@ -57,7 +69,7 @@ switch($action) {
//~ }
}
if(isset($stats['modules'])) {
if (isset($stats['modules'])) {
// TODO: GET STATUS OF THE MODULES AND ADD IT TO SUMMARY
$summary .= count($stats['modules'])." x ".html_print_image('images/brick.png',true).' '.__('Modules')."<br>";
}

View File

@ -368,14 +368,14 @@ function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $o
WHERE tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND tagente_modulo.disabled = 0 AND estado = 2 AND tagente_estado.utimestamp != 0';
$critical_modules = 'SELECT tagente.id_agente
FROM tagente_estado, tagente, tagente_modulo
WHERE tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND tagente_modulo.disabled = 0 AND estado = 1 AND tagente_estado.utimestamp != 0';
$unknown_modules = 'SELECT tagente.id_agente
FROM tagente_estado, tagente, tagente_modulo
WHERE tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente
@ -423,7 +423,7 @@ function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $o
break;
}
unset($filter['status']);
}
}
unset($filter['order']);
@ -526,19 +526,19 @@ function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $o
$limit_sql = " OFFSET $offset LIMIT $limit ";
}
$sql = sprintf("%s %s", $sql, $limit_sql);
if ($return)
return $sql;
else
$agents = db_get_all_rows_sql($sql);
break;
case "oracle":
case "oracle":
$set = array();
if (isset($offset) && isset($limit)) {
$set['limit'] = $limit;
$set['offset'] = $offset;
}
if ($return)
return $sql;
else

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) {
@ -393,14 +396,21 @@ 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;
}
@ -429,7 +439,7 @@ function networkmap_create_group_node ($group, $simple = 0, $font_size = 10) {
$icon = groups_get_icon($group['id_grupo']);
if ($simple == 0){
if ($simple == 0) {
// Set node icon
if (file_exists (html_print_image("images/groups_small/" . $icon . ".png", true, false, true, true))) {
$img_node = html_print_image("images/groups_small/" . $icon . ".png", true, false, false, true);
@ -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;
}
@ -463,21 +473,21 @@ function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cu
$status = agents_get_status($agent['id_agente']);
// Set node status
switch($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;
}
@ -487,11 +497,15 @@ function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cu
$name = substr ($name, 0, 16) . '...';
}
if ($simple == 0){
if ($simple == 0) {
// Set node icon
$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>
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 {
$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="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'].'"];';
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'].'"];';
$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>';
$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));
$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 = '';
}
$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;
}
@ -833,18 +880,18 @@ function networkmap_update_networkmap ($id_networkmap, $values) {
*/
function networkmap_get_types () {
$networkmap_types = array();
$is_enterprise = enterprise_include_once('include/functions_policies.php');
$networkmap_types['topology'] = __('Create a new topology map');
$networkmap_types['groups'] = __('Create a new group map');
if ($is_enterprise !== ENTERPRISE_NOT_HOOK) {
$enterprise_types = enterprise_hook('policies_get_networkmap_types');
$networkmap_types = array_merge($networkmap_types, $enterprise_types);
}
return $networkmap_types;
}
@ -855,18 +902,18 @@ function networkmap_get_types () {
*/
function networkmap_get_filter_types () {
$networkmap_types = array();
$is_enterprise = enterprise_include_once('include/functions_policies.php');
$networkmap_types['topology'] = __('Topology');
$networkmap_types['groups'] = __('Group');
if ($is_enterprise !== ENTERPRISE_NOT_HOOK) {
$enterprise_types = enterprise_hook('policies_get_networkmap_filter_types');
$networkmap_types = array_merge($networkmap_types, $enterprise_types);
}
return $networkmap_types;
}

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>';
@ -550,7 +562,7 @@ function ui_print_os_icon ($id_os, $name = true, $return = false, $apply_skin =
$os_name = get_os_name ($id_os);
if (empty ($icon)) {
if ($only_src) {
$output = html_print_image("images/".$subfolter."/unknown.png", false, false, true, $relative);
$output = html_print_image("images/" . $subfolter . "/unknown.png", false, false, true, $relative);
}
else {
return "-";
@ -559,18 +571,18 @@ function ui_print_os_icon ($id_os, $name = true, $return = false, $apply_skin =
if ($apply_skin) {
if ($only_src) {
$output = html_print_image("images/".$subfolter."/".$icon, true, false, true, $relative);
$output = html_print_image("images/" . $subfolter . "/" . $icon, true, false, true, $relative);
}
else {
$output = html_print_image("images/".$subfolter."/".$icon, true, array("alt" => $os_name, "title" => $os_name), false, $relative);
$output = html_print_image("images/" . $subfolter . "/" . $icon, true, array("alt" => $os_name, "title" => $os_name), false, $relative);
}
}
else
//$output = "<img src='images/os_icons/" . $icon . "' alt='" . $os_name . "' title='" . $os_name . "'>";
$output = "images/".$subfolter."/" . $icon;
$output = "images/" . $subfolter . "/" . $icon;
if ($name === true) {
$output .= ' - '.$os_name;
$output .= ' - ' . $os_name;
}
if (!$return)
@ -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

@ -26,7 +26,7 @@ if (! check_acl ($config['id_user'], 0, "AR")) {
exit;
}
require_once ('include/functions_networkmap.php');
require_once('include/functions_networkmap.php');
ui_print_page_header(__('Network map'), "images/bricks.png", false, "network_map", false);
@ -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'>";
$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>";
?>
<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);
?>
</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">';
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>";
?>
<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', '');
?>
</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');
$agent = db_get_row ('tagente', 'id_agente', $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,12 +401,35 @@ 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);
$bad_modules = db_get_all_rows_sql ($sql);
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);
$total_modules = db_get_sql ($sql);
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;
@ -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);
$alert_modules = db_get_sql ($sql);
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);
$alerts = db_get_all_rows_sql ($sql);
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,24 +1311,24 @@ 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)' ,
`connection_type` VARCHAR(45) NULL COMMENT 'Type of map server to connect' ,
`conection_data` TEXT NULL COMMENT 'connection information (this can probably change to fit better the possible connection parameters)' ,
`num_zoom_levels` TINYINT(2) NULL COMMENT 'Number of zoom levels available' ,
`default_zoom_level` TINYINT(2) NOT NULL DEFAULT 16 COMMENT 'Default Zoom Level for the connection' ,
`default_longitude` DOUBLE NULL COMMENT 'default longitude for the agents placed on the map' ,
`default_latitude` DOUBLE NULL COMMENT 'default latitude for the agents placed on the map' ,
`default_altitude` DOUBLE NULL COMMENT 'default altitude for the agents placed on the map' ,
`initial_longitude` DOUBLE NULL COMMENT "longitude of the center of the map when it\'s loaded" ,
`initial_latitude` DOUBLE NULL COMMENT "latitude of the center of the map when it\'s loaded" ,
`initial_altitude` DOUBLE NULL COMMENT "altitude of the center of the map when it\'s loaded" ,
`group_id` INT(10) NOT NULL DEFAULT 0 COMMENT 'Group that owns the map',
PRIMARY KEY (`id_tmap_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)' ,
`connection_type` VARCHAR(45) NULL COMMENT 'Type of map server to connect' ,
`conection_data` TEXT NULL COMMENT 'connection information (this can probably change to fit better the possible connection parameters)' ,
`num_zoom_levels` TINYINT(2) NULL COMMENT 'Number of zoom levels available' ,
`default_zoom_level` TINYINT(2) NOT NULL DEFAULT 16 COMMENT 'Default Zoom Level for the connection' ,
`default_longitude` DOUBLE NULL COMMENT 'default longitude for the agents placed on the map' ,
`default_latitude` DOUBLE NULL COMMENT 'default latitude for the agents placed on the map' ,
`default_altitude` DOUBLE NULL COMMENT 'default altitude for the agents placed on the map' ,
`initial_longitude` DOUBLE NULL COMMENT "longitude of the center of the map when it\'s loaded" ,
`initial_latitude` DOUBLE NULL COMMENT "latitude of the center of the map when it\'s loaded" ,
`initial_altitude` DOUBLE NULL COMMENT "altitude of the center of the map when it\'s loaded" ,
`group_id` INT(10) NOT NULL DEFAULT 0 COMMENT 'Group that owns the map',
PRIMARY KEY (`id_tmap_connection`) )
ENGINE = InnoDB
COMMENT = 'Table to store the map connection information';
@ -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,