Merge branch '1099-Anadir_TIP_para_graficas_de_interfaz' into 'develop'

tip in graph interfaces

See merge request !840
This commit is contained in:
vgilc 2017-09-21 15:42:23 +02:00
commit 3348267a8f
3 changed files with 779 additions and 712 deletions

View File

@ -164,7 +164,7 @@ function custom_graphs_print($id_graph, $height, $width, $period,
$background_color = 'white', $modules_param = array(), $homeurl = '', $background_color = 'white', $modules_param = array(), $homeurl = '',
$name_list = array(), $unit_list = array(), $show_last = true, $name_list = array(), $unit_list = array(), $show_last = true,
$show_max = true, $show_min = true, $show_avg = true, $ttl = 1, $show_max = true, $show_min = true, $show_avg = true, $ttl = 1,
$dashboard = false, $vconsole = false, $percentil = null, $from_interface = false,$id_widget_dashboard=false) { $dashboard = false, $vconsole = false, $percentil = null, $from_interface = false,$id_widget_dashboard=false, $fullscale = false) {
global $config; global $config;
@ -261,7 +261,8 @@ function custom_graphs_print($id_graph, $height, $width, $period,
$vconsole, $vconsole,
$percentil, $percentil,
$from_interface, $from_interface,
$id_widget_dashboard); $id_widget_dashboard,
$fullscale);
if ($return) if ($return)
return $output; return $output;

View File

@ -1055,11 +1055,13 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$prediction_period = false, $background_color = 'white', $prediction_period = false, $background_color = 'white',
$name_list = array(), $unit_list = array(), $show_last = true, $show_max = true, $name_list = array(), $unit_list = array(), $show_last = true, $show_max = true,
$show_min = true, $show_avg = true, $labels = array(), $dashboard = false, $show_min = true, $show_avg = true, $labels = array(), $dashboard = false,
$vconsole = false, $percentil = null, $from_interface = false, $id_widget_dashboard=false) { $vconsole = false, $percentil = null, $from_interface = false,
$id_widget_dashboard=false, $fullscale = false) {
global $config; global $config;
global $graphic_type; global $graphic_type;
if(!$fullscale){
$time_format_2 = ''; $time_format_2 = '';
$temp_range = $period; $temp_range = $period;
@ -1161,7 +1163,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$graph[$timestamp]['event'] = 0; $graph[$timestamp]['event'] = 0;
$graph[$timestamp]['alert'] = 0; $graph[$timestamp]['alert'] = 0;
} }
$long_index = array(); $long_index = array();
$graph_values = array(); $graph_values = array();
@ -1243,6 +1244,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
"utimestamp < $date", "utimestamp < $date",
'order' => 'utimestamp ASC'), 'order' => 'utimestamp ASC'),
array ('datos', 'utimestamp'), 'AND', $search_in_history_db); array ('datos', 'utimestamp'), 'AND', $search_in_history_db);
if ($data === false) { if ($data === false) {
$data = array (); $data = array ();
} }
@ -1360,7 +1362,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
// Calculate chart data // Calculate chart data
$last_known = $previous_data; $last_known = $previous_data;
for ($l = 0; $l <= $resolution; $l++) { for ($l = 0; $l <= $resolution; $l++) {
$countAvg ++; $countAvg ++;
@ -1831,6 +1832,28 @@ function graphic_combined_module ($module_list, $weight_list, $period,
} }
break; break;
} }
}
else{
$temp = fullscale_data_combined($module_list, $period, $date);
$resolution = count($temp); //Number of points of the graph
$interval = (int) ($period / $resolution);
$module_name_list = array();
$flash_charts = true;
foreach ($module_list as $key => $value) {
$agent_name = io_safe_output( modules_get_agentmodule_agent_name ($value) );
$alias = db_get_value ("alias","tagente","nombre",$agent_name);
$module_name = io_safe_output( modules_get_agentmodule_name ($value) );
if ($flash_charts){
$module_name_list[$key] = '<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . $alias . " / " . $module_name. '</span>';
}
else{
$module_name_list[$key] = $alias . " / " . $module_name;
}
}
}
$graph_values = $temp; $graph_values = $temp;
@ -2081,6 +2104,41 @@ function graphic_combined_module ($module_list, $weight_list, $period,
} }
} }
function fullscale_data_combined($module_list, $period, $date){
// Set variables
if ($date == 0){
$date = get_system_time();
}
$datelimit = $date - $period;
foreach ($module_list as $key_module => $value_module) {
$data_uncompress = db_uncompress_module_data($value_module, $datelimit, $date);
foreach ($data_uncompress as $key_data => $value_data) {
foreach ($value_data['data'] as $k => $v) {
$real_date = date("Y M d H:i:s", $v['utimestamp']);
$data_all[$real_date][$key_module] = $v['datos'];
}
}
}
$data_prev = array();
foreach ($data_all as $key => $value) {
foreach ($module_list as $key_module => $value_module) {
if(!isset($value[$key_module])){
$data_all[$key][$key_module] = $data_prev[$key_module];
}
else{
$data_prev[$key_module] = $value[$key_module];
}
}
}
return $data_all;
}
/** /**
* Print a graph with access data of agents * Print a graph with access data of agents
* *
@ -4331,7 +4389,6 @@ function fullscale_data ( &$chart_data, &$chart_extra_data, &$long_index,
$series_type['percentil' . $series_suffix] = 'line'; $series_type['percentil' . $series_suffix] = 'line';
} }
} }
//html_debug_print($chart_data);
} }
function grafico_modulo_boolean ($agent_module_id, $period, $show_events, function grafico_modulo_boolean ($agent_module_id, $period, $show_events,

View File

@ -150,6 +150,7 @@ $interface_traffic_modules = array(
$zoom = (int) get_parameter ("zoom", 1); $zoom = (int) get_parameter ("zoom", 1);
$baseline = get_parameter ("baseline", 0); $baseline = get_parameter ("baseline", 0);
$show_percentil = get_parameter ("show_percentil", 0); $show_percentil = get_parameter ("show_percentil", 0);
$fullscale = get_parameter("fullscale", 0);
if ($zoom > 1) { if ($zoom > 1) {
$height = $height * ($zoom / 2.1); $height = $height * ($zoom / 2.1);
@ -200,7 +201,9 @@ $interface_traffic_modules = array(
false, false,
false, false,
(($show_percentil)? $config['percentil'] : null), (($show_percentil)? $config['percentil'] : null),
true); true,
false,
$fullscale);
echo '</div>'; echo '</div>';
@ -259,6 +262,12 @@ $interface_traffic_modules = array(
$table->data[] = $data; $table->data[] = $data;
$table->rowclass[] =''; $table->rowclass[] ='';
$data = array();
$data[0] = __('Full scale');
$data[1] = html_print_checkbox ("fullscale", 1, (bool) $fullscale, true);
$table->data[] = $data;
$table->rowclass[] ='';
$data = array(); $data = array();
$data[0] = __('Zoom factor'); $data[0] = __('Zoom factor');
$options = array(); $options = array();