2013-01-14 Sergio Martin <sergio.martin@artica.es>

* pandoradb.sql
	pandoradb.postgreSQL.sql
	pandoradb.oracle.sql
	extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql
	extras/network_components.oracle.sql
	extras/network_components.postgreSQL.sql: Delete old
	alert compound tables from database schemme

	* godmode/category/category.php
	godmode/category/edit_category.php: Adapt the category editor
	to metaconsole



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7468 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2013-01-14 17:09:26 +00:00
parent 4a86617714
commit 7fd387b9d7
9 changed files with 57 additions and 193 deletions

View File

@ -1,3 +1,17 @@
2013-01-14 Sergio Martin <sergio.martin@artica.es>
* pandoradb.sql
pandoradb.postgreSQL.sql
pandoradb.oracle.sql
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql
extras/network_components.oracle.sql
extras/network_components.postgreSQL.sql: Delete old
alert compound tables from database schemme
* godmode/category/category.php
godmode/category/edit_category.php: Adapt the category editor
to metaconsole
2013-01-14 Dario Rodriguez <dario.rodriguez@artica.es>
* godmode/menu.php: Moved duplicated config view.

View File

@ -612,3 +612,10 @@ INSERT INTO tnetwork_component_group VALUES (45,'Solaris',5);
INSERT INTO tnetwork_component_group VALUES (46,'AIX',5);
INSERT INTO tnetwork_component_group VALUES (47,'BSD',5);
INSERT INTO tnetwork_component_group VALUES (48,'MacOS',0);
-- ---------------------------------------------------------------------
-- Drop tables of compound alerts
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS talert_compound_actions;
DROP TABLE IF EXISTS talert_compound_elements;
DROP TABLE IF EXISTS talert_compound;

View File

@ -613,3 +613,10 @@ INSERT INTO "tnetwork_component_group" VALUES (45,'Solaris',5);
INSERT INTO "tnetwork_component_group" VALUES (46,'AIX',5);
INSERT INTO "tnetwork_component_group" VALUES (47,'BSD',5);
INSERT INTO "tnetwork_component_group" VALUES (48,'MacOS',0);
-- ---------------------------------------------------------------------
-- Drop tables of compound alerts
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS "talert_compound_actions";
DROP TABLE IF EXISTS "talert_compound_elements";
DROP TABLE IF EXISTS "talert_compound";

View File

@ -1049,3 +1049,11 @@ INSERT INTO `tnetwork_component_group` VALUES (45,'Solaris',5);
INSERT INTO `tnetwork_component_group` VALUES (46,'AIX',5);
INSERT INTO `tnetwork_component_group` VALUES (47,'BSD',5);
INSERT INTO `tnetwork_component_group` VALUES (48,'MacOS',0);
-- ---------------------------------------------------------------------
-- Drop tables of compound alerts
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `talert_compound_actions`;
DROP TABLE IF EXISTS `talert_compound_elements`;
DROP TABLE IF EXISTS `talert_compound`;

View File

@ -37,13 +37,18 @@ $tab = (string) get_parameter ("tab", "list");
$buttons = array(
'list' => array(
'active' => false,
'text' => '<a href="index.php?sec=galertas&sec2=godmode/category/category&tab=list">' .
'text' => '<a href="index.php?sec=galertas&sec2=godmode/category/category&tab=list&pure='.(int)$config['pure'].'">' .
html_print_image ("images/god6.png", true, array ("title" => __('List categories'))) .'</a>'));
$buttons[$tab]['active'] = true;
// Header
ui_print_page_header (__('Categories configuration'), "images/setup.png", false, "", true, $buttons);
if(defined('METACONSOLE')) {
ui_meta_print_header(__('Categories configuration'), __('List'), $buttons);
}
else {
ui_print_page_header (__('Categories configuration'), "images/setup.png", false, "", true, $buttons);
}
// Two actions can performed in this page: search and delete categories
@ -75,7 +80,7 @@ $result = categories_get_all_categories ();
echo "<table border=0 cellpadding=4 cellspacing=4 class=databox width=98%>";
echo "<tr>";
echo "<td align=right>";
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/category/edit_category&action=new">';
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/category/edit_category&action=new&pure='.(int)$config['pure'].'">';
html_print_input_hidden ("create_category", "1", true);
html_print_submit_button (__('Create category'), 'create_button', false, 'class="sub next"');
echo "</form>";
@ -112,9 +117,9 @@ if (!empty($result)) {
$data = array ();
$data[0] = "<a href='index.php?sec=gmodules&sec2=godmode/category/edit_category&action=update&id_category=" . $category["id"] . "'>" . $category["name"] . "</a>";
$data[1] = "<a href='index.php?sec=gmodules&sec2=godmode/category/edit_category&action=update&id_category=".$category["id"] . "'>" . html_print_image("images/config.png", true, array("title" => "Edit")) . "</a>&nbsp;&nbsp;";
$data[1] .= '<a href="index.php?sec=gmodules&sec2=godmode/category/category&delete_category='.$category["id"] . '"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">' . html_print_image("images/cross.png", true, array("title" => "Delete")) . '</a>';
$data[0] = "<a href='index.php?sec=gmodules&sec2=godmode/category/edit_category&action=update&id_category=" . $category["id"] . "&pure=" . (int)$config['pure'] . "'>" . $category["name"] . "</a>";
$data[1] = "<a href='index.php?sec=gmodules&sec2=godmode/category/edit_category&action=update&id_category=".$category["id"] . "&pure=" . (int)$config['pure'] . "'>" . html_print_image("images/config.png", true, array("title" => "Edit")) . "</a>&nbsp;&nbsp;";
$data[1] .= '<a href="index.php?sec=gmodules&sec2=godmode/category/category&delete_category='.$category["id"] . '&pure='.(int)$config['pure'].'"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">' . html_print_image("images/cross.png", true, array("title" => "Delete")) . '</a>';
array_push ($table->data, $data);
}

