2012-12-04 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/pandoradb_migrate_4.0.x_to_5.0.oracle.sql
	extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql
	godmode/alerts/configure_alert_template.php: Add wizard_level flag to the
	alert templates table



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7225 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2012-12-04 15:34:57 +00:00
parent 03b0fc8a95
commit 10342303a1
8 changed files with 40 additions and 6 deletions

View File

@ -1,3 +1,14 @@
2012-12-04 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/pandoradb_migrate_4.0.x_to_5.0.oracle.sql
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql
godmode/alerts/configure_alert_template.php: Add wizard_level flag to the
alert templates table
2012-12-04 Miguel de Dios <miguel.dedios@artica.es> 2012-12-04 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/reporting_builder.php, * godmode/reporting/reporting_builder.php,

View File

@ -81,6 +81,7 @@ CREATE TABLE IF NOT EXISTS `talert_special_days` (
-- Table `talert_templates` -- Table `talert_templates`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE `talert_templates` ADD COLUMN `special_day` tinyint(1) DEFAULT '0'; ALTER TABLE `talert_templates` ADD COLUMN `special_day` tinyint(1) DEFAULT '0';
ALTER TABLE `talert_templates` ADD COLUMN `wizard_level` enum('basic','advanced','custom','nowizard') DEFAULT 'nowizard';
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- Table `tplanned_downtime` -- Table `tplanned_downtime`

View File

@ -103,6 +103,8 @@ CREATE OR REPLACE TRIGGER talert_special_days_inc BEFORE INSERT ON talert_specia
-- Table talert_templates -- Table talert_templates
-- ----------------------------------------------------- -- -----------------------------------------------------
ALTER TABLE talert_templates ADD (special_day NUMBER(5,0) default 0); ALTER TABLE talert_templates ADD (special_day NUMBER(5,0) default 0);
ALTER TABLE talert_templates ADD (wizard_level VARCHAR2(100) default 'nowizard' NOT NULL);
ALTER TABLE talert_templates ADD CONSTRAINT t_alert_templates_wizard_level_cons CHECK (wizard_level IN ('basic','advanced','custom','nowizard'));
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table talert_templates -- Table talert_templates
@ -297,7 +299,7 @@ WHERE token='prominent_time';
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table tnetwork_component -- Table tnetwork_component
-- ----------------------------------------------------- -- -----------------------------------------------------
ALTER TABLE tnetwork_component ADD (wizard_level VARCHAR2(100) default 'custom' NOT NULL); ALTER TABLE tnetwork_component ADD (wizard_level VARCHAR2(100) default 'nowizard' NOT NULL);
ALTER TABLE tnetwork_component ADD CONSTRAINT t_network_component_wizard_level_cons CHECK (wizard_level IN ('basic','advanced','custom','nowizard')); ALTER TABLE tnetwork_component ADD CONSTRAINT t_network_component_wizard_level_cons CHECK (wizard_level IN ('basic','advanced','custom','nowizard'));
ALTER TABLE tnetwork_component ADD (only_metaconsole NUMBER(5, 0) default 0 NOT NULL); ALTER TABLE tnetwork_component ADD (only_metaconsole NUMBER(5, 0) default 0 NOT NULL);
ALTER TABLE tnetwork_component ADD (macros CLOB default ''); ALTER TABLE tnetwork_component ADD (macros CLOB default '');

View File

@ -96,6 +96,8 @@ CREATE TABLE "talert_special_days" (
-- ----------------------------------------------------- -- -----------------------------------------------------
ALTER TABLE "talert_templates" ADD COLUMN "special_day" SMALLINT default 0; ALTER TABLE "talert_templates" ADD COLUMN "special_day" SMALLINT default 0;
CREATE TYPE type_talert_templates_wizard_level AS ENUM ('basic','advanced','custom','nowizard');
ALTER TABLE "talert_templates" ADD COLUMN "wizard_level" type_talert_templates_wizard_level default 'nowizard';
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table "tplanned_downtime" -- Table "tplanned_downtime"

View File

@ -179,6 +179,7 @@ function update_template ($step) {
$max = (float) get_parameter ('max'); $max = (float) get_parameter ('max');
$min = (float) get_parameter ('min'); $min = (float) get_parameter ('min');
$matches = (bool) get_parameter ('matches_value'); $matches = (bool) get_parameter ('matches_value');
$wizard_level = (string) get_parameter ('wizard_level');
$priority = (int) get_parameter ('priority'); $priority = (int) get_parameter ('priority');
$id_group = get_parameter ("id_group"); $id_group = get_parameter ("id_group");
$name_check = db_get_value ('name', 'talert_templates', 'name', $name); $name_check = db_get_value ('name', 'talert_templates', 'name', $name);
@ -191,7 +192,8 @@ function update_template ($step) {
'min_value' => $min, 'min_value' => $min,
'id_group' => $id_group, 'id_group' => $id_group,
'matches_value' => $matches, 'matches_value' => $matches,
'priority' => $priority); 'priority' => $priority,
'wizard_level' => $wizard_level);
$result = alerts_update_alert_template ($id,$values); $result = alerts_update_alert_template ($id,$values);
} }
@ -327,6 +329,7 @@ if ($create_template) {
$min = (float) get_parameter ('min'); $min = (float) get_parameter ('min');
$matches = (bool) get_parameter ('matches_value'); $matches = (bool) get_parameter ('matches_value');
$priority = (int) get_parameter ('priority'); $priority = (int) get_parameter ('priority');
$wizard_level = (string) get_parameter ('wizard_level');
$id_group = get_parameter ("id_group"); $id_group = get_parameter ("id_group");
$name_check = db_get_value ('name', 'talert_templates', 'name', $name); $name_check = db_get_value ('name', 'talert_templates', 'name', $name);
@ -336,7 +339,8 @@ if ($create_template) {
'min_value' => $min, 'min_value' => $min,
'id_group' => $id_group, 'id_group' => $id_group,
'matches_value' => $matches, 'matches_value' => $matches,
'priority' => $priority); 'priority' => $priority,
'wizard_level' => $wizard_level);
if($config['dbtype'] == "oracle") { if($config['dbtype'] == "oracle") {
$values['field3'] = ' '; $values['field3'] = ' ';
@ -415,7 +419,8 @@ if ($id && ! $create_template) {
$default_action = $template['id_alert_action']; $default_action = $template['id_alert_action'];
$priority = $template['priority']; $priority = $template['priority'];
$id_group = $template["id_group"]; $id_group = $template['id_group'];
$wizard_level = $template['wizard_level'];
} }
print_alert_template_steps ($step, $id); print_alert_template_steps ($step, $id);
@ -582,6 +587,14 @@ else {
$table->data[2][0] = __('Priority'); $table->data[2][0] = __('Priority');
$table->data[2][1] = html_print_select (get_priorities (), 'priority', $table->data[2][1] = html_print_select (get_priorities (), 'priority',
$priority, '', 0, 0, true, false, false); $priority, '', 0, 0, true, false, false);
$table->data[2][0] = __('Wizard level');
$wizard_levels = array('nowizard' => __('No wizard'),
'basic' => __('Basic'),
'advanced' => __('Advanced'),
//'custom' => __('Custom'),
);
$table->data[2][1] = html_print_select($wizard_levels,'wizard_level',$wizard_level,'','',-1,true, false, false);
$table->data[3][0] = __('Condition type'); $table->data[3][0] = __('Condition type');
$table->data[3][1] = html_print_select (alerts_get_alert_templates_types (), 'type', $table->data[3][1] = html_print_select (alerts_get_alert_templates_types (), 'type',

View File

@ -382,7 +382,9 @@ CREATE TABLE talert_templates (
priority NUMBER(10, 0) default 0 NOT NULL, priority NUMBER(10, 0) default 0 NOT NULL,
id_group NUMBER(10, 0) default 0 NOT NULL, id_group NUMBER(10, 0) default 0 NOT NULL,
special_day NUMBER(5, 0) default 0, special_day NUMBER(5, 0) default 0,
CONSTRAINT t_alert_templates_type_cons CHECK (type IN ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical', 'onchange', 'unknown', 'always')) wizard_level VARCHAR2(100) default 'nowizard' NOT NULL,
CONSTRAINT t_alert_templates_type_cons CHECK (type IN ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical', 'onchange', 'unknown', 'always')),
CONSTRAINT t_alert_templates_wizard_level_cons CHECK (wizard_level IN ('basic','advanced','custom','nowizard'))
); );
CREATE INDEX talert_templates_id_al_act_idx ON talert_templates(id_alert_action); CREATE INDEX talert_templates_id_al_act_idx ON talert_templates(id_alert_action);

View File

@ -305,6 +305,7 @@ CREATE TABLE "talert_actions" (
); );
CREATE TYPE type_talert_templates_alert_template AS ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical', 'onchange', 'unknown', 'always'); CREATE TYPE type_talert_templates_alert_template AS ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical', 'onchange', 'unknown', 'always');
CREATE TYPE type_talert_templates_wizard_level AS ENUM ('basic','advanced','custom','nowizard');
CREATE TABLE "talert_templates" ( CREATE TABLE "talert_templates" (
"id" SERIAL NOT NULL PRIMARY KEY, "id" SERIAL NOT NULL PRIMARY KEY,
"name" text default '', "name" text default '',
@ -349,7 +350,8 @@ CREATE TABLE "talert_templates" (
"field10_recovery" text NOT NULL default '', "field10_recovery" text NOT NULL default '',
"priority" INTEGER NOT NULL default 0, "priority" INTEGER NOT NULL default 0,
"id_group" INTEGER NOT NULL default 0, "id_group" INTEGER NOT NULL default 0,
"special_day" SMALLINT default 0 "special_day" SMALLINT default 0,
"wizard_level" type_talert_templates_wizard_level default 'nowizard'
); );
CREATE INDEX "talert_templates_id_alert_action_idx" ON "talert_templates"("id_alert_action"); CREATE INDEX "talert_templates_id_alert_action_idx" ON "talert_templates"("id_alert_action");

View File

@ -373,6 +373,7 @@ CREATE TABLE IF NOT EXISTS `talert_templates` (
`priority` tinyint(4) default '0', `priority` tinyint(4) default '0',
`id_group` mediumint(8) unsigned NULL default 0, `id_group` mediumint(8) unsigned NULL default 0,
`special_day` tinyint(1) default 0, `special_day` tinyint(1) default 0,
`wizard_level` enum('basic','advanced','custom','nowizard') default 'nowizard',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_template_action` (`id_alert_action`), KEY `idx_template_action` (`id_alert_action`),
FOREIGN KEY (`id_alert_action`) REFERENCES talert_actions(`id`) FOREIGN KEY (`id_alert_action`) REFERENCES talert_actions(`id`)