New item to reports (Log)... (Init the feature)

This commit is contained in:
Arturo Gonzalez 2016-11-07 16:54:18 +01:00
parent 367c88fc9e
commit 530a1e7a93
4 changed files with 60 additions and 1 deletions

View File

@ -140,6 +140,7 @@ switch ($action) {
case 'general':
case 'network_interfaces_report':
case 'availability':
case 'event_report_log':
$get_data_editor = true;
break;
@ -189,7 +190,9 @@ switch ($action) {
$idAgentModule = $item['id_agent_module'];
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
break;
case 'event_report_log':
$period = $item['period'];
$description = $item['description'];
case 'simple_graph':
$only_avg = isset($style['only_avg']) ? (bool) $style['only_avg'] : true;
$percentil_95 = isset($style['percentil_95']) ? $style['percentil_95'] : 0;
@ -577,6 +580,7 @@ switch ($action) {
case 'MTBF':
case 'MTTR':
case 'simple_baseline_graph':
case 'event_report_log':
$label = (isset($style['label'])) ? $style['label'] : '';
break;
default:
@ -2359,6 +2363,11 @@ function chooseType() {
$("#row_filter_search").show();
break;
case 'event_report_log':
$("#row_description").show();
$("#row_period").show();
break;
case 'simple_graph':
$("#row_time_compare_overlapped").show();

View File

@ -147,6 +147,12 @@ function reporting_make_reporting_data($report = null, $id_report,
$force_width_chart,
$force_height_chart);
break;
case 'event_report_log':
$report['contents'][] =
reporting_log(
$report,
$content);
break;
case 'general':
$report['contents'][] =
reporting_general(
@ -463,6 +469,40 @@ function reporting_make_reporting_data($report = null, $id_report,
return reporting_check_structure_report($report);
}
function reporting_log ($report, $content) {
$return['type'] = 'event_report_log';
$period = $content['period'];
$date_limit = time() - $period;
if (empty($content['name'])) {
$content['name'] = __('Log report');
}
$return['title'] = $content['name'];
$return["description"] = $content["description"];
$return["date"] = reporting_get_date_text($report, $content);
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
$return['keys'] = array(__('Date'), __('Log'));
// LEER FICHERO DE LOG Y SACAR DATOS
$log_data = array();
$log_data = read_log_file_to_report($date_limit);
$data = array();
foreach ($result as $row) {
$data[] = array(
__('Date') => date ($config["date_format"], $row['utimestamp']),
__('Data') => $row['datos']);
}
$return["data"] = $data;
}
function read_log_file_to_report($date_limit) {
}
function reporting_SLA($report, $content, $type = 'dinamic',
$force_width_chart = null, $force_height_chart = null) {

View File

@ -139,6 +139,9 @@ function reporting_html_print_report($report, $mini = false) {
case 'availability':
reporting_html_availability($table, $item);
break;
case 'event_report_log':
reporting_html_log($table, $item);
break;
case 'general':
reporting_html_general($table, $item);
break;
@ -290,6 +293,10 @@ function reporting_html_print_report($report, $mini = false) {
}
}
function reporting_html_log ($table, $item) {
html_debug('AAAA');
}
function reporting_html_SLA($table, $item, $mini) {
$style = db_get_value('style', 'treport_content', 'id_rc', $item['id_rc']);
$style = json_decode(io_safe_output($style), true);

View File

@ -643,6 +643,9 @@ function reports_get_report_types ($template = false, $not_editor = false) {
$types['netflow_summary'] = array('optgroup' => __('Netflow'),
'name' => __('Netflow summary table'));
}
$types['event_report_log'] = array('optgroup' => __('Log'),
'name' => __('Log report'));
return $types;
}