View File

@ -36,13 +36,19 @@ $tab = (string) get_parameter ("tab", "list");
$buttons = array(
'list' => array(
'active' => false,
'text' => '<a href="index.php?sec=gmodules&sec2=godmode/category/category&tab=list">' .
'text' => '<a href="index.php?sec=gmodules&sec2=godmode/category/category&tab=list&pure='.(int)$config['pure'].'">' .
html_print_image ("images/god6.png", true, array ("title" => __('List categories'))) .'</a>'));
$buttons[$tab]['active'] = true;
$buttons[$tab]['active'] = false;
// Header
ui_print_page_header (__('Categories configuration'), "images/setup.png", false, "", true, $buttons);
if(defined('METACONSOLE')) {
ui_meta_print_header(__('Categories configuration'), __('Editor'), $buttons);
}
else {
ui_print_page_header (__('Categories configuration'), "images/setup.png", false, "", true, $buttons);
}
// Two actions can performed in this page: update and create categories
// Update category: update an existing category
@ -102,7 +108,7 @@ else {
}
// Create/Update category form
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/category/edit_category&action=' . $action . '&id_category=' . $id_category . '" enctype="multipart/form-data">';
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/category/edit_category&action=' . $action . '&id_category=' . $id_category . '&pure='.(int)$config['pure'].'" enctype="multipart/form-data">';
echo '<div align=left style="width: 98%" class="pandora_form">';

View File

