diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index d331638ad6..5dc94a28a2 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,15 @@ +2012-02-08 Vanessa Gil + * pandoradb.sql + pandoradb.postgreSQL.sql + pandoradb.oracle.sql + extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql + extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql + extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql: Removed 'criticity_alert' + to tevento table. + + * godmode/events/custom_events.php: Modify fields selection to + show events. + 2012-02-08 Miguel de Dios * operation/agentes/alerts_status.php: added a check for user ACL groups in diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql index ce6340f370..d29227ed00 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql @@ -101,7 +101,7 @@ ON DELETE CASCADE; -- ----------------------------------------------------- ALTER TABLE `tevento` ADD COLUMN (`source` tinytext NOT NULL DEFAULT '', -`id_extra` tinytext NOT NULL DEFAULT '', `criticity_alert` int(4) unsigned NOT NULL default '0'); +`id_extra` tinytext NOT NULL DEFAULT ''); -- ----------------------------------------------------- -- Table `talert_snmp` diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql index bd59b345c1..82793616a0 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql @@ -108,7 +108,6 @@ references tplanned_downtime (id); alter table tevento add (source VARCHAR2(100) default '' NOT NULL); alter table tevento add (id_extra VARCHAR2(100) default '' NOT NULL); -alter table tevento add (criticity_alert NUMBER(10, 0) default 0 NOT NULL); -- ----------------------------------------------------- -- Table `talert_snmp` @@ -141,4 +140,4 @@ CREATE TABLE tevent_filter ( group_rep NUMBER(10, 0) default 0 NOT NULL, tag VARCHAR2(600) default '' NOT NULL, filter_only_alert NUMBER(10, 0) default -1 NOT NULL -); \ No newline at end of file +); diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql index 2a8d49a350..c4da9de0aa 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql @@ -93,7 +93,6 @@ REFERENCES "tplanned_downtime"("id"); ALTER TABLE "tevento" ADD COLUMN "source" text NULL default ''; ALTER TABLE "tevento" ADD COLUMN "id_extra" text NULL default ''; -ALTER TABLE "tevento" ADD COLUMN "criticity" INTEGER NOT NULL default 0; -- ----------------------------------------------------- -- Table `talert_snmp` diff --git a/pandora_console/godmode/events/custom_events.php b/pandora_console/godmode/events/custom_events.php index febfb8bdff..d7841fe983 100644 --- a/pandora_console/godmode/events/custom_events.php +++ b/pandora_console/godmode/events/custom_events.php @@ -36,7 +36,7 @@ if ($update) { $fields_selected = (array)get_parameter('fields_selected'); if ($fields_selected[0] == '') { - $event_fields = 'evento,id_agente,estado,timestamp'; + $event_fields = io_safe_input('evento,id_agente,estado,timestamp'); $fields_selected = explode (',', $event_fields); } else { $event_fields = implode (',', $fields_selected); @@ -51,14 +51,65 @@ if ($update) { } $result_selected = array(); + if ($fields_selected[0]!='') { foreach ($fields_selected as $field_selected) { - $result_selected[$field_selected] = $field_selected; + switch ($field_selected) { + case 'id_evento': + $result = __('Event id'); + break; + case 'evento': + $result = __('Event name'); + break; + case 'id_agente': + $result = __('Agent name'); + break; + case 'id_usuario': + $result = __('User'); + break; + case 'id_grupo': + $result = __('Group'); + break; + case 'estado': + $result = __('Status'); + break; + case 'timestamp': + $result = __('Timestamp'); + break; + case 'event_type': + $result = __('Event type'); + break; + case 'id_agentmodule': + $result = __('Agent module'); + break; + case 'id_alert_am': + $result = __('Alert'); + break; + case 'criticity': + $result = __('Criticity id'); + break; + case 'user_comment': + $result = __('Comment'); + break; + case 'tags': + $result = __('Tags'); + break; + case 'source': + $result = __('Source'); + break; + case 'id_extra': + $result = __('Extra id'); + break; + } + + $result_selected[$field_selected] = $result; } } $event = array(); +echo '

'.__('Show event fields').'

'; + $table->width = '90%'; $table->size = array(); @@ -66,42 +117,42 @@ $table->size[0] = '20%'; $table->size[2] = '20%'; $table->data = array(); -$table->data[0][0] = '

'.__('Show event fields').'

'; $fields_available = array(); -$fields_available['id_evento'] = 'id_evento'; -$fields_available['evento'] = 'evento'; -$fields_available['id_agente'] = 'id_agente'; -$fields_available['id_usuario'] = 'id_usuario'; -$fields_available['id_grupo'] = 'id_grupo'; -$fields_available['estado'] = 'estado'; -$fields_available['timestamp'] = 'timestamp'; -$fields_available['event_type'] = 'event_type'; -$fields_available['id_agentmodule'] = 'id_agentmodule'; -$fields_available['id_alert_am'] = 'id_alert_am'; -$fields_available['criticity'] = 'criticity'; -$fields_available['user_comment'] = 'user_comment'; -$fields_available['tags'] = 'tags'; -$fields_available['source'] = 'source'; -$fields_available['id_extra'] = 'id_extra'; -$fields_available['criticity_alert'] = 'criticity_alert'; + +$fields_available['id_evento'] = __('Event id'); +$fields_available['evento'] = __('Event name'); +$fields_available['id_agente'] = __('Agent name'); +$fields_available['id_usuario'] = __('User'); +$fields_available['id_grupo'] = __('Group'); +$fields_available['estado'] = __('Status'); +$fields_available['timestamp'] = __('Timestamp'); +$fields_available['event_type'] = __('Event type'); +$fields_available['id_agentmodule'] = __('Agent module'); +$fields_available['id_alert_am'] = __('Alert'); +$fields_available['criticity'] = __('Criticity'); +$fields_available['user_comment'] = __('Comment'); +$fields_available['tags'] = __('Tags'); +$fields_available['source'] = __('Source'); +$fields_available['id_extra'] = __('Extra id'); + //remove fields already selected -foreach ($fields_available as $available) { +foreach ($fields_available as $key=>$available) { foreach ($result_selected as $selected) { if ($selected == $available) { - unset($fields_available[$selected]); + unset($fields_available[$key]); } } } $table->data[1][0] = '' . __('Fields available').''; -$table->data[1][1] = html_print_select ($fields_available, 'fields_available[]', true, '', __('None'), '', true, true, false); +$table->data[1][1] = html_print_select ($fields_available, 'fields_available[]', true, '', '', '', true, true, false); $table->data[1][2] = html_print_image('images/darrowright.png', true, array('id' => 'right', 'title' => __('Add fields to select'))); //html_print_input_image ('add', 'images/darrowright.png', 1, '', true, array ('title' => __('Add tags to module'))); $table->data[1][2] .= '



' . html_print_image('images/darrowleft.png', true, array('id' => 'left', 'title' => __('Delete fields to select'))); //html_print_input_image ('add', 'images/darrowleft.png', 1, '', true, array ('title' => __('Delete tags to module'))); $table->data[1][3] = '' . __('Fields selected') . ''; -$table->data[1][4] = html_print_select($result_selected, 'fields_selected[]', true, '', __('None'), '', true, true, false); +$table->data[1][4] = html_print_select($result_selected, 'fields_selected[]', true, '', '', '', true, true, false); echo '
'; @@ -122,7 +173,7 @@ $(document).ready (function () { field_name = $(value).html(); if (field_name != ){ id_field = $(value).attr('value'); - $("select[name='fields_selected[]']").append($("").html(field_name).attr("value", field_name)); + $("select[name='fields_selected[]']").append($("").html(field_name).attr("value", id_field)); $("#fields_available").find("option[value='" + id_field + "']").remove(); } }); @@ -133,7 +184,7 @@ $(document).ready (function () { field_name = $(value).html(); if (field_name != ){ id_field = $(value).attr('value'); - $("select[name='fields_available[]']").append($("").val(field_name).html('' + field_name + '')); + $("select[name='fields_available[]']").append($("").val(field_name).html('' + id_field + '')); $("#fields_selected").find("option[value='" + id_field + "']").remove(); } }); diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index c72a216a69..c96aa576a3 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -513,7 +513,6 @@ CREATE TABLE tevento ( tags CLOB, source VARCHAR2(100) default '' NOT NULL, id_extra VARCHAR2(100) default '' NOT NULL, - criticity_alert NUMBER(10, 0) default 0 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', 'configuration_change')) ); CREATE INDEX tevento_id_1_idx ON tevento(id_agente, id_evento); diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index bd57ea784b..f7adec102c 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -404,8 +404,7 @@ CREATE TABLE "tevento" ( "user_comment" text NOT NULL, "tags" text NOT NULL, "source" text NOT NULL default '', - "id_extra" text NOT NULL default '', - "criticity_alert" INTEGER NOT NULL default 0 + "id_extra" text NOT NULL default '' ); CREATE INDEX "tevento_id_1_idx" ON "tevento"("id_agente", "id_evento"); CREATE INDEX "tevento_id_2_idx" ON "tevento"("utimestamp", "id_evento"); diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index e21471e8b1..1efb1f19c5 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -449,7 +449,6 @@ CREATE TABLE IF NOT EXISTS `tevento` ( `tags` text NOT NULL, `source` tinytext NOT NULL default '', `id_extra` tinytext NOT NULL default '', - `criticity_alert` int(4) unsigned NOT NULL default '0', PRIMARY KEY (`id_evento`), KEY `indice_1` (`id_agente`,`id_evento`), KEY `indice_2` (`utimestamp`,`id_evento`),