diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 42e543470f..f2150fa09c 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2011-07-07 Sergio Martin + + * pandoradb.sql + pandoradb.postgreSQL.sql + pandoradb.oracle.sql + extras/pandoradb_migrate_v3.2_to_v4.0.sql + godmode/agentes/planned_downtime.php: Added only_alerts + flag to planned downtimes + 2011-07-07 Sergio Martin * operation/servers/view_server_detail.php: Updated missed diff --git a/pandora_console/extras/pandoradb_migrate_v3.2_to_v4.0.sql b/pandora_console/extras/pandoradb_migrate_v3.2_to_v4.0.sql index 8a6395ceca..9b7c9e206f 100644 --- a/pandora_console/extras/pandoradb_migrate_v3.2_to_v4.0.sql +++ b/pandora_console/extras/pandoradb_migrate_v3.2_to_v4.0.sql @@ -200,3 +200,9 @@ ALTER TABLE `tnetwork_map` ADD COLUMN `show_snmp_modules` TINYINT(1) UNSIGNED N -- ----------------------------------------------------- ALTER TABLE `trecon_task` ADD COLUMN `disabled` tinyint(1) UNSIGNED NOT NULL DEFAULT 0; + +-- ----------------------------------------------------- +-- Table `tplanned_downtime` +-- ----------------------------------------------------- + +ALTER TABLE `tplanned_downtime` ADD COLUMN `only_alerts` TINYINT(1) NOT NULL DEFAULT 0; diff --git a/pandora_console/godmode/agentes/planned_downtime.php b/pandora_console/godmode/agentes/planned_downtime.php index 540dd402ed..a4bca24927 100644 --- a/pandora_console/godmode/agentes/planned_downtime.php +++ b/pandora_console/godmode/agentes/planned_downtime.php @@ -51,6 +51,8 @@ $delete_downtime_agent = (int) get_parameter ("delete_downtime_agent", 0); $groups = users_get_groups (); +$only_alerts = (bool) get_parameter ('only_alerts', 0); + // Header ui_print_page_header (__("Planned Downtime"), "images/god1.png", false, "", true, ""); @@ -108,7 +110,8 @@ if ($create_downtime || $update_downtime) { 'description' => $description, 'date_from' => $datetime_from, 'date_to' => $datetime_to, - 'id_group' => $id_group); + 'id_group' => $id_group, + 'only_alerts' => (int)$only_alerts); $result = db_process_sql_insert('tplanned_downtime', $values); } else if ($update_downtime) { @@ -117,15 +120,26 @@ if ($create_downtime || $update_downtime) { 'description' => $description, 'date_from' => $datetime_from, 'date_to' => $datetime_to, - 'id_group' => $id_group); + 'id_group' => $id_group, + 'only_alerts' => (int)$only_alerts); $result = db_process_sql_update('tplanned_downtime', $values, array('id' => $id_downtime)); } if ($result === false) { - echo '

'.__('Could not be created').'

'; + if($create_downtime) { + echo '

'.__('Could not be created').'

'; + } + else { + echo '

'.__('Could not be updated').'

'; + } } else { - echo '

'.__('Successfully created').'

'; + if($create_downtime) { + echo '

'.__('Successfully created').'

'; + } + else { + echo '

'.__('Successfully updated').'

