2012-02-07 Vanessa Gil <vanessa.gil@artica.es>

* 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
	  godmode/agentes/module_manager_editor_common.php
	  godmode/events/custom_events.php
	  operation/events/events_list.php: Modify fields selection to
	show events.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5513 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
vgilc 2012-02-07 18:11:12 +00:00
parent bf54328305
commit 0f87007998
8 changed files with 135 additions and 168 deletions

View File

@ -1,3 +1,15 @@
2012-02-07 Vanessa Gil <vanessa.gil@artica.es>
* 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
godmode/agentes/module_manager_editor_common.php
godmode/events/custom_events.php
operation/events/events_list.php: Modify fields selection to
show events.
2012-02-07 Dario Rodriguez <dario.rodriguez@artica.es>
* include/graphs/functions_pchart.php: Fixed a problem charting lineal

View File

@ -292,7 +292,7 @@ $(document).ready (function () {
$("#right").click (function () {
jQuery.each($("select[name='id_tag_available[]'] option:selected"), function (key, value) {
tag_name = $(value).html();
if (tag_name != 'None'){
if (tag_name != <?php echo "'".__('None')."'"; ?>){
id_tag = $(value).attr('value');
$("select[name='id_tag_selected[]']").append($("<option selected='selected'>").val(id_tag).html('<i>' + tag_name + '</i>'));
$("#id_tag_available").find("option[value='" + id_tag + "']").remove();
@ -302,7 +302,7 @@ $(document).ready (function () {
$("#left").click (function () {
jQuery.each($("select[name='id_tag_selected[]'] option:selected"), function (key, value) {
tag_name = $(value).html();
if (tag_name != 'None'){
if (tag_name != <?php echo "'".__('None')."'"; ?>){
id_tag = $(value).attr('value');
$("select[name='id_tag_available[]']").append($("<option>").val(id_tag).html('<i>' + tag_name + '</i>'));
$("#id_tag_selected").find("option[value='" + id_tag + "']").remove();

View File

@ -28,7 +28,37 @@ if (! check_acl($config['id_user'], 0, "PM")) {
// Header
ui_print_page_header (__('Custom events'), "", false, "", true);
$update = get_parameter('update', 0);
$update = get_parameter('update_config', 0);
$fields_selected = array();
$event_fields = '';
$fields_selected = explode (',', $config['event_fields']);
if ($update) {
$fields_selected = (array)get_parameter('fields_selected');
if ($fields_selected[0] == '') {
$event_fields = 'evento,id_agente,estado,timestamp';
$fields_selected = explode (',', $event_fields);
} else {
$event_fields = implode (',', $fields_selected);
}
$values = array(
'token' => 'event_fields',
'value' => $event_fields
);
//update 'event_fields' in tconfig table to keep the value at update.
$result = db_process_sql_update('tconfig', $values, array ('token' => 'event_fields'));
}
$result_selected = array();
if ($fields_selected[0]!='') {
foreach ($fields_selected as $field_selected) {
$result_selected[$field_selected] = $field_selected;
}
}
$event = array();
$table->width = '90%';
@ -40,67 +70,41 @@ $table->size[2] = '20%';
$table->data = array();
$table->data[0][0] = '<h3>'.__('Show event fields').'</h3>';
$table->data[1][0] = '<b>'.__('Event ID').'</b>';
$table->data[1][1] = __('Yes').'&nbsp;'.html_print_radio_button('show_id_evento', 1, '', $config['show_id_evento'], true);
$table->data[1][1] .= __('No').'&nbsp;'.html_print_radio_button('show_id_evento', 0, '', $config['show_id_evento'], true);
$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';
$table->data[2][0] = '<b>'.__('Event name').'</b>';
$table->data[2][1] = __('Yes').'&nbsp;'.html_print_radio_button('show_evento', 1, '', $config['show_evento'], true);
$table->data[2][1] .= __('No').'&nbsp;'.html_print_radio_button('show_evento', 0, '', $config['show_evento'], true);
//remove fields already selected
foreach ($fields_available as $available) {
foreach ($result_selected as $selected) {
if ($selected == $available) {
unset($fields_available[$selected]);
}
}
}
$table->data[3][0] = '<b>'.__('Agent ID').'</b>';
$table->data[3][1] = __('Yes').'&nbsp;'.html_print_radio_button('show_id_agente', 1, '', $config['show_id_agente'], true);
$table->data[3][1] .=__('No').'&nbsp;'. html_print_radio_button('show_id_agente', 0, '', $config['show_id_agente'], true);
$table->data[1][0] = '<b>' . __('Fields available').'</b>';
$table->data[1][1] = html_print_select ($fields_available, 'fields_available[]', true, '', __('None'), '', 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] .= '<br><br><br><br>' . 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] = '<b>' . __('Fields selected') . '</b>';
$table->data[1][4] = html_print_select($result_selected, 'fields_selected[]', true, '', __('None'), '', true, true, false);
$table->data[4][0] = '<b>'.__('User ID').'</b>';
$table->data[4][1] = __('Yes').'&nbsp;'.html_print_radio_button('show_id_usuario', 1, '', $config['show_id_usuario'], true);
$table->data[4][1] .= __('No').'&nbsp;'.html_print_radio_button('show_id_usuario', 0, '', $config['show_id_usuario'], true);
$table->data[5][0] = '<b>'.__('Group ID').'</b>';
$table->data[5][1] = __('Yes').'&nbsp;'.html_print_radio_button('show_id_grupo', 1, '', $config['show_id_grupo'], true);
$table->data[5][1] .= __('No').'&nbsp;'.html_print_radio_button('show_id_grupo', 0, '', $config['show_id_grupo'], true);
$table->data[6][0] ='<b>'. __('Status').'</b>';
$table->data[6][1] = __('Yes').'&nbsp;'.html_print_radio_button('show_estado', 1, '', $config['show_estado'], true);
$table->data[6][1] .= __('No').'&nbsp;'.html_print_radio_button('show_estado', 0, '', $config['show_estado'], true);
$table->data[7][0] = '<b>'.__('Timestamp').'</b>';
$table->data[7][1] = __('Yes').'&nbsp;'.html_print_radio_button('show_timestamp', 1, '', $config['show_timestamp'], true);
$table->data[7][1] .= __('No').'&nbsp;'.html_print_radio_button('show_timestamp', 0, '', $config['show_timestamp'], true);
$table->data[8][0] = '<b>'.__('Event type');
$table->data[8][1] = __('Yes').'&nbsp;'.html_print_radio_button('show_event_type', 1, '', $config['show_event_type'], true);
$table->data[8][1] .= __('No').'&nbsp;'.html_print_radio_button('show_event_type', 0, '', $config['show_event_type'], true);
$table->data[9][0] = '<b>'.__('Agent Module').'</b>';
$table->data[9][1] = __('Yes').'&nbsp;'.html_print_radio_button('show_id_agentmodule', 1, '', $config['show_id_agentmodule'], true);
$table->data[9][1] .= __('No').'&nbsp;'.html_print_radio_button('show_id_agentmodule', 0, '', $config['show_id_agentmodule'], true);
$table->data[10][0] = '<b>'.__('Alert ID').'</b>';
$table->data[10][1] = __('Yes').'&nbsp;'.html_print_radio_button('show_id_alert_am', 1, '', $config['show_id_alert_am'], true);
$table->data[10][1] .= __('No').'&nbsp;'.html_print_radio_button('show_id_alert_am', 0, '', $config['show_id_alert_am'], true);
$table->data[11][0] = '<b>'.__('Criticity').'</b>';
$table->data[11][1] = __('Yes').'&nbsp;'.html_print_radio_button('show_criticity', 1, '', $config['show_criticity'], true);
$table->data[11][1] .= __('No').'&nbsp;'.html_print_radio_button('show_criticity', 0, '', $config['show_criticity'], true);
$table->data[12][0] = '<b>'.__('Comment').'</b>';
$table->data[12][1] = __('Yes').'&nbsp;'.html_print_radio_button('show_user_comment', 1, '', $config['show_user_comment'], true);
$table->data[12][1] .= __('No').'&nbsp;'.html_print_radio_button('show_user_comment', 0, '', $config['show_user_comment'], true);
$table->data[13][0] = '<b>'.__('Tags').'</b>';
$table->data[13][1] = __('Yes').'&nbsp;'.html_print_radio_button('show_tags', 1, '', $config['show_tags'], true);
$table->data[13][1] .= __('No').'&nbsp;'.html_print_radio_button('show_tags', 0, '', $config['show_tags'], true);
$table->data[14][0] = '<b>'.__('Source').'</b>';
$table->data[14][1] = __('Yes').'&nbsp;'.html_print_radio_button('show_source', 1, '', $config['show_source'], true);
$table->data[14][1] .= __('No').'&nbsp;'.html_print_radio_button('show_source', 0, '', $config['show_source'], true);
$table->data[15][0] = '<b>'.__('Extra ID').'</b>';
$table->data[15][1] = __('Yes').'&nbsp;'.html_print_radio_button('show_id_extra', 1, '', $config['show_id_extra'], true);
$table->data[15][1] .= __('No').'&nbsp;'.html_print_radio_button('show_id_extra', 0, '', $config['show_id_extra'], true);
echo '<form id="custom_events" method="post">';
echo '<form id="custom_events" method="post" action="index.php?sec=gsetup&sec2=godmode/events/custom_events">';
html_print_table($table);
@ -110,12 +114,35 @@ echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '</form>';
echo '</div>';
?>
<script>
/*
$('#radiobtn0002').css('display', 'none');
*/
<script type="text/javascript">
/* <![CDATA[ */
$(document).ready (function () {
$("#right").click (function () {
jQuery.each($("select[name='fields_available[]'] option:selected"), function (key, value) {
field_name = $(value).html();
if (field_name != <?php echo "'".__('None')."'"; ?>){
id_field = $(value).attr('value');
//$("select[name='fields_available[]']").append($("<option selected='selected'></option>").val(field_name));
$("select[name='fields_selected[]']").append($("<option selected='selected'></option>").html(field_name).attr("value", field_name));
//$("select[name='fields_selected[]']").append($("<option></option>").val(field_name).html('<i>' + field_name + '</i>'));
$("#fields_available").find("option[value='" + id_field + "']").remove();
}
});
});
$("#left").click (function () {
jQuery.each($("select[name='fields_selected[]'] option:selected"), function (key, value) {
field_name = $(value).html();
if (field_name != <?php echo "'".__('None')."'"; ?>){
id_field = $(value).attr('value');
//alert(id_field);
$("select[name='fields_available[]']").append($("<option></option>").val(field_name).html('<i>' + field_name + '</i>'));
$("#fields_selected").find("option[value='" + id_field + "']").remove();
}
});
});
});
</script>

View File

@ -249,22 +249,7 @@ function config_update_config () {
config_update_value ('font_size', get_parameter('font_size', $config['font_size']));
config_update_value ('refr', get_parameter('refr', $config['refr']));
config_update_value ('vc_refr', get_parameter('vc_refr', $config['vc_refr']));
config_update_value ('show_id_evento', get_parameter('show_id_evento', $config['show_id_evento']));
config_update_value ('show_evento', get_parameter('show_evento', $config['show_evento']));
config_update_value ('show_id_agente', get_parameter('show_id_agente', $config['show_id_agente']));
config_update_value ('show_id_usuario', get_parameter('show_id_usuario', $config['show_id_usuario']));
config_update_value ('show_id_grupo', get_parameter('show_id_grupo', $config['show_id_grupo']));
config_update_value ('show_estado', get_parameter('show_estado', $config['show_estado']));
config_update_value ('show_timestamp', get_parameter('show_timestamp', $config['show_timestamp']));
config_update_value ('show_event_type', get_parameter('show_event_type', $config['show_event_type']));
config_update_value ('show_id_agentmodule', get_parameter('show_id_agentmodule', $config['show_id_agentmodule']));
config_update_value ('show_id_alert_am', get_parameter('show_id_alert_am', $config['show_id_alert_am']));
config_update_value ('show_criticity', get_parameter('show_criticity', $config['show_criticity']));
config_update_value ('show_user_comment', get_parameter('show_user_comment', $config['show_user_comment']));
config_update_value ('show_tags', get_parameter('show_tags', $config['show_tags']));
config_update_value ('show_source', get_parameter('show_source', $config['show_source']));
config_update_value ('show_id_extra', get_parameter('show_id_extra', $config['show_id_extra']));
enterprise_include_once('include/functions_policies.php');
$enterprise = enterprise_include_once ('include/functions_skins.php');

View File

@ -372,7 +372,7 @@ else {
WHERE 1=1 $sql_post GROUP BY evento, id_agentmodule) AS t";
}
//Count the events with this filter (TODO but not utimestamp).
$total_events = (int) db_get_sql ($sql);
if (empty ($result)) {
$result = array ();
@ -387,96 +387,81 @@ $table->head = array ();
$table->data = array ();
//fields that the user has selected to show
$show_fields = explode (',', $config['event_fields']);
//headers
$i = 0;
$show_fields = array();
if ($config['show_estado']) {
$show_fields[$i] = 'estado';
if (in_array('estado', $show_fields)) {
$table->head[$i] = __('Status');
$table->align[$i] = 'center';
$i++;
}
if ($config['show_id_evento']) {
$show_fields[$i] = 'id_evento';
if (in_array('id_evento', $show_fields)) {
$table->head[$i] = __('Event ID');
$table->align[$i] = 'center';
$i++;
}
if ($config['show_evento']) {
$show_fields[$i] = 'evento';
if (in_array('evento', $show_fields)) {
$table->head[$i] = __('Event Name');
$table->align[$i] = 'center';
$i++;
}
if ($config['show_id_agente']) {
$show_fields[$i] = 'id_agente';
if (in_array('id_agente', $show_fields)) {
$table->head[$i] = __('Agent name');
$table->align[$i] = 'center';
$i++;
}
if ($config['show_timestamp']) {
$show_fields[$i] = 'timestamp';
if (in_array('timestamp', $show_fields)) {
$table->head[$i] = __('Timestamp');
$table->align[$i] = 'center';
$i++;
}
if ($config['show_id_usuario']) {
$show_fields[$i] = 'id_usuario';
if (in_array('id_usuario', $show_fields)) {
$table->head[$i] = __('User');
$table->align[$i] = 'center';
$i++;
}
if ($config['show_id_grupo']) {
$show_fields[$i] = 'id_grupo';
if (in_array('id_grupo', $show_fields)) {
$table->head[$i] = __('Group');
$table->align[$i] = 'center';
$i++;
}
if ($config['show_event_type']) {
$show_fields[$i] = 'event_type';
if (in_array('event_type', $show_fields)) {
$table->head[$i] = __('Event type');
$table->align[$i] = 'center';
$i++;
}
if ($config['show_id_agentmodule']) {
$show_fields[$i] = 'id_agentmodule';
if (in_array('id_agentmodule', $show_fields)) {
$table->head[$i] = __('Agent Module');
$table->align[$i] = 'center';
$i++;
}
if ($config['show_id_alert_am']) {
$show_fields[$i] = 'id_alert_am';
if (in_array('id_alert_am', $show_fields)) {
$table->head[$i] = __('Alert');
$table->align[$i] = 'center';
$i++;
}
if ($config['show_criticity']) {
$show_fields[$i] = 'criticity';
if (in_array('criticity', $show_fields)) {
$table->head[$i] = __('Criticity');
$table->align[$i] = 'center';
$i++;
}
if ($config['show_user_comment']) {
$show_fields[$i] = 'user_comment';
if (in_array('user_comment', $show_fields)) {
$table->head[$i] = __('Comment');
$table->align[$i] = 'center';
$i++;
}
if ($config['show_tags']) {
$show_fields[$i] = 'tags';
if (in_array('tags', $show_fields)) {
$table->head[$i] = __('Tags');
$table->align[$i] = 'center';
$i++;
}
if ($config['show_source']) {
$show_fields[$i] = 'source';
if (in_array('source', $show_fields)) {
$table->head[$i] = __('Source');
$table->align[$i] = 'center';
$i++;
}
if ($config['show_id_extra']) {
$show_fields[$i] = 'id_extra';
if (in_array('id_extra', $show_fields)) {
$table->head[$i] = __('Extra ID');
$table->align[$i] = 'center';
$i++;
@ -531,13 +516,13 @@ foreach ($result as $event) {
$i = 0;
if (in_array('estado',$show_fields)) {
$data[$i] = html_print_image ($img_st, true,
array ("class" => "image_status",
"width" => 16,
"height" => 16,
"title" => $title_st,
"id" => 'status_img_'.$event["id_evento"]));
$i++;
$data[$i] = html_print_image ($img_st, true,
array ("class" => "image_status",
"width" => 16,
"height" => 16,
"title" => $title_st,
"id" => 'status_img_'.$event["id_evento"]));
$i++;
}
if (in_array('id_evento',$show_fields)) {
$data[$i] = $event["id_evento"];
@ -659,7 +644,6 @@ foreach ($result as $event) {
$i++;
}
if ($i != 0) {
//Actions
$data[$i] = '';

View File

@ -88,21 +88,7 @@ INSERT INTO tconfig (token, value) VALUES ('integria_url', ' ');
INSERT INTO tconfig (token, value) VALUES ('netflow_path', '/var/spool/pandora/data_in/netflow');
INSERT INTO tconfig (token, value) VALUES ('netflow_interval', '300');
INSERT INTO tconfig (token, value) VALUES ('netflow_daemon', '/usr/bin/nfcapd');
INSERT INTO tconfig (token, value) VALUES ('show_id_evento', '0');
INSERT INTO tconfig (token, value) VALUES ('show_evento', '1');
INSERT INTO tconfig (token, value) VALUES ('show_id_agente', '1');
INSERT INTO tconfig (token, value) VALUES ('show_id_usuario', '0');
INSERT INTO tconfig (token, value) VALUES ('show_id_grupo', '0');
INSERT INTO tconfig (token, value) VALUES ('show_estado', '1');
INSERT INTO tconfig (token, value) VALUES ('show_timestamp', '1');
INSERT INTO tconfig (token, value) VALUES ('show_event_type', '0');
INSERT INTO tconfig (token, value) VALUES ('show_id_agentmodule', '0');
INSERT INTO tconfig (token, value) VALUES ('show_id_alert_am', '0');
INSERT INTO tconfig (token, value) VALUES ('show_criticity', '0');
INSERT INTO tconfig (token, value) VALUES ('show_user_comment', '0');
INSERT INTO tconfig (token, value) VALUES ('show_tags', '0');
INSERT INTO tconfig (token, value) VALUES ('show_source', '0');
INSERT INTO tconfig (token, value) VALUES ('show_id_extra', '0');
INSERT INTO tconfig (token, value) VALUES ('event_fields', 'evento,id_agente,estado,timestamp');
COMMIT;
END;;

View File

@ -84,22 +84,8 @@ INSERT INTO "tconfig" ("token", "value") VALUES
('integria_url', ''),
('netflow_path', '/var/spool/pandora/data_in/netflow'),
('netflow_interval', '300'),
('netflow_daemon', '/usr/bin/nfcapd');
('show_id_evento', '0'),
('show_evento', '1'),
('show_id_agente', '1'),
('show_id_usuario', '0'),
('show_id_grupo', '0'),
('show_estado', '1'),
('show_timestamp', '1'),
('show_event_type', '0'),
('show_id_agentmodule', '0'),
('show_id_alert_am', '0'),
('show_criticity', '0'),
('show_user_comment', '0'),
('show_tags', '0'),
('show_source', '0'),
('show_id_extra', '0');
('netflow_daemon', '/usr/bin/nfcapd'),
('event_fields', 'evento,id_agente,estado,timestamp');
COMMIT WORK;

View File

@ -84,21 +84,8 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('netflow_path', '/var/spool/pandora/data_in/netflow'),
('netflow_interval', '300'),
('netflow_daemon', '/usr/bin/nfcapd'),
('show_id_evento', '0'),
('show_evento', '1'),
('show_id_agente', '1'),
('show_id_usuario', '0'),
('show_id_grupo', '0'),
('show_estado', '1'),
('show_timestamp', '1'),
('show_event_type', '0'),
('show_id_agentmodule', '0'),
('show_id_alert_am', '0'),
('show_criticity', '0'),
('show_user_comment', '0'),
('show_tags', '0'),
('show_source', '0'),
('show_id_extra', '0');
('event_fields', 'evento,id_agente,estado,timestamp');
UNLOCK TABLES;