2013-03-19 Ramon Novoa <rnovoa@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: Updated and fixed
	  some column types.

	* include/functions_alerts.php,
	  pandoradb.sql,
	  pandoradb.postgreSQL.sql,
	  pandoradb.oracle.sql: Added support for on-demand module status
	  calculations.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7866 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
ramonn 2013-03-19 17:24:40 +00:00
parent a0f9483cfd
commit d214f29c9d
8 changed files with 91 additions and 75 deletions

View File

@ -1,3 +1,16 @@
2013-03-19 Ramon Novoa <rnovoa@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: Updated and fixed
some column types.
* include/functions_alerts.php,
pandoradb.sql,
pandoradb.postgreSQL.sql,
pandoradb.oracle.sql: Added support for on-demand module status
calculations.
2013-03-18 Junichi Satoh <junichi@rworks.jp>
* include/help/ja/help_performance.php,

View File

@ -65,6 +65,8 @@ ALTER TABLE `tagente` ADD COLUMN `unknown_count` bigint(20) NOT NULL default '0'
ALTER TABLE `tagente` ADD COLUMN `notinit_count` bigint(20) NOT NULL default '0';
ALTER TABLE `tagente` ADD COLUMN `total_count` bigint(20) NOT NULL default '0';
ALTER TABLE `tagente` ADD COLUMN `fired_count` bigint(20) NOT NULL default '0';
ALTER TABLE `tagente` ADD COLUMN `update_module_count` tinyint(1) NOT NULL DEFAULT '0';
ALTER TABLE `tagente` ADD COLUMN `update_alert_count` tinyint(1) NOT NULL DEFAULT '0';
-- ---------------------------------------------------------------------
-- Table `talert_special_days`
@ -372,31 +374,31 @@ CREATE TABLE IF NOT EXISTS `tevent_response` (
-- ----------------------------------------------------------------------
-- Table `talert_actions`
-- ----------------------------------------------------------------------
ALTER TABLE `talert_actions` ADD COLUMN `field4` TEXT NOT NULL;
ALTER TABLE `talert_actions` ADD COLUMN `field5` TEXT NOT NULL;
ALTER TABLE `talert_actions` ADD COLUMN `field6` TEXT NOT NULL;
ALTER TABLE `talert_actions` ADD COLUMN `field7` TEXT NOT NULL;
ALTER TABLE `talert_actions` ADD COLUMN `field8` TEXT NOT NULL;
ALTER TABLE `talert_actions` ADD COLUMN `field9` TEXT NOT NULL;
ALTER TABLE `talert_actions` ADD COLUMN `field10` TEXT NOT NULL;
ALTER TABLE `talert_actions` ADD COLUMN `field4` TEXT;
ALTER TABLE `talert_actions` ADD COLUMN `field5` TEXT;
ALTER TABLE `talert_actions` ADD COLUMN `field6` TEXT;
ALTER TABLE `talert_actions` ADD COLUMN `field7` TEXT;
ALTER TABLE `talert_actions` ADD COLUMN `field8` TEXT;
ALTER TABLE `talert_actions` ADD COLUMN `field9` TEXT;
ALTER TABLE `talert_actions` ADD COLUMN `field10` TEXT;
-- ----------------------------------------------------------------------
-- Table `talert_templates`
-- ----------------------------------------------------------------------
ALTER TABLE `talert_templates` ADD COLUMN `field4` TEXT NOT NULL;
ALTER TABLE `talert_templates` ADD COLUMN `field5` TEXT NOT NULL;
ALTER TABLE `talert_templates` ADD COLUMN `field6` TEXT NOT NULL;
ALTER TABLE `talert_templates` ADD COLUMN `field7` TEXT NOT NULL;
ALTER TABLE `talert_templates` ADD COLUMN `field8` TEXT NOT NULL;
ALTER TABLE `talert_templates` ADD COLUMN `field9` TEXT NOT NULL;
ALTER TABLE `talert_templates` ADD COLUMN `field10` TEXT NOT NULL;
ALTER TABLE `talert_templates` ADD COLUMN `field4_recovery` TEXT NOT NULL;
ALTER TABLE `talert_templates` ADD COLUMN `field5_recovery` TEXT NOT NULL;
ALTER TABLE `talert_templates` ADD COLUMN `field6_recovery` TEXT NOT NULL;
ALTER TABLE `talert_templates` ADD COLUMN `field7_recovery` TEXT NOT NULL;
ALTER TABLE `talert_templates` ADD COLUMN `field8_recovery` TEXT NOT NULL;
ALTER TABLE `talert_templates` ADD COLUMN `field9_recovery` TEXT NOT NULL;
ALTER TABLE `talert_templates` ADD COLUMN `field10_recovery` TEXT NOT NULL;
ALTER TABLE `talert_templates` ADD COLUMN `field4` TEXT;
ALTER TABLE `talert_templates` ADD COLUMN `field5` TEXT;
ALTER TABLE `talert_templates` ADD COLUMN `field6` TEXT;
ALTER TABLE `talert_templates` ADD COLUMN `field7` TEXT;
ALTER TABLE `talert_templates` ADD COLUMN `field8` TEXT;
ALTER TABLE `talert_templates` ADD COLUMN `field9` TEXT;
ALTER TABLE `talert_templates` ADD COLUMN `field10` TEXT;
ALTER TABLE `talert_templates` ADD COLUMN `field4_recovery`;
ALTER TABLE `talert_templates` ADD COLUMN `field5_recovery`;
ALTER TABLE `talert_templates` ADD COLUMN `field6_recovery`;
ALTER TABLE `talert_templates` ADD COLUMN `field7_recovery`;
ALTER TABLE `talert_templates` ADD COLUMN `field8_recovery`;
ALTER TABLE `talert_templates` ADD COLUMN `field9_recovery`;
ALTER TABLE `talert_templates` ADD COLUMN `field10_recovery`;
-- ----------------------------------------------------------------------
-- Table `talert_commands`
@ -443,13 +445,13 @@ ALTER TABLE `ttag` ADD COLUMN `email` text NULL;
-- ---------------------------------------------------------------------
-- Add more fields in snmp alerts (05/03/13)
-- ---------------------------------------------------------------------
ALTER TABLE `talert_snmp` ADD COLUMN `al_field4` text NOT NULL;
ALTER TABLE `talert_snmp` ADD COLUMN `al_field5` text NOT NULL;
ALTER TABLE `talert_snmp` ADD COLUMN `al_field6` text NOT NULL;
ALTER TABLE `talert_snmp` ADD COLUMN `al_field7` text NOT NULL;
ALTER TABLE `talert_snmp` ADD COLUMN `al_field8` text NOT NULL;
ALTER TABLE `talert_snmp` ADD COLUMN `al_field9` text NOT NULL;
ALTER TABLE `talert_snmp` ADD COLUMN `al_field10` text NOT NULL;
ALTER TABLE `talert_snmp` ADD COLUMN `al_field4` text;
ALTER TABLE `talert_snmp` ADD COLUMN `al_field5` text;
ALTER TABLE `talert_snmp` ADD COLUMN `al_field6` text;
ALTER TABLE `talert_snmp` ADD COLUMN `al_field7` text;
ALTER TABLE `talert_snmp` ADD COLUMN `al_field8` text;
ALTER TABLE `talert_snmp` ADD COLUMN `al_field9` text;
ALTER TABLE `talert_snmp` ADD COLUMN `al_field10` text;
-- ---------------------------------------------------------------------
-- ---------------------------------------------------------------------

View File

@ -86,6 +86,8 @@ ALTER TABLE tagente ADD (unknown_count NUMBER(20, 0) default 0 NOT NULL);
ALTER TABLE tagente ADD (notinit_count NUMBER(20, 0) default 0 NOT NULL);
ALTER TABLE tagente ADD (total_count NUMBER(20, 0) default 0 NOT NULL);
ALTER TABLE tagente ADD (fired_count NUMBER(20, 0) default 0 NOT NULL);
ALTER TABLE tagente ADD (update_module_count NUMBER(5, 0) default 0 NOT NULL);
ALTER TABLE tagente ADD (update_alert_count NUMBER(5, 0) default 0 NOT NULL);
-- -----------------------------------------------------
-- Table talert_special_days
@ -403,13 +405,13 @@ CREATE SEQUENCE tevent_response_s INCREMENT BY 1 START WITH 1;
-- ----------------------------------------------------------------------
-- Table talert_actions
-- ----------------------------------------------------------------------
ALTER TABLE talert_actions ADD (field4 CLOB NOT NULL;
ALTER TABLE talert_actions ADD (field5 CLOB NOT NULL;
ALTER TABLE talert_actions ADD (field6 CLOB NOT NULL;
ALTER TABLE talert_actions ADD (field7 CLOB NOT NULL;
ALTER TABLE talert_actions ADD (field8 CLOB NOT NULL;
ALTER TABLE talert_actions ADD (field9 CLOB NOT NULL;
ALTER TABLE talert_actions ADD (field10 CLOB NOT NULL;
ALTER TABLE talert_actions ADD (field4 CLOB default '');
ALTER TABLE talert_actions ADD (field5 CLOB default '');
ALTER TABLE talert_actions ADD (field6 CLOB default '');
ALTER TABLE talert_actions ADD (field7 CLOB default '');
ALTER TABLE talert_actions ADD (field8 CLOB default '');
ALTER TABLE talert_actions ADD (field9 CLOB default '');
ALTER TABLE talert_actions ADD (field10 CLOB default '');
-- ----------------------------------------------------------------------
-- Table talert_templates

View File

@ -80,6 +80,8 @@ ALTER TABLE "tagente" ADD COLUMN "unknown_count" INTEGER NOT NULL default 0;
ALTER TABLE "tagente" ADD COLUMN "notinit_count" INTEGER NOT NULL default 0;
ALTER TABLE "tagente" ADD COLUMN "total_count" INTEGER NOT NULL default 0;
ALTER TABLE "tagente" ADD COLUMN "fired_count" INTEGER NOT NULL default 0;
ALTER TABLE "tagente" ADD COLUMN "update_module_count" SMALLINT NOT NULL default 0;
ALTER TABLE "tagente" ADD COLUMN "update_alert_count" SMALLINT NOT NULL default 0;
-- -----------------------------------------------------
-- Table "talert_special_days"
@ -394,31 +396,31 @@ CREATE TABLE IF NOT EXISTS "tevent_response" (
-- ----------------------------------------------------------------------
-- Table "talert_actions"
-- ----------------------------------------------------------------------
ALTER TABLE "talert_actions" ADD COLUMN "field4" TEXT NOT NULL;
ALTER TABLE "talert_actions" ADD COLUMN "field5" TEXT NOT NULL;
ALTER TABLE "talert_actions" ADD COLUMN "field6" TEXT NOT NULL;
ALTER TABLE "talert_actions" ADD COLUMN "field7" TEXT NOT NULL;
ALTER TABLE "talert_actions" ADD COLUMN "field8" TEXT NOT NULL;
ALTER TABLE "talert_actions" ADD COLUMN "field9" TEXT NOT NULL;
ALTER TABLE "talert_actions" ADD COLUMN "field10" TEXT NOT NULL;
ALTER TABLE "talert_actions" ADD COLUMN "field4" TEXT;
ALTER TABLE "talert_actions" ADD COLUMN "field5" TEXT;
ALTER TABLE "talert_actions" ADD COLUMN "field6" TEXT;
ALTER TABLE "talert_actions" ADD COLUMN "field7" TEXT;
ALTER TABLE "talert_actions" ADD COLUMN "field8" TEXT;
ALTER TABLE "talert_actions" ADD COLUMN "field9" TEXT;
ALTER TABLE "talert_actions" ADD COLUMN "field10" TEXT;
-- ----------------------------------------------------------------------
-- Table "talert_templates"
-- ----------------------------------------------------------------------
ALTER TABLE "talert_templates" ADD COLUMN "field4" TEXT NOT NULL;
ALTER TABLE "talert_templates" ADD COLUMN "field5" TEXT NOT NULL;
ALTER TABLE "talert_templates" ADD COLUMN "field6" TEXT NOT NULL;
ALTER TABLE "talert_templates" ADD COLUMN "field7" TEXT NOT NULL;
ALTER TABLE "talert_templates" ADD COLUMN "field8" TEXT NOT NULL;
ALTER TABLE "talert_templates" ADD COLUMN "field9" TEXT NOT NULL;
ALTER TABLE "talert_templates" ADD COLUMN "field10" TEXT NOT NULL;
ALTER TABLE "talert_templates" ADD COLUMN "field4_recovery" TEXT NOT NULL;
ALTER TABLE "talert_templates" ADD COLUMN "field5_recovery" TEXT NOT NULL;
ALTER TABLE "talert_templates" ADD COLUMN "field6_recovery" TEXT NOT NULL;
ALTER TABLE "talert_templates" ADD COLUMN "field7_recovery" TEXT NOT NULL;
ALTER TABLE "talert_templates" ADD COLUMN "field8_recovery" TEXT NOT NULL;
ALTER TABLE "talert_templates" ADD COLUMN "field9_recovery" TEXT NOT NULL;
ALTER TABLE "talert_templates" ADD COLUMN "field10_recovery" TEXT NOT NULL;
ALTER TABLE "talert_templates" ADD COLUMN "field4" TEXT;
ALTER TABLE "talert_templates" ADD COLUMN "field5" TEXT;
ALTER TABLE "talert_templates" ADD COLUMN "field6" TEXT;
ALTER TABLE "talert_templates" ADD COLUMN "field7" TEXT;
ALTER TABLE "talert_templates" ADD COLUMN "field8" TEXT;
ALTER TABLE "talert_templates" ADD COLUMN "field9" TEXT;
ALTER TABLE "talert_templates" ADD COLUMN "field10" TEXT;
ALTER TABLE "talert_templates" ADD COLUMN "field4_recovery" TEXT;
ALTER TABLE "talert_templates" ADD COLUMN "field5_recovery" TEXT;
ALTER TABLE "talert_templates" ADD COLUMN "field6_recovery" TEXT;
ALTER TABLE "talert_templates" ADD COLUMN "field7_recovery" TEXT;
ALTER TABLE "talert_templates" ADD COLUMN "field8_recovery" TEXT;
ALTER TABLE "talert_templates" ADD COLUMN "field9_recovery" TEXT;
ALTER TABLE "talert_templates" ADD COLUMN "field10_recovery" TEXT;
-- ----------------------------------------------------------------------
-- Table "talert_commands"
@ -464,13 +466,13 @@ ALTER TABLE "ttag" ADD COLUMN "email" TEXT NULL;
-- ---------------------------------------------------------------------
-- Add more fields in snmp alerts (05/03/13)
-- ---------------------------------------------------------------------
ALTER TABLE "talert_snmp" ADD COLUMN "al_field4" TEXT NULL;
ALTER TABLE "talert_snmp" ADD COLUMN "al_field5" TEXT NULL;
ALTER TABLE "talert_snmp" ADD COLUMN "al_field6" TEXT NULL;
ALTER TABLE "talert_snmp" ADD COLUMN "al_field7" TEXT NULL;
ALTER TABLE "talert_snmp" ADD COLUMN "al_field8" TEXT NULL;
ALTER TABLE "talert_snmp" ADD COLUMN "al_field9" TEXT NULL;
ALTER TABLE "talert_snmp" ADD COLUMN "al_field10" TEXT NULL;
ALTER TABLE "talert_snmp" ADD COLUMN "al_field4" TEXT;
ALTER TABLE "talert_snmp" ADD COLUMN "al_field5" TEXT;
ALTER TABLE "talert_snmp" ADD COLUMN "al_field6" TEXT;
ALTER TABLE "talert_snmp" ADD COLUMN "al_field7" TEXT;
ALTER TABLE "talert_snmp" ADD COLUMN "al_field8" TEXT;
ALTER TABLE "talert_snmp" ADD COLUMN "al_field9" TEXT;
ALTER TABLE "talert_snmp" ADD COLUMN "al_field10" TEXT;
-- ---------------------------------------------------------------------
-- ---------------------------------------------------------------------

View File

@ -886,16 +886,7 @@ function alerts_delete_alert_agent_module ($id_alert_agent_module, $filter = fal
it is automatily because the data base this table have
a foreing key and delete on cascade.
*/
if (@db_process_sql_delete ('talert_template_modules', $filter) !== false) {
// If there are fired alert modules, update counts
if($fired_alert_modules !== false) {
foreach($fired_alert_modules as $fam) {
$agent_id = modules_get_agentmodule_agent($fam['id_agent_module']);
db_process_sql(sprintf('UPDATE tagente SET fired_count=fired_count-%d WHERE id_agente = %d', $fam['alerts'], $agent_id));
}
}
if (@db_process_sql_delete ('talert_template_modules', $filter) !== false) {
return true;
}
@ -1180,7 +1171,7 @@ function alerts_validate_alert_agent_module ($id_alert_agent_module, $noACLs = f
if ($result > 0) {
// Update fired alert count on the agent
db_process_sql(sprintf('UPDATE tagente SET fired_count=fired_count-1 WHERE id_agente = %d', $agent_id));
db_process_sql(sprintf('UPDATE tagente SET update_alert_count=1 WHERE id_agente = %d', $agent_id));
events_create_event ("Manual validation of alert for ".
alerts_get_alert_template_description ($alert["id_alert_template"]),

View File

@ -86,7 +86,9 @@ CREATE TABLE tagente (
unknown_count NUMBER(20, 0) default 0 NOT NULL,
notinit_count NUMBER(20, 0) default 0 NOT NULL,
total_count NUMBER(20, 0) default 0 NOT NULL,
fired_count NUMBER(20, 0) default 0 NOT NULL
fired_count NUMBER(20, 0) default 0 NOT NULL,
update_module_count NUMBER(5, 0) default 0 NOT NULL
update_alert_count NUMBER(5, 0) default 0 NOT NULL
);
CREATE INDEX tagente_nombre_idx ON tagente(nombre);
CREATE INDEX tagente_direccion_idx ON tagente(direccion);

View File

@ -85,6 +85,8 @@ CREATE TABLE "tagente" (
"notinit_count" INTEGER NOT NULL default 0,
"total_count" INTEGER NOT NULL default 0,
"fired_count" INTEGER NOT NULL default 0
"update_module_count" SMALLINT NOT NULL DEFAULT 1,
"update_alert_count" SMALLINT NOT NULL DEFAULT 1,
);
CREATE INDEX "tagente_nombre_idx" ON "tagente"("nombre");
CREATE INDEX "tagente_direccion_idx" ON "tagente"("direccion");

View File

@ -78,6 +78,8 @@ CREATE TABLE IF NOT EXISTS `tagente` (
`notinit_count` bigint(20) NOT NULL default '0',
`total_count` bigint(20) NOT NULL default '0',
`fired_count` bigint(20) NOT NULL default '0',
`update_module_count` tinyint(1) NOT NULL default '0',
`update_alert_count` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id_agente`),
KEY `nombre` (`nombre`),
KEY `direccion` (`direccion`),