'; + } } } } @@ -137,17 +151,17 @@ if ($create_downtime || $update_downtime) { if ($id_downtime > 0) { switch ($config["dbtype"]) { case "mysql": - $sql = sprintf ("SELECT `id`, `name`, `description`, `date_from`, `date_to`, `id_group` + $sql = sprintf ("SELECT `id`, `name`, `description`, `date_from`, `date_to`, `id_group`, `only_alerts` FROM `tplanned_downtime` WHERE `id` = %d", $id_downtime); break; case "postgresql": - $sql = sprintf ("SELECT \"id\", \"name\", \"description\", \"date_from\", \"date_to\", \"id_group\" + $sql = sprintf ("SELECT \"id\", \"name\", \"description\", \"date_from\", \"date_to\", \"id_group\", \"only_alerts\" FROM \"tplanned_downtime\" WHERE \"id\" = %d", $id_downtime); break; case "oracle": - $sql = sprintf ("SELECT id, name, description, date_from, date_to, id_group + $sql = sprintf ("SELECT id, name, description, date_from, date_to, id_group, only_alerts FROM tplanned_downtime WHERE id = %d", $id_downtime); break; @@ -160,6 +174,7 @@ if ($create_downtime || $update_downtime) { $date_to = strftime ('%Y-%m-%d', $result["date_to"]); $time_from = strftime ('%I:%M%p', $result["date_from"]); $time_to = strftime ('%I:%M%p', $result["date_to"]); + $only_alerts = $result["only_alerts"]; if ($id_group == 0) $id_group = $result['id_group']; @@ -182,6 +197,8 @@ if ($create_downtime || $update_downtime) { $table->data[5][0] = __('Group'); $table->data[5][1] = html_print_select_groups(false, "AR", true, 'id_group', $id_group, '', '', 0, true); + $table->data[6][0] = __('Only alerts'); + $table->data[6][1] = html_print_checkbox('only_alerts', 1, $only_alerts, true); echo '
'; if ($id_downtime > 0){ @@ -313,13 +330,15 @@ else { $table->head[2] = __('Group'); $table->head[3] = __('From'); $table->head[4] = __('To'); - $table->head[5] = __('Delete'); - $table->head[6] = __('Update'); - $table->head[7] = __('Running'); + $table->head[5] = __('Affect'); + $table->head[6] = __('Delete'); + $table->head[7] = __('Update'); + $table->head[8] = __('Running'); $table->align[2] = "center"; $table->align[5] = "center"; $table->align[6] = "center"; $table->align[7] = "center"; + $table->align[8] = "center"; $sql = "SELECT * FROM tplanned_downtime WHERE id_group IN (" . implode (",", array_keys ($groups)) . ")"; $downtimes = db_get_all_rows_sql ($sql); @@ -336,22 +355,28 @@ else { $data[2] = ui_print_group_icon ($downtime['id_group'], true); $data[3] = date ("Y-m-d H:i", $downtime['date_from']); $data[4] = date ("Y-m-d H:i", $downtime['date_to']); + if($only_alerts) { + $data[5] = __('Only alerts'); + } + else { + $data[5] = __('All'); + } if ($downtime["executed"] == 0){ - $data[5] = '' . html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))); - $data[6] = '' . + $data[7] = '' . html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . ''; } else { - $data[5]= "N/A"; $data[6]= "N/A"; + $data[7]= "N/A"; } if ($downtime["executed"] == 0) - $data[7] = html_print_image ("images/pixel_green.png", true, array ('width' => 20, 'height' => 20, 'alt' => __('Executed'))); + $data[8] = html_print_image ("images/pixel_green.png", true, array ('width' => 20, 'height' => 20, 'alt' => __('Executed'))); else - $data[7] = html_print_image ("images/pixel_red.png", true, array ('width' => 20, 'height' => 20, 'alt' => __('Not executed'))); + $data[8] = html_print_image ("images/pixel_red.png", true, array ('width' => 20, 'height' => 20, 'alt' => __('Not executed'))); array_push ($table->data, $data); } diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index d085492cc3..d905689868 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -1108,7 +1108,8 @@ CREATE TABLE tplanned_downtime ( date_from NUMBER(19, 0) default 0 NOT NULL, date_to NUMBER(19, 0) default 0 NOT NULL, executed NUMBER(5, 0) default 0 NOT NULL, - id_group NUMBER(19, 0) default 0 NOT NULL + id_group NUMBER(19, 0) default 0 NOT NULL, + only_alerts NUMBER(5, 0) default 0 NOT NULL ); CREATE SEQUENCE tplanned_downtime_s INCREMENT BY 1 START WITH 1; diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index 9921da61ea..11c5fbc09e 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -882,7 +882,8 @@ CREATE TABLE "tplanned_downtime" ( "date_from" BIGINT NOT NULL default 0, "date_to" BIGINT NOT NULL default 0, "executed" SMALLINT NOT NULL default 0, - "id_group" BIGINT NOT NULL default 0 + "id_group" BIGINT NOT NULL default 0, + "only_alerts" SMALLINT NOT NULL default 0 ); CREATE TABLE "tplanned_downtime_agents" ( diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 06d8515389..dbedc7fb82 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -965,6 +965,7 @@ CREATE TABLE IF NOT EXISTS `tplanned_downtime` ( `date_to` bigint(20) NOT NULL default '0', `executed` tinyint(1) UNSIGNED NOT NULL default 0, `id_group` mediumint(8) unsigned NULL default 0, + `only_alerts` tinyint(1) UNSIGNED NOT NULL default 0, PRIMARY KEY ( `id` ) ) ENGINE = InnoDB DEFAULT CHARSET=utf8;