2011-06-10 Ramon Novoa <rnovoa@artica.es>

* include/functions_api.php, pandoradb.sql,
	  pandoradb.postgreSQL.sql, pandoradb.oracle.sql,
	  extras/pandoradb_migrate_v3.2_to_v4.0.sql: Added support for
	  configuration change events (enterprise).
	
	* operation/events/events_list.php: Improved event grouping.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4430 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Ramon Novoa 2011-06-10 12:38:59 +00:00
parent e881b7b674
commit 19fea4a864
7 changed files with 26 additions and 7 deletions

View File

@ -1,3 +1,12 @@
2011-06-10 Ramon Novoa <rnovoa@artica.es>
* include/functions_api.php, pandoradb.sql,
pandoradb.postgreSQL.sql, pandoradb.oracle.sql,
extras/pandoradb_migrate_v3.2_to_v4.0.sql: Added support for
configuration change events (enterprise).
* operation/events/events_list.php: Improved event grouping.
2011-06-10 Javier Lanz <javier.lanz@artica.es>
* include/graphs/functions_fsgraph.php: Updated a deprecated function

View File

@ -107,6 +107,12 @@ ALTER TABLE ttrap ADD `severity` tinyint(4) unsigned NOT NULL default '2';
ALTER TABLE tusuario_perfil ADD `id_policy` int(10) unsigned NOT NULL default 0;
-- -----------------------------------------------------
-- Table `tevento`
-- -----------------------------------------------------
ALTER TABLE `tevento` MODIFY `event_type` enum('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') default 'unknown';
-- -----------------------------------------------------
-- Change the value "0000-00-00 00:00:00" that Pandora use as zero or null date value
-- for the value "01-01-1970 00:00:00".

View File

@ -1195,7 +1195,7 @@ function set_new_event($trash1, $trash2, $other, $trash3) {
'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');
'going_down_normal', 'going_down_critical', 'going_up_normal','configuration_change');
if (in_array($other['data'][1], $valuesAvaliable)) {
$values['event_type'] = $other['data'][1];

View File

@ -270,14 +270,16 @@ if ($group_rep == 0) {
else {
switch ($config["dbtype"]) {
case "mysql":
$sql = "SELECT *, COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep
$sql = "SELECT *, GROUP_CONCAT(user_comment SEPARATOR '') AS user_comment,
MAX(estado) AS estado, COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep
FROM tevento
WHERE 1=1 ".$sql_post."
GROUP BY evento, id_agentmodule
ORDER BY timestamp_rep DESC LIMIT ".$offset.",".$pagination;
break;
case "postgresql":
$sql = "SELECT *, COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep
$sql = "SELECT *, array_to_string(array_agg(user_comment), '') AS user_comment,
MAX(estado) AS estado, COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep
FROM tevento
WHERE 1=1 ".$sql_post."
GROUP BY evento, id_agentmodule
@ -290,7 +292,8 @@ else {
$sql = "SELECT a.*, b.event_rep, b.timestamp_rep
FROM (select * from tevento WHERE 1=1 ".$sql_post.") a,
(select min(id_evento) as id_evento, to_char(evento) as evento,
id_agentmodule, COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep
id_agentmodule, COUNT(*) AS event_rep, MAX(estado) AS estado,
LISTAGG(user_comment, '') AS user_comment, MAX(utimestamp) AS timestamp_rep
from tevento
WHERE 1=1 ".$sql_post."
GROUP BY to_char(evento), id_agentmodule) b

View File

@ -26,6 +26,7 @@
CREATE OR REPLACE FUNCTION UNIX_TIMESTAMP (oracletime IN DATE DEFAULT SYSDATE) RETURN INTEGER AS unixtime INTEGER; BEGIN unixtime := (oracletime - to_date('19700101','YYYYMMDD')) * 86400; RETURN unixtime; END;;
CREATE OR REPLACE FUNCTION NOW RETURN TIMESTAMP AS t_now TIMESTAMP; BEGIN SELECT LOCALTIMESTAMP INTO t_now FROM dual; RETURN t_now; END;;
CREATE AGGREGATE array_agg (anyelement) (sfunc = array_append, stype = anyarray, initcond = '{}');;
CREATE TABLE taddress (
id_a NUMBER(10, 0) NOT NULL PRIMARY KEY,
@ -484,7 +485,7 @@ CREATE TABLE tevento (
criticity NUMBER(10, 0) default 0 NOT NULL,
user_comment CLOB,
tags CLOB NOT NULL,
CONSTRAINT tevento_event_type_cons CHECK (event_type IN ('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'))
CONSTRAINT tevento_event_type_cons CHECK (event_type IN ('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'))
);
CREATE INDEX tevento_id_1_idx ON tevento(id_agente, id_evento);
CREATE INDEX tevento_id_2_idx ON tevento(utimestamp, id_evento);

View File

@ -373,7 +373,7 @@ CREATE TABLE "tconfig_os" (
"icon_name" varchar(100) default ''
);
CREATE TYPE type_tevento_event AS ENUM ('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');
CREATE TYPE type_tevento_event AS ENUM ('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');
CREATE TABLE "tevento" (
"id_evento" BIGSERIAL NOT NULL PRIMARY KEY,
"id_agente" INTEGER NOT NULL default 0,

View File

@ -416,7 +416,7 @@ CREATE TABLE IF NOT EXISTS `tevento` (
`timestamp` datetime NOT NULL default '1970-01-01 00:00:00',
`evento` text NOT NULL default '',
`utimestamp` bigint(20) NOT NULL default '0',
`event_type` enum('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') default 'unknown',
`event_type` enum('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') default 'unknown',
`id_agentmodule` int(10) NOT NULL default '0',
`id_alert_am` int(10) NOT NULL default '0',
`criticity` int(4) unsigned NOT NULL default '0',