diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
index 4e31057a89..a2a6db38d2 100644
--- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
+++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
@@ -725,6 +725,9 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
`module_free_text` TEXT,
`each_agent` tinyint(1) default 1,
`historical_db` tinyint(1) UNSIGNED NOT NULL default 0,
+ `lapse_calc` tinyint(1) UNSIGNED NOT NULL default '0',
+ `lapse` int(11) UNSIGNED NOT NULL default '300',
+ `visual_format` UNSIGNED NOT NULL tinyint(1) default '0',
PRIMARY KEY(`id_rc`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
@@ -1269,6 +1272,9 @@ UPDATE treport_custom_sql SET `sql` = 'select t1.alias as agent_n
-- ---------------------------------------------------------------------
ALTER TABLE treport_content ADD COLUMN `historical_db` tinyint(1) NOT NULL DEFAULT '0';
+ALTER TABLE treport_content ADD COLUMN `lapse_calc` tinyint(1) default '0';
+ALTER TABLE treport_content ADD COLUMN `lapse` int(11) default '300';
+ALTER TABLE treport_content ADD COLUMN `visual_format` tinyint(1) default '0';
-- ---------------------------------------------------------------------
-- Table `tmodule_relationship`
diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
index 534bf07a0b..7fe43f42e4 100755
--- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php
+++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
@@ -112,6 +112,10 @@ $netflow_filter = 0;
$max_values = 0;
$resolution = 0;
+$lapse_calc = 0;
+$lapse = 300;
+$visual_format = 0;
+
//Others
$filter_search = "";
@@ -195,12 +199,6 @@ switch ($action) {
$name = $item['name'];
switch ($type) {
- case 'avg_value':
- $period = $item['period'];
- $description = $item['description'];
- $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'];
@@ -312,6 +310,9 @@ switch ($action) {
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgentModule = $item['id_agent_module'];
$period = $item['period'];
+ $lapse = $item['lapse'];
+ $lapse_calc = $item['lapse_calc'];
+ $visual_format = $item['visual_format'];
break;
case 'max_value':
$description = $item['description'];
@@ -319,6 +320,9 @@ switch ($action) {
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgentModule = $item['id_agent_module'];
$period = $item['period'];
+ $lapse = $item['lapse'];
+ $lapse_calc = $item['lapse_calc'];
+ $visual_format = $item['visual_format'];
break;
case 'min_value':
$description = $item['description'];
@@ -326,6 +330,9 @@ switch ($action) {
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgentModule = $item['id_agent_module'];
$period = $item['period'];
+ $lapse = $item['lapse'];
+ $lapse_calc = $item['lapse_calc'];
+ $visual_format = $item['visual_format'];
break;
case 'sumatory':
$description = $item['description'];
@@ -1578,6 +1585,78 @@ You can of course remove the warnings, that's why we include the source and do n
?>
+
+
+
+
+
+
+
+
+ |
+
+
+ |
+
+
+
+
+
+ |
+
+
+ |
+
+
+
+
+ ';
+ html_print_radio_button ('visual_format', 1, '', $visual_format_table,'',!$lapse_calc);
+ echo ('');
+ echo __('Graph only').'';
+ html_print_radio_button ('visual_format', 2, '', $visual_format_graph,'',!$lapse_calc);
+ echo ('');
+ echo __('Graph and table').'';
+ html_print_radio_button ('visual_format', 3, '', $visual_format_both,'',!$lapse_calc);
+
+ ?>
+ |
+
+
+
+
@@ -2178,6 +2257,19 @@ $(document).ready (function () {
}
});
+ $("#checkbox-lapse_calc").change(function () {
+
+ if($(this).is(":checked")){
+ $( "#lapse_select" ).prop( "disabled", false );
+ $("[name=visual_format]").prop( "disabled", false );
+ }
+ else{
+ $( "#lapse_select" ).prop( "disabled", true );
+ $("[name=visual_format]").prop( "disabled", true );
+ }
+
+ });
+
});
function create_custom_graph() {
@@ -2659,6 +2751,9 @@ function chooseType() {
$("#row_show_in_two_columns").hide();
$("#row_show_in_same_row").hide();
$("#row_historical_db_check").hide();
+ $("#row_lapse_calc").hide();
+ $("#row_lapse").hide();
+ $("#row_visual_format").hide();
$("#row_show_in_landscape").hide();
$('#row_hide_notinit_agents').hide();
$("#row_module_group").hide();
@@ -2851,6 +2946,9 @@ function chooseType() {
$("#row_module").show();
$("#row_period").show();
$("#row_show_in_two_columns").show();
+ $("#row_lapse_calc").show();
+ $("#row_lapse").show();
+ $("#row_visual_format").show();
$("#row_historical_db_check").hide();
break;
@@ -2860,6 +2958,9 @@ function chooseType() {
$("#row_module").show();
$("#row_period").show();
$("#row_show_in_two_columns").show();
+ $("#row_lapse_calc").show();
+ $("#row_lapse").show();
+ $("#row_visual_format").show();
$("#row_historical_db_check").hide();
break;
@@ -2869,6 +2970,9 @@ function chooseType() {
$("#row_module").show();
$("#row_period").show();
$("#row_show_in_two_columns").show();
+ $("#row_lapse_calc").show();
+ $("#row_lapse").show();
+ $("#row_visual_format").show();
$("#row_historical_db_check").hide();
break;
diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php
index 4dd13e9af0..9103405f9e 100755
--- a/pandora_console/godmode/reporting/reporting_builder.php
+++ b/pandora_console/godmode/reporting/reporting_builder.php
@@ -1019,6 +1019,15 @@ switch ($action) {
$values['period'] = get_parameter('period');
$good_format = true;
break;
+ case 'min_value':
+ case 'max_value':
+ case 'avg_value':
+ $values['period'] = get_parameter('period');
+ $values['lapse_calc'] = get_parameter('lapse_calc');
+ $values['lapse'] = get_parameter('lapse');
+ $values['visual_format'] = get_parameter('visual_format');
+ $good_format = true;
+ break;
default:
$values['period'] = get_parameter('period');
$values['top_n'] = get_parameter('radiobutton_max_min_avg',0);
@@ -1354,6 +1363,15 @@ switch ($action) {
$values['period'] = get_parameter('period');
$good_format = true;
break;
+ case 'min_value':
+ case 'max_value':
+ case 'avg_value':
+ $values['period'] = get_parameter('period');
+ $values['lapse_calc'] = get_parameter('lapse_calc');
+ $values['lapse'] = get_parameter('lapse');
+ $values['visual_format'] = get_parameter('visual_format');
+ $good_format = true;
+ break;
default:
$values['period'] = get_parameter('period');
$values['top_n'] = get_parameter('radiobutton_max_min_avg',0);
diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php
index 7e3fe9fbdb..d904d2e8df 100644
--- a/pandora_console/include/functions_graph.php
+++ b/pandora_console/include/functions_graph.php
@@ -232,8 +232,8 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i
$projection, $avg_only = false, $uncompressed_module = false,
$show_events = false, $show_alerts = false, $show_unknown = false, $baseline = false,
$baseline_data = array(), $events = array(), $series_suffix = '', $start_unknown = false,
- $percentil = null, $fullscale = false) {
-
+ $percentil = null, $fullscale = false, $force_interval = false,$time_interval = 300,
+ $max_only = 0, $min_only = 0) {
global $config;
global $chart_extra_data;
global $series_type;
@@ -413,10 +413,17 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i
}
if ($count > 0) {
+
if ($avg_only) {
$chart[$timestamp]['sum'.$series_suffix] = $total;
}
- else {
+ else if($max_only){
+ $chart[$timestamp]['max'.$series_suffix] = $interval_max;
+ }
+ else if($min_only){
+ $chart[$timestamp]['min'.$series_suffix] = $interval_min;
+ }
+ else{
$chart[$timestamp]['max'.$series_suffix] = $interval_max;
$chart[$timestamp]['sum'.$series_suffix] = $total;
$chart[$timestamp]['min'.$series_suffix] = $interval_min;
@@ -428,7 +435,13 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i
if ($avg_only) {
$chart[$timestamp]['sum'.$series_suffix] = 0;
}
- else {
+ else if($max_only){
+ $chart[$timestamp]['max'.$series_suffix] = 0;
+ }
+ else if($min_only){
+ $chart[$timestamp]['min'.$series_suffix] = 0;
+ }
+ else{
$chart[$timestamp]['max'.$series_suffix] = 0;
$chart[$timestamp]['sum'.$series_suffix] = 0;
$chart[$timestamp]['min'.$series_suffix] = 0;
@@ -438,6 +451,12 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i
if ($avg_only) {
$chart[$timestamp]['sum'.$series_suffix] = $last_known;
}
+ else if ($max_only) {
+ $chart[$timestamp]['max'.$series_suffix] = $last_known;
+ }
+ else if ($min_only) {
+ $chart[$timestamp]['min'.$series_suffix] = $last_known;
+ }
else {
$chart[$timestamp]['max'.$series_suffix] = $last_known;
$chart[$timestamp]['sum'.$series_suffix] = $last_known;
@@ -502,8 +521,9 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
$baseline = 0, $return_data = 0, $show_title = true, $projection = false,
$adapt_key = '', $compare = false, $series_suffix = '', $series_suffix_str = '',
$show_unknown = false, $percentil = null, $dashboard = false, $vconsole = false,
- $type_graph='area', $fullscale = false, $flash_chart = false) {
-
+ $type_graph='area', $fullscale = false, $flash_chart = false, $force_interval = false,$time_interval = 300,
+ $max_only = 0, $min_only = 0) {
+
global $config;
global $chart;
global $color;
@@ -529,8 +549,23 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
if ($date == 0) $date = get_system_time();
$datelimit = $date - $period;
$search_in_history_db = db_search_in_history_db($datelimit);
- $resolution = $config['graph_res'] * 50; //Number of points of the graph
- $interval = (int) ($period / $resolution);
+
+
+
+ if($force_interval){
+ $resolution = $period/$time_interval;
+ }
+ else{
+ $resolution = $config['graph_res'] * 50; //Number of points of the graph
+ }
+
+ if($force_interval){
+ $interval = $time_interval;
+ }
+ else{
+ $interval = (int) ($period / $resolution);
+ }
+
$agent_name = modules_get_agentmodule_agent_name ($agent_module_id);
$agent_id = agents_get_agent_id ($agent_name);
$module_name = modules_get_agentmodule_name ($agent_module_id);
@@ -715,7 +750,8 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
$projection, $avg_only, $uncompressed_module,
$show_events, $show_alerts, $show_unknown, $baseline,
$baseline_data, $events, $series_suffix, $start_unknown,
- $percentil, $fullscale);
+ $percentil, $fullscale, $force_interval, $time_interval,
+ $max_only, $min_only);
}
// Return chart data and don't draw
@@ -838,6 +874,19 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
$legend['percentil'.$series_suffix] = __('Percentile %dÂș', $percentil) .$series_suffix_str . " (" . $percentil_value . " " . $unit . ") ";
$chart_extra_data['legend_percentil'] = $legend['percentil'.$series_suffix_str];
}
+
+ if($force_interval){
+ $legend = array();
+ if($avg_only){
+ $legend['sum'.$series_suffix] = __('Avg');
+ }
+ elseif ($max_only) {
+ $legend['min'.$series_suffix] = __('Max');
+ }
+ elseif ($min_only) {
+ $legend['max'.$series_suffix] = __('Min');
+ }
+ }
}
function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
@@ -848,8 +897,10 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
$adapt_key = '', $compare = false, $show_unknown = false,
$menu = true, $backgroundColor = 'white', $percentil = null,
$dashboard = false, $vconsole = false, $type_graph = 'area', $fullscale = false,
- $id_widget_dashboard = false) {
-
+ $id_widget_dashboard = false,$force_interval = 0,$time_interval = 300,
+ $max_only = 0, $min_only = 0) {
+
+
global $config;
global $graphic_type;
@@ -879,7 +930,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
$return_data, $show_title, $projection, $adapt_key,
$compare, $series_suffix, $series_suffix_str,
$show_unknown, $percentil, $dashboard, $vconsole,$type_graph,
- $fullscale, $flash_chart);
+ $fullscale, $flash_chart,$force_interval,$time_interval,$max_only,$min_only);
switch ($compare) {
case 'separated':
@@ -912,7 +963,9 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
$show_alerts, $avg_only,
$date, $unit, $baseline, $return_data, $show_title,
$projection, $adapt_key, $compare, '', '', $show_unknown,
- $percentil, $dashboard, $vconsole, $type_graph, $fullscale, $flash_chart);
+ $percentil, $dashboard, $vconsole, $type_graph, $fullscale,$flash_chart,
+ $force_interval,$time_interval,$max_only,$min_only);
+
if ($return_data) {
return $data_returned;
}
diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index 8a47d2c7d2..7d71bbecab 100644
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -188,6 +188,9 @@ function reporting_make_reporting_data($report = null, $id_report,
$items_label['id_agent_module'] = $content['id_agent_module'];
$items_label['modules'] = $modules_to_macro;
$items_label['agents'] = $agents_to_macro;
+ $items_label['visual_format'] = $visual_format;
+ $metaconsole_on = is_metaconsole();
+ $server_name = $content['server_name'];
//Metaconsole connection
if ($metaconsole_on && $server_name != '') {
@@ -288,19 +291,19 @@ function reporting_make_reporting_data($report = null, $id_report,
$report['contents'][] = reporting_value(
$report,
$content,
- 'max');
+ 'max',$pdf);
break;
case 'avg_value':
$report['contents'][] = reporting_value(
$report,
$content,
- 'avg');
+ 'avg',$pdf);
break;
case 'min_value':
$report['contents'][] = reporting_value(
$report,
$content,
- 'min');
+ 'min',$pdf);
break;
case 'sumatory':
$report['contents'][] = reporting_value(
@@ -3750,7 +3753,7 @@ function reporting_agent_configuration($report, $content) {
return reporting_check_structure_content($return);
}
-function reporting_value($report, $content, $type) {
+function reporting_value($report, $content, $type,$pdf) {
global $config;
$return = array();
@@ -3835,8 +3838,17 @@ function reporting_value($report, $content, $type) {
$return['agent_name'] = $agent_name;
$return['module_name'] = $module_name;
+ html_debug($pdf,true);
+ html_debug($only_image,true);
+
+ if($pdf){
+ $only_image = 1;
+ }
+
switch ($type) {
case 'max':
+ if($content['lapse_calc'] == 0){
+
$value = reporting_get_agentmodule_data_max(
$content['id_agent_module'], $content['period'], $report["datetime"]);
if (!$config['simple_module_value']) {
@@ -3845,18 +3857,286 @@ function reporting_value($report, $content, $type) {
else {
$formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit;
}
- break;
+
+ }
+ else{
+
+ $value = '
+
+
+ ';
+
+ if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){
+
+ $value .= '
+
+
+
+ '.__("Agent").'
+ |
+
+ '.__("Module").'
+ |
+
+ '.__("Maximum").'
+ |
+
+
+ '.$agent_name.'
+ |
+
+ '.$module_name.'
+ |
+
+ '.format_for_graph(reporting_get_agentmodule_data_max(
+ $content['id_agent_module'], $content['period'], $report["datetime"]), $config['graph_precision']) . ' ' . $unit.'
+ |
+
+ ';
+
+ }
+
+ $value .= '
+ |
+
+ |
+ ';
+
+ if($content['visual_format'] == 2 || $content['visual_format'] == 3){
+ $value .=
+ grafico_modulo_sparse(
+ $content['id_agent_module'],
+ $content['period'],
+ false,
+ 600,
+ 300,
+ '',
+ '',
+ false,
+ 0,
+ true,
+ $report["datetime"],
+ '',
+ 0,
+ 0,
+ true,
+ $only_image,
+ ui_get_full_url(false, false, false, false),
+ 2,
+ false,
+ '',
+ $time_compare_overlapped,
+ true,
+ true,
+ 'white',
+ ($content['style']['percentil'] == 1) ? $config['percentil'] : null,
+ false,
+ false,
+ $config['type_module_charts'],
+ false,
+ false,
+ $content['lapse_calc'],
+ $content['lapse'],
+ 1);
+ }
+
+ $value .= '
+
+ |
+
+
+ ';
+
+ if($content['visual_format'] == 1 || $content['visual_format'] == 3){
+
+ $value .= '
+
+
+
+ '.__("Lapse").'
+ |
+
+ '.__("Maximum").'
+ |
+
+ ';
+ $time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module']);
+ $date_reference = getdate();
+
+ for ($i=$date_reference[0]; $i > ($date_reference[0]-$content["period"]); $i -= $content["lapse"]) {
+
+ $value .= ' '. date("Y-m-d H:i:s", ($i-$content["lapse"]+1)).' to '.date("Y-m-d H:i:s",$i).' | ';
+
+ if($i>$time_begin['utimestamp']){
+ $value .= format_for_graph(reporting_get_agentmodule_data_min(
+ $content['id_agent_module'], $content["lapse"], $i), $config['graph_precision']) . ' ' . $unit.' | ';
+ }
+ else{
+ $value .= 'N/A';
+ }
+
+ }
+
+ $value .=' ';
+ }
+
+ $value .= '
+
+ |
+
+
';
+
+ $formated_value = $value;
+ }
+
+ break;
case 'min':
- $value = reporting_get_agentmodule_data_min(
- $content['id_agent_module'], $content['period'], $report["datetime"]);
- if (!$config['simple_module_value']) {
+ if($content['lapse_calc'] == 0){
+ $value = reporting_get_agentmodule_data_min(
+ $content['id_agent_module'], $content['period'], $report["datetime"]);
+
+ if (!$config['simple_module_value']) {
+ $formated_value = $value;
+ }
+ else {
+ $formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit;
+ }
+
+ }
+ else{
+
+ $value = '
+
+
+ ';
+
+ if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){
+
+ $value .= '
+
+
+
+ '.__("Agent").'
+ |
+
+ '.__("Module").'
+ |
+
+ '.__("Minimum").'
+ |
+
+
+ '.$agent_name.'
+ |
+
+ '.$module_name.'
+ |
+
+ '.format_for_graph(reporting_get_agentmodule_data_min(
+ $content['id_agent_module'], $content['period'], $report["datetime"]), $config['graph_precision']) . ' ' . $unit.'
+ |
+
+ ';
+
+ }
+
+ $value .= '
+ |
+
+ |
+ ';
+
+ if($content['visual_format'] == 2 || $content['visual_format'] == 3){
+ $value .=
+ grafico_modulo_sparse(
+ $content['id_agent_module'],
+ $content['period'],
+ false,
+ 600,
+ 300,
+ '',
+ '',
+ false,
+ 0,
+ true,
+ $report["datetime"],
+ '',
+ 0,
+ 0,
+ true,
+ $only_image,
+ ui_get_full_url(false, false, false, false),
+ 2,
+ false,
+ '',
+ $time_compare_overlapped,
+ true,
+ true,
+ 'white',
+ ($content['style']['percentil'] == 1) ? $config['percentil'] : null,
+ false,
+ false,
+ $config['type_module_charts'],
+ false,
+ false,
+ $content['lapse_calc'],
+ $content['lapse'],
+ 0,
+ 1);
+ }
+
+ $value .= '
+
+ |
+
+
+ ';
+
+ if($content['visual_format'] == 1 || $content['visual_format'] == 3){
+
+ $value .= '
+
+
+
+ '.__("Lapse").'
+ |
+
+ '.__("Minimum").'
+ |
+
+ ';
+ $time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module']);
+ $date_reference = getdate();
+
+ for ($i=$date_reference[0]; $i > ($date_reference[0]-$content["period"]); $i -= $content["lapse"]) {
+
+ $value .= ' '. date("Y-m-d H:i:s", ($i-$content["lapse"]+1)).' to '.date("Y-m-d H:i:s",$i).' | ';
+
+ if($i>$time_begin['utimestamp']){
+ $value .= format_for_graph(reporting_get_agentmodule_data_min(
+ $content['id_agent_module'], $content["lapse"], $i), $config['graph_precision']) . ' ' . $unit.' | ';
+ }
+ else{
+ $value .= 'N/A';
+ }
+
+ }
+
+ $value .=' ';
+ }
+
+ $value .= '
+
+ |
+
+
';
+
$formated_value = $value;
}
- else {
- $formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit;
- }
+
break;
case 'avg':
+ if($content['lapse_calc'] == 0){
$value = reporting_get_agentmodule_data_average(
$content['id_agent_module'], $content['period'], $report["datetime"]);
if (!$config['simple_module_value']) {
@@ -3865,7 +4145,138 @@ function reporting_value($report, $content, $type) {
else {
$formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit;
}
- break;
+ }
+ else{
+ $value = '
+
+
+ ';
+
+ if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){
+
+ $value .= '
+
+
+
+ '.__("Agent").'
+ |
+
+ '.__("Module").'
+ |
+
+ '.__("Average").'
+ |
+
+
+ '.$agent_name.'
+ |
+
+ '.$module_name.'
+ |
+
+ '.format_for_graph(reporting_get_agentmodule_data_average(
+ $content['id_agent_module'], $content['period'], $report["datetime"]), $config['graph_precision']) . ' ' . $unit.'
+ |
+
+ ';
+
+ }
+
+ $value .= '
+ |
+
+ |
+ ';
+
+ if($content['visual_format'] == 2 || $content['visual_format'] == 3){
+ $value .=
+ grafico_modulo_sparse(
+ $content['id_agent_module'],
+ $content['period'],
+ false,
+ 600,
+ 300,
+ '',
+ '',
+ false,
+ 1,
+ true,
+ $report["datetime"],
+ '',
+ 0,
+ 0,
+ true,
+ $only_image,
+ ui_get_full_url(false, false, false, false),
+ 2,
+ false,
+ '',
+ $time_compare_overlapped,
+ true,
+ true,
+ 'white',
+ ($content['style']['percentil'] == 1) ? $config['percentil'] : null,
+ false,
+ false,
+ $config['type_module_charts'],
+ false,
+ false,
+ $content['lapse_calc'],
+ $content['lapse']
+ );
+ }
+
+ $value .= '
+
+ |
+
+
+ ';
+
+ if($content['visual_format'] == 1 || $content['visual_format'] == 3){
+
+ $value .= '
+
+
+
+ '.__("Lapse").'
+ |
+
+ '.__("Average").'
+ |
+
+ ';
+ $time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module']);
+ $date_reference = getdate();
+
+ for ($i=$date_reference[0]; $i > ($date_reference[0]-$content["period"]); $i -= $content["lapse"]) {
+
+ $value .= ' '. date("Y-m-d H:i:s", ($i-$content["lapse"]+1)).' to '.date("Y-m-d H:i:s",$i).' | ';
+
+ if($i>$time_begin['utimestamp']){
+ $value .= format_for_graph(reporting_get_agentmodule_data_average(
+ $content['id_agent_module'], $content["lapse"], $i), $config['graph_precision']) . ' ' . $unit.' | ';
+ }
+ else{
+ $value .= 'N/A';
+ }
+
+ }
+
+ $value .=' ';
+ }
+
+ $value .= '
+
+ |
+
+
';
+
+ $formated_value = $value;
+
+ }
+ break;
+
case 'sum':
$value = reporting_get_agentmodule_data_sum(
$content['id_agent_module'], $content['period'], $report["datetime"]);
diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql
index 0d749db694..e880126558 100644
--- a/pandora_console/pandoradb.sql
+++ b/pandora_console/pandoradb.sql
@@ -1269,6 +1269,9 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
`id_module_group` INT (10) unsigned NOT NULL DEFAULT 0,
`server_name` text,
`historical_db` tinyint(1) UNSIGNED NOT NULL default 0,
+ `lapse_calc` tinyint(1) UNSIGNED NOT NULL default '0',
+ `lapse` int(11) UNSIGNED NOT NULL default '300',
+ `visual_format` UNSIGNED NOT NULL tinyint(1) default '0',
PRIMARY KEY(`id_rc`),
FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`)
ON UPDATE CASCADE ON DELETE CASCADE
@@ -2726,6 +2729,9 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
`module_free_text` TEXT,
`each_agent` tinyint(1) default 1,
`historical_db` tinyint(1) UNSIGNED NOT NULL default 0,
+ `lapse_calc` tinyint(1) UNSIGNED NOT NULL default '0',
+ `lapse` int(11) UNSIGNED NOT NULL default '300',
+ `visual_format` UNSIGNED NOT NULL tinyint(1) default '0',
PRIMARY KEY(`id_rc`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;