@ -442,77 +442,6 @@ CREATE OR REPLACE TRIGGER talert_template_mod_act_update AFTER UPDATE OF ID ON t
-- on update trigger 1
CREATE OR REPLACE TRIGGER talert_template_mod_ac_update1 AFTER UPDATE OF ID ON talert_actions FOR EACH ROW BEGIN UPDATE talert_template_module_actions SET ID_ALERT_ACTION = :NEW.ID WHERE ID_ALERT_ACTION = :OLD.ID; END;;
-- use to_char(time_from, 'hh24:mi:ss') function to retrieve time_from field info
-- use to_char(time_to, 'hh24:mi:ss') function to retrieve time_to field info
CREATE TABLE talert_compound (
id NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(255) default '',
description CLOB,
id_agent NUMBER(10, 0) NOT NULL REFERENCES tagente(id_agente) ON DELETE CASCADE,
time_threshold NUMBER(10, 0) default 0 NOT NULL,
max_alerts NUMBER(10, 0) default 1 NOT NULL,
min_alerts NUMBER(10, 0) default 0 NOT NULL,
time_from TIMESTAMP default to_date('00:00:00','hh24:mi:ss'),
time_to TIMESTAMP default to_date('00:00:00','hh24:mi:ss'),
monday NUMBER(5, 0) default 1,
tuesday NUMBER(5, 0) default 1,
wednesday NUMBER(5, 0) default 1,
thursday NUMBER(5, 0) default 1,
friday NUMBER(5, 0) default 1,
saturday NUMBER(5, 0) default 1,
sunday NUMBER(5, 0) default 1,
recovery_notify NUMBER(5, 0) default 0,
field2_recovery VARCHAR2(255) default '',
field3_recovery CLOB NOT NULL,
internal_counter NUMBER(10, 0) default 0,
last_fired NUMBER(19, 0) default 0 NOT NULL,
last_reference NUMBER(19, 0) default 0 NOT NULL,
times_fired NUMBER(10, 0) default 0 NOT NULL,
disabled NUMBER(5, 0) default 0,
priority NUMBER(5, 0) default 0,
special_day NUMBER(5, 0) default 0
);
CREATE SEQUENCE talert_compound_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER talert_compound_inc BEFORE INSERT ON talert_compound REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT talert_compound_s.nextval INTO :NEW.ID FROM dual; END;;
-- on update trigger
CREATE OR REPLACE TRIGGER talert_compound_update AFTER UPDATE OF ID_AGENTE ON tagente FOR EACH ROW BEGIN UPDATE talert_compound SET ID_AGENT = :NEW.ID_AGENTE WHERE ID_AGENT = :OLD.ID_AGENTE; END;;
CREATE TABLE talert_compound_elements (
id_alert_compound NUMBER(10, 0) NOT NULL REFERENCES talert_compound(id) ON DELETE CASCADE,
id_alert_template_module NUMBER(10, 0) NOT NULL REFERENCES talert_template_modules(id) ON DELETE CASCADE,
operation VARCHAR2(10),
"order" NUMBER(5, 0) default 0,
CONSTRAINT talert_compound_elements_cons CHECK (operation IN ('NOP', 'AND','OR','XOR','NAND','NOR','NXOR'))
);
CREATE UNIQUE INDEX talert_compound_elements_idx ON talert_compound_elements(id_alert_compound);
-- on update trigger
CREATE OR REPLACE TRIGGER talert_compound_elem_update AFTER UPDATE OF ID ON talert_compound FOR EACH ROW BEGIN UPDATE talert_compound_elements SET ID_ALERT_COMPOUND = :NEW.ID WHERE ID_ALERT_COMPOUND = :OLD.ID; END;;
-- on update trigger 1
CREATE OR REPLACE TRIGGER talert_compound_elem_update1 AFTER UPDATE OF ID ON talert_template_modules FOR EACH ROW BEGIN UPDATE talert_compound_elements SET ID_ALERT_TEMPLATE_MODULE = :NEW.ID WHERE ID_ALERT_TEMPLATE_MODULE = :OLD.ID; END;;
CREATE TABLE talert_compound_actions (
id NUMBER(10, 0) NOT NULL PRIMARY KEY,
id_alert_compound NUMBER(10, 0) NOT NULL REFERENCES talert_compound(id) ON DELETE CASCADE,
id_alert_action NUMBER(10, 0) NOT NULL REFERENCES talert_actions(id) ON DELETE CASCADE,
fires_min NUMBER(10, 0) default 0,
fires_max NUMBER(10, 0) default 0
);
CREATE SEQUENCE talert_compound_actions_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER talert_compound_actions_inc BEFORE INSERT ON talert_compound_actions REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT talert_compound_actions_s.nextval INTO :NEW.ID FROM dual; END;;
-- on update trigger
CREATE OR REPLACE TRIGGER talert_compound_actions_update AFTER UPDATE OF ID ON talert_compound FOR EACH ROW BEGIN UPDATE talert_compound_actions SET ID_ALERT_COMPOUND = :NEW.ID WHERE ID_ALERT_COMPOUND = :OLD.ID; END;;
-- on update trigger 1
CREATE OR REPLACE TRIGGER talert_compound_action_update1 AFTER UPDATE OF ID ON talert_actions FOR EACH ROW BEGIN UPDATE talert_compound_actions SET ID_ALERT_ACTION = :NEW.ID WHERE ID_ALERT_ACTION = :OLD.ID; END;;
CREATE TABLE talert_special_days (
id NUMBER(10,0) NOT NULL PRIMARY KEY,
date DATE default '0000-00-00' NOT NULL,

View File

@ -380,52 +380,6 @@ CREATE TABLE "talert_template_module_actions" (
"fires_max" INTEGER NOT NULL default 0
);
CREATE TABLE "talert_compound" (
"id" SERIAL NOT NULL PRIMARY KEY,
"name" varchar(255) default '',
"description" TEXT,
"id_agent" INTEGER NOT NULL REFERENCES tagente("id_agente") ON DELETE CASCADE ON UPDATE CASCADE,
"time_threshold" INTEGER NOT NULL default 0,
"max_alerts" INTEGER NOT NULL default 1,
"min_alerts" INTEGER NOT NULL default 0,
"time_from" TIME without time zone default '00:00:00',
"time_to" TIME without time zone default '00:00:00',
"monday" SMALLINT default 1,
"tuesday" SMALLINT default 1,
"wednesday" SMALLINT default 1,
"thursday" SMALLINT default 1,
"friday" SMALLINT default 1,
"saturday" SMALLINT default 1,
"sunday" SMALLINT default 1,
"recovery_notify" SMALLINT default 0,
"field2_recovery" varchar(255) NOT NULL default '',
"field3_recovery" TEXT NOT NULL,
"internal_counter" INTEGER default 0,
"last_fired" BIGINT NOT NULL default 0,
"last_reference" BIGINT NOT NULL default 0,
"times_fired" INTEGER NOT NULL default 0,
"disabled" SMALLINT default 0,
"priority" SMALLINT default 0,
"special_day" SMALLINT default 0
);
CREATE TYPE type_talert_compound_elements_operation AS ENUM ('NOP', 'AND','OR','XOR','NAND','NOR','NXOR');
CREATE TABLE "talert_compound_elements" (
"id_alert_compound" INTEGER NOT NULL REFERENCES talert_compound("id") ON DELETE CASCADE ON UPDATE CASCADE,
"id_alert_template_module" INTEGER NOT NULL REFERENCES talert_template_modules("id") ON DELETE CASCADE ON UPDATE CASCADE,
"operation" type_talert_compound_elements_operation,
"order" SMALLINT default 0
);
CREATE UNIQUE INDEX "talert_compound_elements_id_alert_compound_idx" ON "talert_compound_elements"("id_alert_compound");
CREATE TABLE "talert_compound_actions" (
"id" SERIAL NOT NULL PRIMARY KEY,
"id_alert_compound" INTEGER NOT NULL REFERENCES talert_compound("id") ON DELETE CASCADE ON UPDATE CASCADE,
"id_alert_action" INTEGER NOT NULL REFERENCES talert_actions("id") ON DELETE CASCADE ON UPDATE CASCADE,
"fires_min" INTEGER default 0,
"fires_max" INTEGER default 0
);
CREATE TYPE type_talert_special_days_same_day AS ENUM ('monday','tuesday','wednesday','thursday','friday','saturday','sunday');
CREATE TABLE "talert_special_days" (
"id" SERIAL NOT NULL PRIMARY KEY,

View File

@ -425,72 +425,6 @@ CREATE TABLE IF NOT EXISTS `talert_template_module_actions` (
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `talert_compound`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `talert_compound` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(255) default '',
`description` mediumtext,
`id_agent` int(10) unsigned NOT NULL,
`time_threshold` int(10) NOT NULL default '0',
`max_alerts` int(4) unsigned NOT NULL default '1',
`min_alerts` int(4) unsigned NOT NULL default '0',
`time_from` time default '00:00:00',
`time_to` time default '00:00:00',
`monday` tinyint(1) default 1,
`tuesday` tinyint(1) default 1,
`wednesday` tinyint(1) default 1,
`thursday` tinyint(1) default 1,
`friday` tinyint(1) default 1,
`saturday` tinyint(1) default 1,
`sunday` tinyint(1) default 1,
`recovery_notify` tinyint(1) default '0',
`field2_recovery` varchar(255) NOT NULL default '',
`field3_recovery` mediumtext NOT NULL,
`internal_counter` int(4) default '0',
`last_fired` bigint(20) NOT NULL default '0',
`last_reference` bigint(20) NOT NULL default '0',
`times_fired` int(3) NOT NULL default '0',
`disabled` tinyint(1) default '0',
`priority` tinyint(4) default '0',
`special_day` tinyint(1) default 0,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_agent`) REFERENCES tagente(`id_agente`)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `talert_compound_elements`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `talert_compound_elements` (
`id_alert_compound` int(10) unsigned NOT NULL,
`id_alert_template_module` int(10) unsigned NOT NULL,
`operation` enum('NOP', 'AND','OR','XOR','NAND','NOR','NXOR'),
`order` tinyint(2) unsigned default 0,
UNIQUE (`id_alert_compound`, `id_alert_template_module`, `operation`),
FOREIGN KEY (`id_alert_compound`) REFERENCES talert_compound(`id`)
ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`id_alert_template_module`) REFERENCES talert_template_modules(`id`)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `talert_compound_actions`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `talert_compound_actions` (
`id` int(10) unsigned NOT NULL auto_increment,
`id_alert_compound` int(10) unsigned NOT NULL,
`id_alert_action` int(10) unsigned NOT NULL,
`fires_min` int(3) unsigned default 0,
`fires_max` int(3) unsigned default 0,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_alert_compound`) REFERENCES talert_compound(`id`)
ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`id_alert_action`) REFERENCES talert_actions(`id`)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `talert_special_days`
-- -----------------------------------------------------