2012-10-24 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 the fields "show_groups", "show_modules" into the table "tnetwork_map". * include/functions_modules.php: added two parameters (flag metaconsole, id_server) into the functions "modules_get_agentmodule_is_init", "modules_get_agentmodule_type" and "modules_get_agentmodule_status" for to extract data in the metaconsole enviroments. * include/functions_networkmap.php: added two parameters (flag metaconsole, id_server) into the functions "networkmap_create_agent_node" and "networkmap_create_module_node". git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7087 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
8a6296caa2
commit
81cde4dc91
|
@ -1,3 +1,21 @@
|
||||||
|
2012-10-24 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 the fields
|
||||||
|
"show_groups", "show_modules" into the table "tnetwork_map".
|
||||||
|
|
||||||
|
* include/functions_modules.php: added two parameters
|
||||||
|
(flag metaconsole, id_server) into the functions
|
||||||
|
"modules_get_agentmodule_is_init", "modules_get_agentmodule_type"
|
||||||
|
and "modules_get_agentmodule_status" for to extract data in the
|
||||||
|
metaconsole enviroments.
|
||||||
|
|
||||||
|
* include/functions_networkmap.php: added two parameters
|
||||||
|
(flag metaconsole, id_server) into the functions
|
||||||
|
"networkmap_create_agent_node" and "networkmap_create_module_node".
|
||||||
|
|
||||||
2012-10-23 Ramon Novoa <rnovoa@artica.es>
|
2012-10-23 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
* include/help/en/help_alert_macros.php,
|
* include/help/en/help_alert_macros.php,
|
||||||
|
|
|
@ -162,12 +162,12 @@ ALTER TABLE `tagente_modulo` ADD COLUMN `cron_interval` varchar(100) default '';
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
ALTER TABLE `tnetwork_component` CHANGE COLUMN `post_process` `post_process` double(18,5) default NULL;
|
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 COLUMN `unit` TEXT NOT NULL AFTER `post_process`;
|
||||||
ALTER TABLE tnetwork_component ADD `wizard_level` enum('basic','advanced','custom','nowizard') default 'nowizard';
|
ALTER TABLE `tnetwork_component` ADD COLUMN `wizard_level` enum('basic','advanced','custom','nowizard') default 'nowizard';
|
||||||
ALTER TABLE tnetwork_component ADD `only_metaconsole` tinyint(1) unsigned default '0';
|
ALTER TABLE `tnetwork_component` ADD COLUMN `only_metaconsole` tinyint(1) unsigned default '0';
|
||||||
ALTER TABLE tnetwork_component ADD `macros` text;
|
ALTER TABLE `tnetwork_component` ADD COLUMN `macros` text;
|
||||||
ALTER TABLE tnetwork_component ADD `critical_instructions` TEXT NOT NULL default '';
|
ALTER TABLE `tnetwork_component` ADD COLUMN `critical_instructions` TEXT NOT NULL default '';
|
||||||
ALTER TABLE tnetwork_component ADD `warning_instructions` TEXT NOT NULL default '';
|
ALTER TABLE `tnetwork_component` ADD COLUMN `warning_instructions` TEXT NOT NULL default '';
|
||||||
ALTER TABLE tnetwork_component ADD `unknown_instructions` TEXT NOT NULL default '';
|
ALTER TABLE `tnetwork_component` ADD COLUMN `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 `critical_inverse` tinyint(1) unsigned default '0';
|
||||||
ALTER TABLE `tnetwork_component` ADD COLUMN `warning_inverse` tinyint(1) unsigned default '0';
|
ALTER TABLE `tnetwork_component` ADD COLUMN `warning_inverse` tinyint(1) unsigned default '0';
|
||||||
|
|
||||||
|
@ -315,6 +315,8 @@ ALTER TABLE tlayout_data ADD COLUMN `enable_link` tinyint(1) UNSIGNED NOT NULL
|
||||||
ALTER TABLE tnetwork_map ADD `text_filter` VARCHAR(100) NOT NULL DEFAULT "";
|
ALTER TABLE tnetwork_map ADD `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 `dont_show_subgroups` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
|
||||||
ALTER TABLE tnetwork_map ADD `pandoras_children` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
|
ALTER TABLE tnetwork_map ADD `pandoras_children` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
|
||||||
|
ALTER TABLE tnetwork_map ADD `show_groups` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
|
||||||
|
ALTER TABLE tnetwork_map ADD `show_modules` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
|
||||||
|
|
||||||
-- ----------------------------------------------------------------------
|
-- ----------------------------------------------------------------------
|
||||||
-- Table `tagente_estado`
|
-- Table `tagente_estado`
|
||||||
|
|
|
@ -346,6 +346,8 @@ evento
|
||||||
ALTER TABLE tnetwork_map ADD (text_filter VARCHAR(100) DEFAULT '');
|
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 (dont_show_subgroups NUMBER(10, 0) default 0 NOT NULL);
|
||||||
ALTER TABLE tnetwork_map ADD (pandoras_children NUMBER(10, 0) default 0 NOT NULL);
|
ALTER TABLE tnetwork_map ADD (pandoras_children NUMBER(10, 0) default 0 NOT NULL);
|
||||||
|
ALTER TABLE tnetwork_map ADD (show_modules NUMBER(10, 0) default 0 NOT NULL);
|
||||||
|
ALTER TABLE tnetwork_map ADD (show_groups NUMBER(10, 0) default 0 NOT NULL);
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
-- Table `tagente_estado`
|
-- Table `tagente_estado`
|
||||||
|
|
|
@ -337,6 +337,8 @@ 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 "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 "dont_show_subgroups" INTEGER NOT NULL DEFAULT 0;
|
||||||
ALTER TABLE "tnetwork_map" ADD COLUMN "pandoras_children" INTEGER NOT NULL DEFAULT 0;
|
ALTER TABLE "tnetwork_map" ADD COLUMN "pandoras_children" INTEGER NOT NULL DEFAULT 0;
|
||||||
|
ALTER TABLE "tnetwork_map" ADD COLUMN "show_modules" INTEGER NOT NULL DEFAULT 0;
|
||||||
|
ALTER TABLE "tnetwork_map" ADD COLUMN "show_groups" INTEGER NOT NULL DEFAULT 0;
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
-- Table `tagente_estado`
|
-- Table `tagente_estado`
|
||||||
|
|
|
@ -570,14 +570,28 @@ function modules_get_agentmodule_id ($agentmodule_name, $agent_id) {
|
||||||
/**
|
/**
|
||||||
* Get a if a module is init.
|
* Get a if a module is init.
|
||||||
*
|
*
|
||||||
* @param int agentmodule id to get.
|
* @param int $agentmodule Id to get.
|
||||||
|
* @param bool $metaconsole Flag to extract the data for metaconsole, by default false.
|
||||||
|
* @param int $id_server Id of children console.
|
||||||
*
|
*
|
||||||
* @return bool true if is init and false if is not init
|
* @return bool true if is init and false if is not init
|
||||||
*/
|
*/
|
||||||
function modules_get_agentmodule_is_init ($id_agentmodule) {
|
function modules_get_agentmodule_is_init ($id_agentmodule, $metaconsole = false, $id_server = null) {
|
||||||
|
if ($metaconsole) {
|
||||||
|
$server = db_get_row('tmetaconsole_setup', 'id', $id_server);
|
||||||
|
|
||||||
|
if (metaconsole_connect($server) == NOERR) {
|
||||||
$result = db_get_row_filter ('tagente_estado',
|
$result = db_get_row_filter ('tagente_estado',
|
||||||
array('id_agente_modulo' => $id_agentmodule),
|
array('id_agente_modulo' => $id_agentmodule),
|
||||||
'utimestamp');
|
'utimestamp');
|
||||||
|
}
|
||||||
|
metaconsole_restore_db();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$result = db_get_row_filter ('tagente_estado',
|
||||||
|
array('id_agente_modulo' => $id_agentmodule),
|
||||||
|
'utimestamp');
|
||||||
|
}
|
||||||
|
|
||||||
return (bool)$result['utimestamp'];
|
return (bool)$result['utimestamp'];
|
||||||
}
|
}
|
||||||
|
@ -670,8 +684,21 @@ function modules_get_agentmodule_name ($id_agente_modulo) {
|
||||||
*
|
*
|
||||||
* @return string Module type of the given agent module.
|
* @return string Module type of the given agent module.
|
||||||
*/
|
*/
|
||||||
function modules_get_agentmodule_type ($id_agentmodule) {
|
function modules_get_agentmodule_type ($id_agentmodule, $metaconsole = false, $id_server = null) {
|
||||||
return (int) db_get_value ('id_tipo_modulo', 'tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule);
|
if ($metaconsole) {
|
||||||
|
$server = db_get_row('tmetaconsole_setup', 'id', $id_server);
|
||||||
|
|
||||||
|
$return = db_get_value ('id_tipo_modulo',
|
||||||
|
'tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule);
|
||||||
|
|
||||||
|
metaconsole_restore_db();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$return = db_get_value ('id_tipo_modulo',
|
||||||
|
'tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (int) $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1057,9 +1084,14 @@ function modules_give_agent_id_from_module_id ($id_agent_module) {
|
||||||
* @return int Module status. Value 4 means that some alerts assigned to the
|
* @return int Module status. Value 4 means that some alerts assigned to the
|
||||||
* module were fired.
|
* module were fired.
|
||||||
*/
|
*/
|
||||||
function modules_get_agentmodule_status($id_agentmodule = 0, $without_alerts = false) {
|
function modules_get_agentmodule_status($id_agentmodule = 0, $without_alerts = false, $metaconsole = false, $id_server = null) {
|
||||||
$current_timestamp = get_system_time ();
|
$current_timestamp = get_system_time ();
|
||||||
|
|
||||||
|
if ($metaconsole) {
|
||||||
|
$server = db_get_row('tmetaconsole_setup', 'id', $id_server);
|
||||||
|
|
||||||
|
if (metaconsole_connect($server) == NOERR) {
|
||||||
|
|
||||||
if (!$without_alerts) {
|
if (!$without_alerts) {
|
||||||
$times_fired = db_get_value ('SUM(times_fired)', 'talert_template_modules', 'id_agent_module', $id_agentmodule);
|
$times_fired = db_get_value ('SUM(times_fired)', 'talert_template_modules', 'id_agent_module', $id_agentmodule);
|
||||||
if ($times_fired > 0) {
|
if ($times_fired > 0) {
|
||||||
|
@ -1069,6 +1101,22 @@ function modules_get_agentmodule_status($id_agentmodule = 0, $without_alerts = f
|
||||||
|
|
||||||
$status_row = db_get_row ("tagente_estado", "id_agente_modulo", $id_agentmodule);
|
$status_row = db_get_row ("tagente_estado", "id_agente_modulo", $id_agentmodule);
|
||||||
|
|
||||||
|
}
|
||||||
|
metaconsole_restore_db();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
|
||||||
|
if (!$without_alerts) {
|
||||||
|
$times_fired = db_get_value ('SUM(times_fired)', 'talert_template_modules', 'id_agent_module', $id_agentmodule);
|
||||||
|
if ($times_fired > 0) {
|
||||||
|
return AGENT_MODULE_STATUS_CRITICAL_ALERT; // Alert fired
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$status_row = db_get_row ("tagente_estado", "id_agente_modulo", $id_agentmodule);
|
||||||
|
}
|
||||||
|
|
||||||
return $status_row['estado'];
|
return $status_row['estado'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,8 +132,9 @@ function networkmap_generate_dot ($pandora_name, $group = 0, $simple = 0,
|
||||||
$node_count ++;
|
$node_count ++;
|
||||||
$agent_module = modules_get_agentmodule($key);
|
$agent_module = modules_get_agentmodule($key);
|
||||||
|
|
||||||
$alerts_module = db_get_sql('SELECT count(*) as num
|
$alerts_module = db_get_sql('SELECT count(*) AS num
|
||||||
FROM talert_template_modules WHERE id_agent_module = '.$key);
|
FROM talert_template_modules
|
||||||
|
WHERE id_agent_module = ' . $key);
|
||||||
|
|
||||||
// Save node parent information to define edges later
|
// Save node parent information to define edges later
|
||||||
$parents[$node_count] = $agent_module['parent'] = $agent['id_node'];
|
$parents[$node_count] = $agent_module['parent'] = $agent['id_node'];
|
||||||
|
@ -467,10 +468,15 @@ function networkmap_create_group_node ($group, $simple = 0, $font_size = 10) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns a node definition
|
// Returns a node definition
|
||||||
function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cut_names = true, $relative = false) {
|
function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cut_names = true, $relative = false, $metaconsole = false, $id_server = null) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
if (defined('METACONSOLE')) {
|
||||||
|
$status = agents_meta_get_status($id_server, $agent['id_agente']);
|
||||||
|
}
|
||||||
|
else {
|
||||||
$status = agents_get_status($agent['id_agente']);
|
$status = agents_get_status($agent['id_agente']);
|
||||||
|
}
|
||||||
|
|
||||||
// Set node status
|
// Set node status
|
||||||
switch ($status) {
|
switch ($status) {
|
||||||
|
@ -541,8 +547,9 @@ function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cu
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns a module node definition
|
// Returns a module node definition
|
||||||
function networkmap_create_module_node ($module, $simple = 0, $font_size = 10) {
|
function networkmap_create_module_node ($module, $simple = 0, $font_size = 10, $metaconsole = true, $id_server = null) {
|
||||||
$status = modules_get_agentmodule_status($module['id_agente_modulo']);
|
$status = modules_get_agentmodule_status($module['id_agente_modulo'],
|
||||||
|
false, $metaconsole, $id_server);
|
||||||
|
|
||||||
// Set node status
|
// Set node status
|
||||||
switch($status) {
|
switch($status) {
|
||||||
|
|
|
@ -1461,9 +1461,9 @@ CREATE TABLE tgis_map_layer_has_tagente (
|
||||||
CREATE INDEX tgis_map_layer_has_tagente_idx ON tgis_map_layer_has_tagente(tgis_map_layer_id_tmap_layer);
|
CREATE INDEX tgis_map_layer_has_tagente_idx ON tgis_map_layer_has_tagente(tgis_map_layer_id_tmap_layer);
|
||||||
CREATE INDEX tgis_map_layer_has_tagent1_idx ON tgis_map_layer_has_tagente(tagente_id_agente);
|
CREATE INDEX tgis_map_layer_has_tagent1_idx ON tgis_map_layer_has_tagente(tagente_id_agente);
|
||||||
|
|
||||||
-- -----------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- Table "tgroup_stat"
|
-- Table "tgroup_stat"
|
||||||
-- -----------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
--Table to store global system stats per group
|
--Table to store global system stats per group
|
||||||
CREATE TABLE tgroup_stat (
|
CREATE TABLE tgroup_stat (
|
||||||
id_group NUMBER(10, 0) default 0 NOT NULL PRIMARY KEY,
|
id_group NUMBER(10, 0) default 0 NOT NULL PRIMARY KEY,
|
||||||
|
@ -1506,16 +1506,18 @@ CREATE TABLE tnetwork_map (
|
||||||
show_snmp_modules NUMBER(5, 0) default 0 NOT NULL,
|
show_snmp_modules NUMBER(5, 0) default 0 NOT NULL,
|
||||||
text_filter VARCHAR(100) DEFAULT '',
|
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
|
pandoras_children NUMBER(10, 0) default 0 NOT NULL,
|
||||||
|
show_groups NUMBER(10, 0) default 0 NOT NULL,
|
||||||
|
show_modules NUMBER(10, 0) default 0 NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE SEQUENCE tnetwork_map_s INCREMENT BY 1 START WITH 1;
|
CREATE SEQUENCE tnetwork_map_s INCREMENT BY 1 START WITH 1;
|
||||||
|
|
||||||
CREATE OR REPLACE TRIGGER tnetwork_map_inc BEFORE INSERT ON tnetwork_map REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tnetwork_map_s.nextval INTO :NEW.ID_NETWORKMAP FROM dual; END tnetwork_map_inc;;
|
CREATE OR REPLACE TRIGGER tnetwork_map_inc BEFORE INSERT ON tnetwork_map REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tnetwork_map_s.nextval INTO :NEW.ID_NETWORKMAP FROM dual; END tnetwork_map_inc;;
|
||||||
|
|
||||||
-- -----------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- Table "tsnmp_filter"
|
-- Table "tsnmp_filter"
|
||||||
-- -----------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
CREATE TABLE tsnmp_filter (
|
CREATE TABLE tsnmp_filter (
|
||||||
id_snmp_filter NUMBER(10, 0) NOT NULL PRIMARY KEY,
|
id_snmp_filter NUMBER(10, 0) NOT NULL PRIMARY KEY,
|
||||||
description VARCHAR2(255) default '',
|
description VARCHAR2(255) default '',
|
||||||
|
|
|
@ -1284,7 +1284,9 @@ CREATE TABLE "tnetwork_map" (
|
||||||
"show_snmp_modules" SMALLINT NOT NULL default 0,
|
"show_snmp_modules" SMALLINT NOT NULL default 0,
|
||||||
"text_filter" VARCHAR(100) DEFAULT '',
|
"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
|
"pandoras_children" INTEGER NOT NULL default 0,
|
||||||
|
"show_modules" INTEGER NOT NULL default 0,
|
||||||
|
"show_groups" INTEGER NOT NULL default 0
|
||||||
);
|
);
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
|
@ -1449,6 +1449,8 @@ CREATE TABLE IF NOT EXISTS `tnetwork_map` (
|
||||||
`text_filter` VARCHAR(100) NOT NULL DEFAULT "",
|
`text_filter` VARCHAR(100) NOT NULL DEFAULT "",
|
||||||
`dont_show_subgroups` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
|
`dont_show_subgroups` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
|
||||||
`pandoras_children` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
|
`pandoras_children` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
|
||||||
|
`show_groups` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
|
||||||
|
`show_modules` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
|
||||||
PRIMARY KEY (`id_networkmap`)
|
PRIMARY KEY (`id_networkmap`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue