2013-06-07 Sergio Martin <sergio.martin@artica.es>

* include/ajax/module.php
	include/javascript/jquery.ui.datepicker.js
	operation/tree.php
	operation/agentes/datos_agente.php: Added range filter 
	to raw data view in tree view

	* operation/netflow/nf_live_view.php: Fix help popup
	in metaconsole view



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8269 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2013-06-07 09:13:08 +00:00
parent acf0af6063
commit 38ca2a5e02
6 changed files with 94 additions and 14 deletions

View File

@ -1,3 +1,14 @@
2013-06-07 Sergio Martin <sergio.martin@artica.es>
* include/ajax/module.php
include/javascript/jquery.ui.datepicker.js
operation/tree.php
operation/agentes/datos_agente.php: Added range filter
to raw data view in tree view
* operation/netflow/nf_live_view.php: Fix help popup
in metaconsole view
2013-06-06 Sergio Martin <sergio.martin@artica.es>
* include/functions_config.php: Replaced netflow and

View File

@ -67,7 +67,13 @@ if ($get_module_detail) {
$conexion = mysql_connect ($server['dbhost'], $server['dbuser'], $server['dbpass']);
$select_db = mysql_select_db ($server['dbname'], $conexion);
}
$selection_mode = get_parameter('selection_mode', 'fromnow');
$date_from = (string) get_parameter ('date_from', date ('Y-m-j'));
$time_from = (string) get_parameter ('time_from', date ('h:iA'));
$date_to = (string) get_parameter ('date_to', date ('Y-m-j'));
$time_to = (string) get_parameter ('time_to', date ('h:iA'));
$formtable->width = '98%';
$formtable->class = "databox";
$formtable->data = array ();
@ -88,10 +94,26 @@ if ($get_module_detail) {
SECONDS_2YEARS =>__('2 years'),
SECONDS_3YEARS =>__('3 years'));
$formtable->data[0][0] = __('Select period:');
$formtable->data[0][0] = html_print_radio_button_extended ("selection_mode", 'fromnow', '', $selection_mode, false, '', 'style="margin-right: 15px;"', true) . __("Choose a time from now");
$formtable->data[0][1] = html_print_select ($periods, 'period', $period, '', '', 0, true, false, false);
$formtable->data[0][2] = "<a href='javascript: show_module_detail_dialog(" . $module_id .", ". $agentId.", \"" . $server_name . "\", 0, -1)'>". html_print_image ("images/refresh.png", true, array ("style" => 'vertical-align: middle;', "border" => "0" )) . "</a>";
$formtable->data[0][2] = '';
$formtable->data[0][3] = "<a href='javascript: show_module_detail_dialog(" . $module_id .", ". $agentId.", \"" . $server_name . "\", 0, -1)'>". html_print_image ("images/refresh.png", true, array ("style" => 'vertical-align: middle;', "border" => "0" )) . "</a>";
$formtable->rowspan[0][3] = 2;
$formtable->cellstyle[0][3] = 'vertical-align: middle;';
$formtable->data[1][0] = html_print_radio_button_extended ("selection_mode", 'range','', $selection_mode, false, '', 'style="margin-right: 15px;"', true) . __("Specify time range");
$formtable->data[1][1] = __('Timestamp from:');
$formtable->data[1][2] = html_print_input_text ('date_from', $date_from, '', 10, 10, true);
$formtable->data[1][2] .= html_print_input_text ('time_from', $time_from, '', 9, 7, true);
$formtable->data[1][1] .= '<br />';
$formtable->data[1][1] .= __('Timestamp to:');
$formtable->data[1][2] .= '<br />';
$formtable->data[1][2] .= html_print_input_text ('date_to', $date_to, '', 10, 10, true);
$formtable->data[1][2] .= html_print_input_text ('time_to', $time_to, '', 9, 7, true);
html_print_table($formtable);
$moduletype_name = modules_get_moduletype_name (modules_get_agentmodule_type ($module_id));
@ -101,11 +123,19 @@ if ($get_module_detail) {
$columns = array ();
$datetime_from = strtotime ($date_from.' '.$time_from);
$datetime_to = strtotime ($date_to.' '.$time_to);
if ($moduletype_name == "log4x") {
$table->width = "100%";
$sql_body = sprintf ("FROM tagente_datos_log4x WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY utimestamp DESC", $module_id, get_system_time () - $period);
if ($selection_mode == "fromnow") {
$sql_body = sprintf ("FROM tagente_datos_log4x WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY utimestamp DESC", $module_id, get_system_time () - $period);
}
else {
$sql_body = sprintf ("FROM tagente_datos_log4x WHERE id_agente_modulo = %d AND utimestamp >= %d AND utimestamp <= %d ORDER BY utimestamp DESC", $module_id, $datetime_from, $datetime_to);
}
$columns = array(
"Timestamp" => array("utimestamp", "modules_format_timestamp", "align" => "center" ),
"Sev" => array("severity", "modules_format_data", "align" => "center", "width" => "70px"),
@ -115,7 +145,13 @@ if ($get_module_detail) {
}
else if (preg_match ("/string/", $moduletype_name)) {
$sql_body = sprintf (" FROM tagente_datos_string WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY utimestamp DESC", $module_id, get_system_time () - $period);
if ($selection_mode == "fromnow") {
$sql_body = sprintf (" FROM tagente_datos_string WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY utimestamp DESC", $module_id, get_system_time () - $period);
}
else {
$sql_body = sprintf (" FROM tagente_datos_string WHERE id_agente_modulo = %d AND utimestamp >= %d AND utimestamp <= %d ORDER BY utimestamp DESC", $module_id, $datetime_from, $datetime_to);
}
$columns = array(
"Timestamp" => array("utimestamp", "modules_format_timestamp", "align" => "left"),
"Data" => array("datos", "modules_format_data", "align" => "left"),
@ -123,8 +159,12 @@ if ($get_module_detail) {
);
}
else {
$sql_body = sprintf (" FROM tagente_datos WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY utimestamp DESC", $module_id, get_system_time () - $period);
if ($selection_mode == "fromnow") {
$sql_body = sprintf (" FROM tagente_datos WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY utimestamp DESC", $module_id, get_system_time () - $period);
}
else {
$sql_body = sprintf (" FROM tagente_datos WHERE id_agente_modulo = %d AND utimestamp >= %d AND utimestamp <= %d ORDER BY utimestamp DESC", $module_id, $datetime_from, $datetime_to);
}
$columns = array(
"Timestamp" => array("utimestamp", "modules_format_timestamp", "align" => "left"),

File diff suppressed because one or more lines are too long

View File

@ -191,14 +191,14 @@ $formtable->data[1][0] = html_print_radio_button_extended ("selection_mode", 'ra
$formtable->data[1][1] = __('Timestamp from:');
$formtable->data[1][2] = html_print_input_text ('date_from', $date_from, '', 10, 10, true);
$formtable->data[1][2] .= html_print_input_text ('time_from', $time_from, '', 7, 7, true);
$formtable->data[1][2] .= html_print_input_text ('time_from', $time_from, '', 9, 7, true);
$formtable->data[1][1] .= '<br />';
$formtable->data[1][1] .= __('Timestamp to:');
$formtable->data[1][2] .= '<br />';
$formtable->data[1][2] .= html_print_input_text ('date_to', $date_to, '', 10, 10, true);
$formtable->data[1][2] .= html_print_input_text ('time_to', $time_to, '', 7, 7, true);
$formtable->data[1][2] .= html_print_input_text ('time_to', $time_to, '', 9, 7, true);
if (preg_match ("/string/", $moduletype_name) || $moduletype_name == "log4x") {
$formtable->data[2][0] = __('Free text for search');

View File

@ -337,7 +337,7 @@ echo '<form method="post" action="' . $config['homeurl'] . 'index.php?sec=netf&s
echo "</tr>";
echo "<tr>";
echo "<td>" . '<b>'.__('Aggregate by').'</b>'. ui_print_help_icon ('aggregate_by', true, ui_get_full_url(false, false, false, false)) . "</td>";
echo "<td>" . '<b>'.__('Aggregate by').'</b>'. ui_print_help_icon ('aggregate_by', true) . "</td>";
$aggregate_list = array();
$aggregate_list = array ('none' => __('None'), 'proto' => __('Protocol'), 'srcip' =>__('Src Ip Address'), 'dstip' =>__('Dst Ip Address'), 'srcport' =>__('Src Port'), 'dstport' =>__('Dst Port') );
echo "<td colspan='2'>" . html_print_select ($aggregate_list, "aggregate", $filter['aggregate'], '', '', 0, true, false, true, '', false) . "</td>";

View File

@ -625,6 +625,8 @@ treeview_printTree($activeTab);
enterprise_hook('close_meta_frame');
ui_require_jquery_file ("ui-timepicker-addon");
?>
<script language="javascript" type="text/javascript">
@ -813,13 +815,22 @@ enterprise_hook('close_meta_frame');
// Show the modal window of an module
function show_module_detail_dialog(module_id, id_agent, server_name, offset, period) {
var extra_parameters = '';
if (period == -1) {
period = $('#period').val();
var selection_mode = $('input[name=selection_mode]:checked').val();
var date_from = $('#text-date_from').val();
var time_from = $('#text-time_from').val();
var date_to = $('#text-date_to').val();
var time_to = $('#text-time_to').val();
extra_parameters = '&selection_mode=' + selection_mode + '&date_from=' + date_from + '&date_to=' + date_to + '&time_from=' + time_from + '&time_to=' + time_to;
}
$.ajax({
type: "POST",
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
data: "page=include/ajax/module&get_module_detail=1&server_name="+server_name+"&id_agent="+id_agent+"&id_module=" + module_id+"&offset="+offset+"&period="+period,
data: "page=include/ajax/module&get_module_detail=1&server_name="+server_name+"&id_agent="+id_agent+"&id_module=" + module_id+"&offset="+offset+"&period="+period + extra_parameters,
dataType: "html",
success: function(data) {
$("#module_details_window").hide ()
@ -833,16 +844,35 @@ enterprise_hook('close_meta_frame');
opacity: 0.5,
background: "black"
},
width: 620,
width: 650,
height: 500
})
.show ();
refresh_pagination_callback (module_id, id_agent, server_name);
datetime_picker_callback();
forced_title_callback();
}
});
}
function datetime_picker_callback() {
$("#text-time_from, #text-time_to").timepicker({
showSecond: true,
timeFormat: 'hh:mm:ss',
timeOnlyTitle: '<?php echo __('Choose time');?>',
timeText: '<?php echo __('Time');?>',
hourText: '<?php echo __('Hour');?>',
minuteText: '<?php echo __('Minute');?>',
secondText: '<?php echo __('Second');?>',
currentText: '<?php echo __('Now');?>',
closeText: '<?php echo __('Close');?>'});
$("#text-date_from, #text-date_to").datepicker ();
$.datepicker.regional["<?php echo $config['language']; ?>"];
}
datetime_picker_callback();
function refresh_pagination_callback (module_id, id_agent, server_name) {
$(".pagination").click( function() {
var classes = $(this).attr('class');