mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
fixed minor error custom graph
This commit is contained in:
parent
3fbd9adc38
commit
2a81703a68
@ -2988,4 +2988,23 @@ function legend_graph_array(
|
|||||||
|
|
||||||
return $legend;
|
return $legend;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function series_type_graph_array( $series_suffix, $data_module_graph){
|
||||||
|
global $config;
|
||||||
|
global $series_type;
|
||||||
|
|
||||||
|
$series_type['event'.$series_suffix] = 'points';
|
||||||
|
$series_type['alert'.$series_suffix] = 'points';
|
||||||
|
$series_type['unknown'.$series_suffix] = 'unknown';
|
||||||
|
switch ($data_module_graph['id_module_type']) {
|
||||||
|
case 21: case 2: case 6:
|
||||||
|
case 18: case 9: case 31:
|
||||||
|
$series_type['sum'.$series_suffix] = 'boolean';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$series_type['sum'.$series_suffix] = 'area';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$series_type['percentil' . $series_suffix] = 'percentil';
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -167,7 +167,8 @@ function custom_graphs_print($id_graph, $height, $width, $period,
|
|||||||
$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,
|
$dashboard = false, $vconsole = false, $percentil = null,
|
||||||
$from_interface = false,$id_widget_dashboard=false, $fullscale = false) {
|
$from_interface = false,$id_widget_dashboard=false, $fullscale = false) {
|
||||||
|
|
||||||
|
html_debug_print('esta en esta otro arch');
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if ($from_interface) {
|
if ($from_interface) {
|
||||||
|
@ -568,19 +568,10 @@ function grafico_modulo_sparse_data(
|
|||||||
$data_module_graph
|
$data_module_graph
|
||||||
);
|
);
|
||||||
|
|
||||||
$series_type['event'.$series_suffix] = 'points';
|
series_type_graph_array(
|
||||||
$series_type['alert'.$series_suffix] = 'points';
|
$series_suffix,
|
||||||
$series_type['unknown'.$series_suffix] = 'unknown';
|
$data_module_graph
|
||||||
switch ($data_module_graph['id_module_type']) {
|
);
|
||||||
case 21: case 2: case 6:
|
|
||||||
case 18: case 9: case 31:
|
|
||||||
$series_type['sum'.$series_suffix] = 'boolean';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$series_type['sum'.$series_suffix] = 'area';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$series_type['percentil' . $series_suffix] = 'percentil';
|
|
||||||
|
|
||||||
$array_events_alerts[$series_suffix] = $events;
|
$array_events_alerts[$series_suffix] = $events;
|
||||||
}
|
}
|
||||||
@ -779,6 +770,11 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
|||||||
|
|
||||||
$data_module_graph['series_suffix'] = $series_suffix;
|
$data_module_graph['series_suffix'] = $series_suffix;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
html_debug_print($color);
|
||||||
|
|
||||||
|
|
||||||
// Check available data
|
// Check available data
|
||||||
if ($show_elements_graph['compare'] === 'separated') {
|
if ($show_elements_graph['compare'] === 'separated') {
|
||||||
if (!empty($array_data)) {
|
if (!empty($array_data)) {
|
||||||
@ -845,6 +841,27 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
|||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//de aki al final eliminar;
|
//de aki al final eliminar;
|
||||||
|
|
||||||
enterprise_include_once("include/functions_reporting.php");
|
enterprise_include_once("include/functions_reporting.php");
|
||||||
@ -1058,101 +1075,258 @@ function graph_get_formatted_date($timestamp, $format1, $format2) {
|
|||||||
*
|
*
|
||||||
* @return Mixed
|
* @return Mixed
|
||||||
*/
|
*/
|
||||||
function graphic_combined_module ($module_list, $weight_list, $period,
|
function graphic_combined_module ( $module_list, $weight_list, $period, $width, $height, $title, $unit_name,
|
||||||
$width, $height, $title, $unit_name, $show_events = 0,
|
$show_events = 0, $show_alerts = 0, $pure = 0, $stacked = 0, $date = 0, $only_image = false, $homeurl = '',
|
||||||
$show_alerts = 0, $pure = 0, $stacked = 0, $date = 0,
|
$ttl = 1, $projection = false, $prediction_period = false, $backgroundColor = 'white', $name_list = array(),
|
||||||
$only_image = false, $homeurl = '', $ttl = 1, $projection = false,
|
$unit_list = array(), $show_last = true, $show_max = true, $show_min = true, $show_avg = true, $labels = array(),
|
||||||
$prediction_period = false, $background_color = 'white',
|
$dashboard = false, $vconsole = false, $percentil = null, $from_interface = false, $id_widget_dashboard=false,
|
||||||
$name_list = array(), $unit_list = array(), $show_last = true, $show_max = true,
|
$fullscale = false, $summatory = 0, $average = 0, $modules_series = 0 ) {
|
||||||
$show_min = true, $show_avg = true, $labels = array(), $dashboard = false,
|
|
||||||
$vconsole = false, $percentil = null, $from_interface = false,
|
|
||||||
$id_widget_dashboard=false, $fullscale = false, $summatory = 0, $average = 0, $modules_series = 0) {
|
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
global $graphic_type;
|
global $graphic_type;
|
||||||
|
global $legend;
|
||||||
|
global $array_data;
|
||||||
|
|
||||||
if(!$fullscale || $stacked >= 4){
|
$array_data = array();
|
||||||
|
$legend = array();
|
||||||
$fullscale = 0;
|
$caption = array();
|
||||||
$time_format_2 = '';
|
$series_type = array();
|
||||||
$temp_range = $period;
|
|
||||||
$unit_list_aux = array();
|
//date start final period
|
||||||
|
if($date == 0){
|
||||||
if ($projection != false) {
|
$date = get_system_time();
|
||||||
if ($period < $prediction_period)
|
}
|
||||||
$temp_range = $prediction_period;
|
|
||||||
}
|
//XXX colocar
|
||||||
|
/*
|
||||||
// Set the title and time format
|
$weight_list
|
||||||
if ($temp_range <= SECONDS_1DAY) {
|
$stacked
|
||||||
$time_format = 'Y M d H:i:s';
|
$prediction_period
|
||||||
}
|
$name_list
|
||||||
elseif ($temp_range < SECONDS_15DAYS) {
|
$unit_list
|
||||||
$time_format = 'Y M d';
|
$show_last
|
||||||
$time_format_2 = 'H:i';
|
$show_max
|
||||||
if ($projection != false) {
|
$show_min
|
||||||
$time_format_2 = 'H\h';
|
$show_avg
|
||||||
|
$labels
|
||||||
|
$from_interface
|
||||||
|
$summatory
|
||||||
|
$average
|
||||||
|
$modules_series
|
||||||
|
*/
|
||||||
|
|
||||||
|
$date_array = array();
|
||||||
|
$date_array["period"] = $period;
|
||||||
|
$date_array["final_date"] = $date;
|
||||||
|
$date_array["start_date"] = $date - $period;
|
||||||
|
|
||||||
|
//show elements in the graph
|
||||||
|
$menu = true;
|
||||||
|
if ($vconsole){
|
||||||
|
$menu = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$show_elements_graph = array();
|
||||||
|
$show_elements_graph['show_events'] = $show_events;
|
||||||
|
$show_elements_graph['show_alerts'] = $show_alerts;
|
||||||
|
$show_elements_graph['show_unknown'] = false; // dont use
|
||||||
|
$show_elements_graph['avg_only'] = false; // dont use
|
||||||
|
$show_elements_graph['fullscale'] = $fullscale;
|
||||||
|
//XXXX
|
||||||
|
$show_elements_graph['show_title'] = $show_title; // dont use
|
||||||
|
|
||||||
|
$show_elements_graph['menu'] = $menu; // dont use
|
||||||
|
$show_elements_graph['adapt_key'] = ''; // dont use
|
||||||
|
$show_elements_graph['percentil'] = $percentil;
|
||||||
|
$show_elements_graph['projection'] = $projection;
|
||||||
|
$show_elements_graph['compare'] = false; //dont use
|
||||||
|
$show_elements_graph['dashboard'] = $dashboard;
|
||||||
|
$show_elements_graph['vconsole'] = $vconsole;
|
||||||
|
$show_elements_graph['pure'] = $pure;
|
||||||
|
$show_elements_graph['baseline'] = false; //dont use
|
||||||
|
$show_elements_graph['only_image'] = $only_image;
|
||||||
|
$show_elements_graph['return_data'] = true; //dont use
|
||||||
|
$show_elements_graph['id_widget'] = $id_widget_dashboard;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$format_graph = array();
|
||||||
|
$format_graph['width'] = $width;
|
||||||
|
$format_graph['height'] = $height;
|
||||||
|
//XXXX
|
||||||
|
$format_graph['type_graph'] = $type_graph; //dont use
|
||||||
|
|
||||||
|
$format_graph['unit_name'] = $unit_name;
|
||||||
|
$format_graph['unit'] = ''; //dont use
|
||||||
|
|
||||||
|
$format_graph['title'] = $title;
|
||||||
|
$format_graph['homeurl'] = $homeurl;
|
||||||
|
$format_graph['ttl'] = $ttl;
|
||||||
|
$format_graph['background'] = $backgroundColor;
|
||||||
|
$format_graph['font'] = $config['fontpath'];
|
||||||
|
$format_graph['font-size'] = $config['font_size'];
|
||||||
|
|
||||||
|
|
||||||
|
$i=0;
|
||||||
|
foreach ($module_list as $key => $agent_module_id) {
|
||||||
|
|
||||||
|
$module_data = db_get_row_sql (
|
||||||
|
'SELECT * FROM tagente_modulo
|
||||||
|
WHERE id_agente_modulo = ' .
|
||||||
|
$agent_module_id
|
||||||
|
);
|
||||||
|
|
||||||
|
$data_module_graph = array();
|
||||||
|
$data_module_graph['history_db'] = db_search_in_history_db($date_array["start_date"]);
|
||||||
|
$data_module_graph['agent_name'] = modules_get_agentmodule_agent_name ($agent_module_id);
|
||||||
|
$data_module_graph['agent_id'] = $module_data['id_agente'];
|
||||||
|
$data_module_graph['module_name'] = $module_data['nombre'];
|
||||||
|
$data_module_graph['id_module_type'] = $module_data['id_tipo_modulo'];
|
||||||
|
$data_module_graph['module_type'] = modules_get_moduletype_name ($data_module_graph['id_module_type']);
|
||||||
|
$data_module_graph['uncompressed'] = is_module_uncompressed ($data_module_graph['module_type']);
|
||||||
|
$data_module_graph['w_min'] = $module_data['min_warning'];
|
||||||
|
$data_module_graph['w_max'] = $module_data['max_warning'];
|
||||||
|
$data_module_graph['w_inv'] = $module_data['warning_inverse'];
|
||||||
|
$data_module_graph['c_min'] = $module_data['min_critical'];
|
||||||
|
$data_module_graph['c_max'] = $module_data['max_critical'];
|
||||||
|
$data_module_graph['c_inv'] = $module_data['critical_inverse'];
|
||||||
|
|
||||||
|
grafico_modulo_sparse_data(
|
||||||
|
$agent_module_id,
|
||||||
|
$date_array,
|
||||||
|
$data_module_graph,
|
||||||
|
$show_elements_graph,
|
||||||
|
$format_graph,
|
||||||
|
array(),
|
||||||
|
$i,
|
||||||
|
$data_module_graph['agent_name']
|
||||||
|
);
|
||||||
|
|
||||||
|
$series_suffix = $i;
|
||||||
|
$series_suffix_str = '';
|
||||||
|
|
||||||
|
$max = $array_data['sum' . $i]['max'];
|
||||||
|
$min = $array_data['sum' . $i]['min'];
|
||||||
|
$avg = $array_data['sum' . $i]['avg'];
|
||||||
|
|
||||||
|
$percentil_value = $array_data['percentil' . $i]['data'][0][1];
|
||||||
|
|
||||||
|
$color = color_graph_array(
|
||||||
|
$series_suffix,
|
||||||
|
$show_elements_graph['flag_overlapped']
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($color as $k => $v) {
|
||||||
|
if(is_array($array_data[$k])){
|
||||||
|
$array_data[$k]['color'] = $v['color'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($temp_range <= SECONDS_1MONTH) {
|
|
||||||
$time_format = 'Y M d';
|
legend_graph_array(
|
||||||
$time_format_2 = 'H\h';
|
$max, $min, $avg,
|
||||||
|
$series_suffix,
|
||||||
|
$str_series_suffix,
|
||||||
|
$format_graph,
|
||||||
|
$show_elements_graph,
|
||||||
|
$percentil_value,
|
||||||
|
$data_module_graph
|
||||||
|
);
|
||||||
|
|
||||||
|
series_type_graph_array(
|
||||||
|
$series_suffix,
|
||||||
|
$data_module_graph
|
||||||
|
);
|
||||||
|
|
||||||
|
//$array_events_alerts[$series_suffix] = $events;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
html_debug_print($legend);
|
||||||
|
html_debug_print($series_type);
|
||||||
|
/*
|
||||||
|
foreach ($data_array_prepare as $key => $value) {
|
||||||
|
foreach ($value as $k => $v) {
|
||||||
|
$data_array[$k] = $v;
|
||||||
}
|
}
|
||||||
elseif ($temp_range <= SECONDS_1MONTH) {
|
}
|
||||||
$time_format = 'Y M d';
|
*/
|
||||||
$time_format_2 = 'H\h';
|
|
||||||
}
|
|
||||||
elseif ($period < SECONDS_6MONTHS) {
|
|
||||||
$time_format = 'Y M d';
|
|
||||||
$time_format_2 = 'H\h';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$time_format = "Y M d";
|
|
||||||
$time_format_2 = 'H\h';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set variables
|
|
||||||
if ($date == 0)
|
|
||||||
$date = get_system_time();
|
|
||||||
$datelimit = $date - $period;
|
|
||||||
|
|
||||||
$resolution = $config['graph_res'] * 50; //Number of points of the graph
|
|
||||||
if($resolution > $period){
|
|
||||||
$resolution = $period;
|
|
||||||
}
|
|
||||||
$interval = (int) ($period / $resolution);
|
|
||||||
|
|
||||||
// If projection graph, fill with zero previous data to projection interval
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
///XXXXXXX esto lo que hay de aki para abajo
|
||||||
|
|
||||||
|
/*
|
||||||
|
// If projection graph, fill with zero previous data to projection interval
|
||||||
if ($projection != false) {
|
if ($projection != false) {
|
||||||
$j = $datelimit;
|
$j = $datelimit;
|
||||||
$in_range = true;
|
$in_range = true;
|
||||||
while ($in_range) {
|
while ($in_range) {
|
||||||
$timestamp_f = graph_get_formatted_date($j, $time_format, $time_format_2);
|
$timestamp_f = graph_get_formatted_date($j, $time_format, $time_format_2);
|
||||||
|
|
||||||
$before_projection[$timestamp_f] = 0;
|
$before_projection[$timestamp_f] = 0;
|
||||||
|
|
||||||
if ($j > $date) {
|
if ($j > $date) {
|
||||||
$in_range = false;
|
$in_range = false;
|
||||||
}
|
}
|
||||||
$j = $j + $interval;
|
$j = $j + $interval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Added support for projection graphs (normal_module + 1(prediction data))
|
// Added support for projection graphs (normal_module + 1(prediction data))
|
||||||
if ($projection !== false) {
|
if ($projection !== false) {
|
||||||
$module_number = count ($module_list) + 1;
|
$module_number = count ($module_list) + 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$module_number = count ($module_list);
|
$module_number = count ($module_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
$names_number = count($name_list);
|
$names_number = count($name_list);
|
||||||
$units_number = count($unit_list);
|
$units_number = count($unit_list);
|
||||||
|
*/
|
||||||
// interval - This is the number of "rows" we are divided the time to fill data.
|
// interval - This is the number of "rows" we are divided the time to fill data.
|
||||||
// more interval, more resolution, and slower.
|
// more interval, more resolution, and slower.
|
||||||
// periodo - Gap of time, in seconds. This is now to (now-periodo) secs
|
// periodo - Gap of time, in seconds. This is now to (now-periodo) secs
|
||||||
|
|
||||||
// Init weights
|
// Init weights
|
||||||
for ($i = 0; $i < $module_number; $i++) {
|
for ($i = 0; $i < $module_number; $i++) {
|
||||||
if (! isset ($weight_list[$i])) {
|
if (! isset ($weight_list[$i])) {
|
||||||
@ -1171,7 +1345,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
$long_index[$timestamp_short] = date(
|
$long_index[$timestamp_short] = date(
|
||||||
html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $timestamp);
|
html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $timestamp);
|
||||||
$timestamp = $timestamp_short;*/
|
$timestamp = $timestamp_short;*/
|
||||||
|
|
||||||
$graph[$timestamp]['count'] = 0;
|
$graph[$timestamp]['count'] = 0;
|
||||||
$graph[$timestamp]['timestamp_bottom'] = $timestamp;
|
$graph[$timestamp]['timestamp_bottom'] = $timestamp;
|
||||||
$graph[$timestamp]['timestamp_top'] = $timestamp + $interval;
|
$graph[$timestamp]['timestamp_top'] = $timestamp + $interval;
|
||||||
@ -1180,25 +1353,25 @@ 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();
|
||||||
$module_name_list = array();
|
$module_name_list = array();
|
||||||
$collector = 0;
|
$collector = 0;
|
||||||
$user = users_get_user_by_id($config['id_user']);
|
$user = users_get_user_by_id($config['id_user']);
|
||||||
$user_flash_charts = $user['flash_chart'];
|
$user_flash_charts = $user['flash_chart'];
|
||||||
|
|
||||||
if ($user_flash_charts == 1)
|
if ($user_flash_charts == 1)
|
||||||
$flash_charts = true;
|
$flash_charts = true;
|
||||||
elseif($user_flash_charts == -1)
|
elseif($user_flash_charts == -1)
|
||||||
$flash_charts = $config['flash_charts'];
|
$flash_charts = $config['flash_charts'];
|
||||||
elseif($user_flash_charts == 0)
|
elseif($user_flash_charts == 0)
|
||||||
$flash_charts = false;
|
$flash_charts = false;
|
||||||
|
|
||||||
if ($only_image) {
|
if ($only_image) {
|
||||||
$flash_charts = false;
|
$flash_charts = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate data for each module
|
// Calculate data for each module
|
||||||
for ($i = 0; $i < $module_number; $i++) {
|
for ($i = 0; $i < $module_number; $i++) {
|
||||||
$automatic_custom_graph_meta = false;
|
$automatic_custom_graph_meta = false;
|
||||||
@ -1210,7 +1383,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
$automatic_custom_graph_meta = true;
|
$automatic_custom_graph_meta = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$search_in_history_db = db_search_in_history_db($datelimit);
|
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||||
|
|
||||||
// If its a projection graph,
|
// If its a projection graph,
|
||||||
@ -1397,6 +1570,7 @@ 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 ++;
|
||||||
|
|
||||||
$timestamp = $datelimit + ($interval * $l);
|
$timestamp = $datelimit + ($interval * $l);
|
||||||
@ -1560,11 +1734,11 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$temp = array();
|
$temp = array();
|
||||||
|
|
||||||
if ($flash_charts === false && $stacked == CUSTOM_GRAPH_GAUGE)
|
if ($flash_charts === false && $stacked == CUSTOM_GRAPH_GAUGE)
|
||||||
$stacked = CUSTOM_GRAPH_BULLET_CHART;
|
$stacked = CUSTOM_GRAPH_BULLET_CHART;
|
||||||
switch ($stacked) {
|
switch ($stacked) {
|
||||||
case CUSTOM_GRAPH_BULLET_CHART_THRESHOLD:
|
case CUSTOM_GRAPH_BULLET_CHART_THRESHOLD:
|
||||||
case CUSTOM_GRAPH_BULLET_CHART:
|
case CUSTOM_GRAPH_BULLET_CHART:
|
||||||
@ -1596,14 +1770,14 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
$automatic_custom_graph_meta = true;
|
$automatic_custom_graph_meta = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($automatic_custom_graph_meta)
|
if ($automatic_custom_graph_meta)
|
||||||
$module = $module_item['module'];
|
$module = $module_item['module'];
|
||||||
else
|
else
|
||||||
$module = $module_item;
|
$module = $module_item;
|
||||||
|
|
||||||
$search_in_history_db = db_search_in_history_db($datelimit);
|
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||||
|
|
||||||
$temp[$module] = modules_get_agentmodule($module);
|
$temp[$module] = modules_get_agentmodule($module);
|
||||||
$query_last_value = sprintf('
|
$query_last_value = sprintf('
|
||||||
SELECT datos
|
SELECT datos
|
||||||
@ -1613,7 +1787,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
ORDER BY utimestamp DESC',
|
ORDER BY utimestamp DESC',
|
||||||
$module, $date);
|
$module, $date);
|
||||||
$temp_data = db_get_value_sql($query_last_value);
|
$temp_data = db_get_value_sql($query_last_value);
|
||||||
|
|
||||||
if ($temp_data) {
|
if ($temp_data) {
|
||||||
if (is_numeric($temp_data))
|
if (is_numeric($temp_data))
|
||||||
$value = $temp_data;
|
$value = $temp_data;
|
||||||
@ -1626,15 +1800,14 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
else
|
else
|
||||||
$value = false;
|
$value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($labels) && isset($labels[$module]) ){
|
if ( !empty($labels) && isset($labels[$module]) ){
|
||||||
$label = io_safe_input($labels[$module]);
|
$label = io_safe_input($labels[$module]);
|
||||||
}else{
|
}else{
|
||||||
$alias = db_get_value ("alias","tagente","id_agente",$temp[$module]['id_agente']);
|
$alias = db_get_value ("alias","tagente","id_agente",$temp[$module]['id_agente']);
|
||||||
$label = $alias . ': ' . $temp[$module]['nombre'];
|
$label = $alias . ': ' . $temp[$module]['nombre'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$temp[$module]['label'] = $label;
|
$temp[$module]['label'] = $label;
|
||||||
$temp[$module]['value'] = $value;
|
$temp[$module]['value'] = $value;
|
||||||
$temp_max = reporting_get_agentmodule_data_max($module,$period,$date);
|
$temp_max = reporting_get_agentmodule_data_max($module,$period,$date);
|
||||||
@ -1650,21 +1823,21 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
if ($temp_min < 0)
|
if ($temp_min < 0)
|
||||||
$temp_min = 0;
|
$temp_min = 0;
|
||||||
$temp[$module]['min'] = ($temp_min === false) ? 0 : $temp_min;
|
$temp[$module]['min'] = ($temp_min === false) ? 0 : $temp_min;
|
||||||
|
|
||||||
if ($config['metaconsole']) {
|
if ($config['metaconsole']) {
|
||||||
// Automatic custom graph from the report template in metaconsole
|
// Automatic custom graph from the report template in metaconsole
|
||||||
if (is_array($module_list[0])) {
|
if (is_array($module_list[0])) {
|
||||||
metaconsole_restore_db();
|
metaconsole_restore_db();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case CUSTOM_GRAPH_HBARS:
|
case CUSTOM_GRAPH_HBARS:
|
||||||
case CUSTOM_GRAPH_VBARS:
|
case CUSTOM_GRAPH_VBARS:
|
||||||
$datelimit = $date - $period;
|
$datelimit = $date - $period;
|
||||||
|
|
||||||
$label = '';
|
$label = '';
|
||||||
foreach ($module_list as $module_item) {
|
foreach ($module_list as $module_item) {
|
||||||
$automatic_custom_graph_meta = false;
|
$automatic_custom_graph_meta = false;
|
||||||
@ -1676,12 +1849,12 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
$automatic_custom_graph_meta = true;
|
$automatic_custom_graph_meta = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($automatic_custom_graph_meta)
|
if ($automatic_custom_graph_meta)
|
||||||
$module = $module_item['module'];
|
$module = $module_item['module'];
|
||||||
else
|
else
|
||||||
$module = $module_item;
|
$module = $module_item;
|
||||||
|
|
||||||
$module_data = modules_get_agentmodule($module);
|
$module_data = modules_get_agentmodule($module);
|
||||||
$query_last_value = sprintf('
|
$query_last_value = sprintf('
|
||||||
SELECT datos
|
SELECT datos
|
||||||
@ -1691,27 +1864,25 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
ORDER BY utimestamp DESC',
|
ORDER BY utimestamp DESC',
|
||||||
$module, $date);
|
$module, $date);
|
||||||
$temp_data = db_get_value_sql($query_last_value);
|
$temp_data = db_get_value_sql($query_last_value);
|
||||||
|
|
||||||
$agent_name = io_safe_output(
|
$agent_name = io_safe_output(
|
||||||
modules_get_agentmodule_agent_name ($module));
|
modules_get_agentmodule_agent_name ($module));
|
||||||
|
|
||||||
if (!empty($labels) && isset($labels[$module]) ){
|
if (!empty($labels) && isset($labels[$module]) ){
|
||||||
$label = $labels[$module];
|
$label = $labels[$module];
|
||||||
}else {
|
}else {
|
||||||
$alias = db_get_value ("alias","tagente","id_agente",$module_data['id_agente']);
|
$alias = db_get_value ("alias","tagente","id_agente",$module_data['id_agente']);
|
||||||
$label = $alias . " - " .$module_data['nombre'];
|
$label = $alias . " - " .$module_data['nombre'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$temp[$label]['g'] = round($temp_data,4);
|
$temp[$label]['g'] = round($temp_data,4);
|
||||||
|
|
||||||
|
|
||||||
if ($config['metaconsole']) {
|
if ($config['metaconsole']) {
|
||||||
// Automatic custom graph from the report template in metaconsole
|
// Automatic custom graph from the report template in metaconsole
|
||||||
if (is_array($module_list[0])) {
|
if (is_array($module_list[0])) {
|
||||||
metaconsole_restore_db();
|
metaconsole_restore_db();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CUSTOM_GRAPH_PIE:
|
case CUSTOM_GRAPH_PIE:
|
||||||
@ -1727,12 +1898,12 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
$automatic_custom_graph_meta = true;
|
$automatic_custom_graph_meta = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($automatic_custom_graph_meta)
|
if ($automatic_custom_graph_meta)
|
||||||
$module = $module_item['module'];
|
$module = $module_item['module'];
|
||||||
else
|
else
|
||||||
$module = $module_item;
|
$module = $module_item;
|
||||||
|
|
||||||
$data_module = modules_get_agentmodule($module);
|
$data_module = modules_get_agentmodule($module);
|
||||||
$query_last_value = sprintf('
|
$query_last_value = sprintf('
|
||||||
SELECT datos
|
SELECT datos
|
||||||
@ -1743,7 +1914,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
ORDER BY utimestamp DESC',
|
ORDER BY utimestamp DESC',
|
||||||
$module, $datelimit, $date);
|
$module, $datelimit, $date);
|
||||||
$temp_data = db_get_value_sql($query_last_value);
|
$temp_data = db_get_value_sql($query_last_value);
|
||||||
|
|
||||||
if ( $temp_data ){
|
if ( $temp_data ){
|
||||||
if (is_numeric($temp_data))
|
if (is_numeric($temp_data))
|
||||||
$value = $temp_data;
|
$value = $temp_data;
|
||||||
@ -1761,7 +1932,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
$alias = db_get_value ("alias","tagente","id_agente",$data_module['id_agente']);
|
$alias = db_get_value ("alias","tagente","id_agente",$data_module['id_agente']);
|
||||||
$label = io_safe_output($alias . ": " . $data_module['nombre']);
|
$label = io_safe_output($alias . ": " . $data_module['nombre']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$temp[$label] = array('value'=>$value,
|
$temp[$label] = array('value'=>$value,
|
||||||
'unit'=>$data_module['unit']);
|
'unit'=>$data_module['unit']);
|
||||||
if ($config['metaconsole']) {
|
if ($config['metaconsole']) {
|
||||||
@ -1772,7 +1943,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$temp['total_modules'] = $total_modules;
|
$temp['total_modules'] = $total_modules;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case CUSTOM_GRAPH_GAUGE:
|
case CUSTOM_GRAPH_GAUGE:
|
||||||
$datelimit = $date - $period;
|
$datelimit = $date - $period;
|
||||||
@ -1787,12 +1958,12 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
$automatic_custom_graph_meta = true;
|
$automatic_custom_graph_meta = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($automatic_custom_graph_meta)
|
if ($automatic_custom_graph_meta)
|
||||||
$module = $module_item['module'];
|
$module = $module_item['module'];
|
||||||
else
|
else
|
||||||
$module = $module_item;
|
$module = $module_item;
|
||||||
|
|
||||||
$temp[$module] = modules_get_agentmodule($module);
|
$temp[$module] = modules_get_agentmodule($module);
|
||||||
$query_last_value = sprintf('
|
$query_last_value = sprintf('
|
||||||
SELECT datos
|
SELECT datos
|
||||||
@ -1812,10 +1983,10 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
$value = false;
|
$value = false;
|
||||||
}
|
}
|
||||||
$temp[$module]['label'] = ($labels[$module] != '') ? $labels[$module] : $temp[$module]['nombre'];
|
$temp[$module]['label'] = ($labels[$module] != '') ? $labels[$module] : $temp[$module]['nombre'];
|
||||||
|
|
||||||
$temp[$module]['value'] = $value;
|
$temp[$module]['value'] = $value;
|
||||||
$temp[$module]['label'] = ui_print_truncate_text($temp[$module]['label'],"module_small",false,true,false,"..");
|
$temp[$module]['label'] = ui_print_truncate_text($temp[$module]['label'],"module_small",false,true,false,"..");
|
||||||
|
|
||||||
if ($temp[$module]['unit'] == '%') {
|
if ($temp[$module]['unit'] == '%') {
|
||||||
$temp[$module]['min'] = 0;
|
$temp[$module]['min'] = 0;
|
||||||
$temp[$module]['max'] = 100;
|
$temp[$module]['max'] = 100;
|
||||||
@ -1830,7 +2001,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
$temp[$module]['max'] = ($max == 0 ) ? 100 : $max;
|
$temp[$module]['max'] = ($max == 0 ) ? 100 : $max;
|
||||||
}
|
}
|
||||||
$temp[$module]['gauge'] = uniqid('gauge_');
|
$temp[$module]['gauge'] = uniqid('gauge_');
|
||||||
|
|
||||||
if ($config['metaconsole']) {
|
if ($config['metaconsole']) {
|
||||||
// Automatic custom graph from the report template in metaconsole
|
// Automatic custom graph from the report template in metaconsole
|
||||||
if (is_array($module_list[0])) {
|
if (is_array($module_list[0])) {
|
||||||
@ -1846,7 +2017,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
foreach ($point as $timestamp_point => $point_value) {
|
foreach ($point as $timestamp_point => $point_value) {
|
||||||
$temp[$timestamp_point][$graph_group] = $point_value;
|
$temp[$timestamp_point][$graph_group] = $point_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
$percentile_value = get_percentile($config['percentil'], $point);
|
$percentile_value = get_percentile($config['percentil'], $point);
|
||||||
$percentil_result[$graph_group] = array_fill ( 0, count($point), $percentile_value);
|
$percentil_result[$graph_group] = array_fill ( 0, count($point), $percentile_value);
|
||||||
$series_type[$graph_group] = 'line';
|
$series_type[$graph_group] = 'line';
|
||||||
@ -1876,8 +2046,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
/*
|
||||||
else{
|
|
||||||
$flash_charts = true;
|
$flash_charts = true;
|
||||||
if($ttl>1 || !$config['flash_charts']){
|
if($ttl>1 || !$config['flash_charts']){
|
||||||
$flash_charts = false;
|
$flash_charts = false;
|
||||||
@ -1952,23 +2121,23 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
$series_type[$key] = 'line';
|
$series_type[$key] = 'line';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
*/
|
||||||
|
|
||||||
$graph_values = $temp;
|
$graph_values = $temp;
|
||||||
|
|
||||||
if($config["fixed_graph"] == false){
|
if($config["fixed_graph"] == false){
|
||||||
$water_mark = array(
|
$water_mark = array(
|
||||||
'file' => $config['homedir'] . "/images/logo_vertical_water.png",
|
'file' => $config['homedir'] . "/images/logo_vertical_water.png",
|
||||||
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Work around for fixed the agents name with huge size chars.
|
//Work around for fixed the agents name with huge size chars.
|
||||||
$fixed_font_size = $config['font_size'];
|
$fixed_font_size = $config['font_size'];
|
||||||
|
|
||||||
//Set graph color
|
//Set graph color
|
||||||
|
/*
|
||||||
$color = array();
|
$color = array();
|
||||||
|
|
||||||
$color[0] = array('border' => '#000000',
|
$color[0] = array('border' => '#000000',
|
||||||
'color' => $config['graph_color1'],
|
'color' => $config['graph_color1'],
|
||||||
'alpha' => CHART_DEFAULT_ALPHA);
|
'alpha' => CHART_DEFAULT_ALPHA);
|
||||||
@ -2014,7 +2183,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
$color[15] = array('border' => '#000000',
|
$color[15] = array('border' => '#000000',
|
||||||
'color' => COL_GRAPH13,
|
'color' => COL_GRAPH13,
|
||||||
'alpha' => CHART_DEFAULT_ALPHA);
|
'alpha' => CHART_DEFAULT_ALPHA);
|
||||||
|
*/
|
||||||
if($id_widget_dashboard){
|
if($id_widget_dashboard){
|
||||||
$opcion = unserialize(db_get_value_filter('options','twidget_dashboard',array('id' => $id_widget_dashboard)));
|
$opcion = unserialize(db_get_value_filter('options','twidget_dashboard',array('id' => $id_widget_dashboard)));
|
||||||
foreach ($module_list as $key => $value) {
|
foreach ($module_list as $key => $value) {
|
||||||
@ -2023,7 +2192,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$threshold_data = array();
|
$threshold_data = array();
|
||||||
|
|
||||||
if ($from_interface) {
|
if ($from_interface) {
|
||||||
@ -2120,7 +2289,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($do_it_warning_min && $do_it_warning_max && $do_it_warning_inverse) {
|
if ($do_it_warning_min && $do_it_warning_max && $do_it_warning_inverse) {
|
||||||
$yellow_threshold = $compare_warning;
|
$yellow_threshold = $compare_warning;
|
||||||
$threshold_data['yellow_up'] = $yellow_up;
|
$threshold_data['yellow_up'] = $yellow_up;
|
||||||
@ -2133,12 +2302,12 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
$threshold_data['red_inverse'] = (bool)$red_inverse;
|
$threshold_data['red_inverse'] = (bool)$red_inverse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//summatory and average series
|
//summatory and average series
|
||||||
if($stacked == CUSTOM_GRAPH_AREA || $stacked == CUSTOM_GRAPH_LINE) {
|
if($stacked == CUSTOM_GRAPH_AREA || $stacked == CUSTOM_GRAPH_LINE) {
|
||||||
//Fix pdf label
|
//Fix pdf label
|
||||||
$static_pdf = strpos($module_name_list[0], '<span style');
|
$static_pdf = strpos($module_name_list[0], '<span style');
|
||||||
|
|
||||||
if($summatory && $average) {
|
if($summatory && $average) {
|
||||||
foreach ($graph_values as $key => $value) {
|
foreach ($graph_values as $key => $value) {
|
||||||
$cont = count($value);
|
$cont = count($value);
|
||||||
@ -2150,7 +2319,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
array_splice($graph_values[$key],0,count($graph_values[$key])-2);
|
array_splice($graph_values[$key],0,count($graph_values[$key])-2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$modules_series) {
|
if(!$modules_series) {
|
||||||
if(empty($percentil)) {
|
if(empty($percentil)) {
|
||||||
array_splice($module_name_list,0,count($module_name_list));
|
array_splice($module_name_list,0,count($module_name_list));
|
||||||
@ -2164,7 +2333,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
array_unshift($module_name_list, __('summatory'));
|
array_unshift($module_name_list, __('summatory'));
|
||||||
array_unshift($module_name_list, __('average'));
|
array_unshift($module_name_list, __('average'));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if(empty($percentil)) {
|
if(empty($percentil)) {
|
||||||
if($static_pdf === 0) {
|
if($static_pdf === 0) {
|
||||||
@ -2174,7 +2343,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
array_push($module_name_list, __('summatory'));
|
array_push($module_name_list, __('summatory'));
|
||||||
array_push($module_name_list, __('average'));
|
array_push($module_name_list, __('average'));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if($static_pdf === 0) {
|
if($static_pdf === 0) {
|
||||||
array_splice($module_name_list,(count($module_name_list)/2),0,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('average'). '</span>');
|
array_splice($module_name_list,(count($module_name_list)/2),0,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('average'). '</span>');
|
||||||
@ -2183,11 +2351,8 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
array_splice($module_name_list,(count($module_name_list)/2),0, __('average'));
|
array_splice($module_name_list,(count($module_name_list)/2),0, __('average'));
|
||||||
array_splice($module_name_list,(count($module_name_list)/2),0,__('summatory'));
|
array_splice($module_name_list,(count($module_name_list)/2),0,__('summatory'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} elseif($summatory) {
|
} elseif($summatory) {
|
||||||
foreach ($graph_values as $key => $value) {
|
foreach ($graph_values as $key => $value) {
|
||||||
array_push($value,array_sum($value));
|
array_push($value,array_sum($value));
|
||||||
@ -2208,7 +2373,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
} else {
|
} else {
|
||||||
array_unshift($module_name_list, __('summatory'));
|
array_unshift($module_name_list, __('summatory'));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if(empty($percentil)) {
|
if(empty($percentil)) {
|
||||||
if($static_pdf === 0) {
|
if($static_pdf === 0) {
|
||||||
@ -2216,17 +2380,14 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
} else {
|
} else {
|
||||||
array_push($module_name_list,__('summatory'));
|
array_push($module_name_list,__('summatory'));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if($static_pdf === 0) {
|
if($static_pdf === 0) {
|
||||||
array_splice($module_name_list,(count($module_name_list)/2),0,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('summatory'). '</span>');
|
array_splice($module_name_list,(count($module_name_list)/2),0,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('summatory'). '</span>');
|
||||||
} else {
|
} else {
|
||||||
array_splice($module_name_list,(count($module_name_list)/2),0,__('summatory'));
|
array_splice($module_name_list,(count($module_name_list)/2),0,__('summatory'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} elseif($average) {
|
} elseif($average) {
|
||||||
foreach ($graph_values as $key => $value) {
|
foreach ($graph_values as $key => $value) {
|
||||||
$summ = array_sum($value) / count($value);
|
$summ = array_sum($value) / count($value);
|
||||||
@ -2236,7 +2397,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
array_splice($graph_values[$key],0,count($graph_values[$key])-1);
|
array_splice($graph_values[$key],0,count($graph_values[$key])-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$modules_series) {
|
if(!$modules_series) {
|
||||||
if(empty($percentil)) {
|
if(empty($percentil)) {
|
||||||
array_splice($module_name_list,0,count($module_name_list));
|
array_splice($module_name_list,0,count($module_name_list));
|
||||||
@ -2248,7 +2408,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
} else {
|
} else {
|
||||||
array_unshift($module_name_list,__('average'));
|
array_unshift($module_name_list,__('average'));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if(empty($percentil)) {
|
if(empty($percentil)) {
|
||||||
if($static_pdf === 0) {
|
if($static_pdf === 0) {
|
||||||
@ -2256,27 +2415,27 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
} else {
|
} else {
|
||||||
array_push($module_name_list,__('average'));
|
array_push($module_name_list,__('average'));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if($static_pdf === 0) {
|
if($static_pdf === 0) {
|
||||||
array_splice($module_name_list,(count($module_name_list)/2),0,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('average'). '</span>');
|
array_splice($module_name_list,(count($module_name_list)/2),0,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('average'). '</span>');
|
||||||
} else {
|
} else {
|
||||||
array_splice($module_name_list,(count($module_name_list)/2),0,__('average'));
|
array_splice($module_name_list,(count($module_name_list)/2),0,__('average'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($stacked) {
|
switch ($stacked) {
|
||||||
case CUSTOM_GRAPH_AREA:
|
case CUSTOM_GRAPH_AREA:
|
||||||
return area_graph($flash_charts, $graph_values, $width,
|
// html_debug_print('entra por este sitio');
|
||||||
$height, $color, $module_name_list, $long_index,
|
// html_debug_print($data_array);
|
||||||
ui_get_full_url("images/image_problem_area_small.png", false, false, false),
|
//$array_data = $data_array;
|
||||||
$title, "", $homeurl, $water_mark, $config['fontpath'],
|
return area_graph($agent_module_id, $array_data, $color,
|
||||||
$fixed_font_size, $unit, $ttl, array(), array(), $yellow_threshold, $red_threshold, '',
|
$legend, $series_type, $date_array,
|
||||||
false, '', true, $background_color,$dashboard, $vconsole, 0, $percentil_result, $threshold_data);
|
$data_module_graph, $show_elements_graph,
|
||||||
|
$format_graph, $water_mark, $series_suffix_str,
|
||||||
|
$array_events_alerts);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case CUSTOM_GRAPH_STACKED_AREA:
|
case CUSTOM_GRAPH_STACKED_AREA:
|
||||||
|
@ -3603,6 +3603,7 @@ function reporting_prediction_date($report, $content) {
|
|||||||
function reporting_projection_graph($report, $content,
|
function reporting_projection_graph($report, $content,
|
||||||
$type = 'dinamic', $force_width_chart = null,
|
$type = 'dinamic', $force_width_chart = null,
|
||||||
$force_height_chart = null) {
|
$force_height_chart = null) {
|
||||||
|
html_debug_print('esta en esta');
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -6394,7 +6395,7 @@ function reporting_general($report, $content) {
|
|||||||
|
|
||||||
function reporting_custom_graph($report, $content, $type = 'dinamic',
|
function reporting_custom_graph($report, $content, $type = 'dinamic',
|
||||||
$force_width_chart = null, $force_height_chart = null, $type_report = "custom_graph") {
|
$force_width_chart = null, $force_height_chart = null, $type_report = "custom_graph") {
|
||||||
|
html_debug_print('esta en esta 2');
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
require_once ($config["homedir"] . '/include/functions_graph.php');
|
require_once ($config["homedir"] . '/include/functions_graph.php');
|
||||||
|
@ -855,19 +855,19 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
function adjust_menu(graph_id, plot, parent_height, width) {
|
function adjust_menu(graph_id, plot, parent_height, width) {
|
||||||
/*
|
|
||||||
if ($('#'+graph_id+' .xAxis .tickLabel').eq(0).css('width') != undefined) {
|
if ($('#'+graph_id+' .xAxis .tickLabel').eq(0).css('width') != undefined) {
|
||||||
left_ticks_width = $('#'+graph_id+' .xAxis .tickLabel').eq(0).css('width').split('px')[0];
|
left_ticks_width = $('#'+graph_id+' .xAxis .tickLabel').eq(0).css('width').split('px')[0];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
left_ticks_width = 0;
|
left_ticks_width = 0;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
var parent_height_new = 0;
|
var parent_height_new = 0;
|
||||||
|
|
||||||
var legend_height = parseInt($('#legend_'+graph_id).css('height').split('px')[0]) + parseInt($('#legend_'+graph_id).css('margin-top').split('px')[0]);
|
var legend_height = parseInt($('#legend_'+graph_id).css('height').split('px')[0]) + parseInt($('#legend_'+graph_id).css('margin-top').split('px')[0]);
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
if ($('#overview_'+graph_id).css('display') == 'none') {
|
if ($('#overview_'+graph_id).css('display') == 'none') {
|
||||||
overview_height = 0;
|
overview_height = 0;
|
||||||
@ -876,6 +876,7 @@ function adjust_menu(graph_id, plot, parent_height, width) {
|
|||||||
overview_height = parseInt($('#overview_'+graph_id).css('height').split('px')[0]) + parseInt($('#overview_'+graph_id).css('margin-top').split('px')[0]);
|
overview_height = parseInt($('#overview_'+graph_id).css('height').split('px')[0]) + parseInt($('#overview_'+graph_id).css('margin-top').split('px')[0]);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
var menu_height = '25';
|
var menu_height = '25';
|
||||||
|
|
||||||
if ($('#menu_'+graph_id).height() != undefined && $('#menu_'+graph_id).height() > 20) {
|
if ($('#menu_'+graph_id).height() != undefined && $('#menu_'+graph_id).height() > 20) {
|
||||||
@ -893,7 +894,10 @@ function adjust_menu(graph_id, plot, parent_height, width) {
|
|||||||
$('#menu_' + graph_id).show();
|
$('#menu_' + graph_id).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function set_watermark(graph_id, plot, watermark_src) {
|
function set_watermark(graph_id, plot, watermark_src) {
|
||||||
|
console.log('entra setmark');
|
||||||
var img = new Image();
|
var img = new Image();
|
||||||
img.src = watermark_src;
|
img.src = watermark_src;
|
||||||
var context = plot.getCanvas().getContext('2d');
|
var context = plot.getCanvas().getContext('2d');
|
||||||
@ -1064,6 +1068,7 @@ function axis_thresholded (threshold_data, y_min, y_max, red_threshold, extremes
|
|||||||
}
|
}
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_threshold (data_base, threshold_data, y_min, y_max,
|
function add_threshold (data_base, threshold_data, y_min, y_max,
|
||||||
red_threshold, extremes, red_up) {
|
red_threshold, extremes, red_up) {
|
||||||
|
|
||||||
@ -1117,7 +1122,7 @@ function reduceText (text, maxLength) {
|
|||||||
var str_cut = text.substr(0, firstSlideEnd);
|
var str_cut = text.substr(0, firstSlideEnd);
|
||||||
return str_cut + '...' + text.substr(-firstSlideEnd - 3);
|
return str_cut + '...' + text.substr(-firstSlideEnd - 3);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
function pandoraFlotArea(
|
function pandoraFlotArea(
|
||||||
graph_id, values, legend, agent_module_id,
|
graph_id, values, legend, agent_module_id,
|
||||||
series_type, watermark, date_array,
|
series_type, watermark, date_array,
|
||||||
@ -2300,12 +2305,15 @@ function pandoraFlotArea(
|
|||||||
if (menu) {
|
if (menu) {
|
||||||
var parent_height;
|
var parent_height;
|
||||||
$('#menu_overview_' + graph_id).click(function() {
|
$('#menu_overview_' + graph_id).click(function() {
|
||||||
|
$('#overview_' + graph_id).toggle();
|
||||||
|
/*
|
||||||
if($('#overview_' + graph_id).css('visibility') == 'visible'){
|
if($('#overview_' + graph_id).css('visibility') == 'visible'){
|
||||||
$('#overview_' + graph_id).css('visibility', 'hidden');
|
$('#overview_' + graph_id).css('visibility', 'hidden');
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$('#overview_' + graph_id).css('visibility', 'visible');
|
$('#overview_' + graph_id).css('visibility', 'visible');
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#menu_export_csv_"+graph_id)
|
$("#menu_export_csv_"+graph_id)
|
||||||
@ -2427,6 +2435,7 @@ function adjust_menu(graph_id, plot, parent_height, width) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function set_watermark(graph_id, plot, watermark_src) {
|
function set_watermark(graph_id, plot, watermark_src) {
|
||||||
|
console.log('entra por la watermark');
|
||||||
var img = new Image();
|
var img = new Image();
|
||||||
img.src = watermark_src;
|
img.src = watermark_src;
|
||||||
var context = plot.getCanvas().getContext('2d');
|
var context = plot.getCanvas().getContext('2d');
|
||||||
@ -2482,16 +2491,22 @@ function get_event_details (event_ids) {
|
|||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//XXXXXXXXXX
|
||||||
|
//Ajusta la grafica pequenña con el desplazamiento del eje y
|
||||||
|
|
||||||
function adjust_left_width_canvas(adapter_id, adapted_id) {
|
function adjust_left_width_canvas(adapter_id, adapted_id) {
|
||||||
var adapter_left_margin = $('#'+adapter_id+' .yAxis .tickLabel').width();
|
var adapter_left_margin = $('#'+adapter_id+' .yAxis .tickLabel').width();
|
||||||
var adapted_pix = $('#'+adapted_id).width();
|
var adapted_pix = $('#'+adapted_id).width();
|
||||||
|
|
||||||
var new_adapted_width = adapted_pix - adapter_left_margin;
|
var new_adapted_width = adapted_pix - adapter_left_margin;
|
||||||
|
|
||||||
$('#'+adapted_id).width(new_adapted_width);
|
$('#'+adapted_id).width(new_adapted_width);
|
||||||
$('#'+adapted_id).css('margin-left', adapter_left_margin);
|
$('#'+adapted_id).css('margin-left', adapter_left_margin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//XXXXXXXXXXX
|
||||||
|
//Ajusta el ancho de la grafica pequeña con respecto a la grande
|
||||||
|
|
||||||
function update_left_width_canvas(graph_id) {
|
function update_left_width_canvas(graph_id) {
|
||||||
$('#overview_'+graph_id).width($('#'+graph_id).width());
|
$('#overview_'+graph_id).width($('#'+graph_id).width());
|
||||||
$('#overview_'+graph_id).css('margin-left', $('#'+graph_id+' .yAxis .tickLabel').width());
|
$('#overview_'+graph_id).css('margin-left', $('#'+graph_id+' .yAxis .tickLabel').width());
|
||||||
|
@ -247,10 +247,10 @@ function flot_area_graph (
|
|||||||
if($format_graph['type'] == 'area_simple'){
|
if($format_graph['type'] == 'area_simple'){
|
||||||
$return .= "noresizevc ";
|
$return .= "noresizevc ";
|
||||||
}
|
}
|
||||||
|
//XXXXXX height: ".$format_graph['height']."px;'
|
||||||
$return .= "graph" .$format_graph['adapt_key'] ."'
|
$return .= "graph" .$format_graph['adapt_key'] ."'
|
||||||
style=' width: ".$format_graph['width']."px;
|
style=' width: ".$format_graph['width']."px;
|
||||||
height: ".$format_graph['height']."px;'></div>";
|
height: 400px;'></div>";
|
||||||
|
|
||||||
if ($show_elements_graph['menu']) {
|
if ($show_elements_graph['menu']) {
|
||||||
$format_graph['height'] = 100;
|
$format_graph['height'] = 100;
|
||||||
@ -262,10 +262,7 @@ function flot_area_graph (
|
|||||||
if (!$vconsole){
|
if (!$vconsole){
|
||||||
$return .= "<div id='overview_$graph_id'
|
$return .= "<div id='overview_$graph_id'
|
||||||
class='overview_graph'
|
class='overview_graph'
|
||||||
style=' margin:0px; margin-top:30px; margin-bottom:50px;
|
style='margin:0px; margin-top:30px; margin-bottom:50px; display:none; width: ".$format_graph['width']."; height: 200px;'></div>";
|
||||||
visibility:hidden;
|
|
||||||
width: ".$format_graph['width'].";
|
|
||||||
height: 200px;'></div>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//XXXXTODO
|
//XXXXTODO
|
||||||
|
@ -55,11 +55,11 @@ if (file_exists ('../../include/languages/'.$user_language.'.mo')) {
|
|||||||
|
|
||||||
echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/css"/>';
|
echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/css"/>';
|
||||||
|
|
||||||
$label = get_parameter('label');
|
$label = get_parameter('label');
|
||||||
$label = base64_decode($label);
|
$label = base64_decode($label);
|
||||||
$id = get_parameter('id');
|
$id = get_parameter('id');
|
||||||
$id_agent = db_get_value ("id_agente","tagente_modulo","id_agente_modulo",$id);
|
$id_agent = db_get_value ("id_agente","tagente_modulo","id_agente_modulo",$id);
|
||||||
$alias = db_get_value ("alias","tagente","id_agente",$id_agent);
|
$alias = db_get_value ("alias","tagente","id_agente",$id_agent);
|
||||||
//$agent = agents_get_agent_with_ip ("192.168.50.31");
|
//$agent = agents_get_agent_with_ip ("192.168.50.31");
|
||||||
//$label = rawurldecode(urldecode(base64_decode(get_parameter('label', ''))));
|
//$label = rawurldecode(urldecode(base64_decode(get_parameter('label', ''))));
|
||||||
?>
|
?>
|
||||||
@ -121,7 +121,7 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent);
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ACL
|
// ACL
|
||||||
$permission = false;
|
$permission = false;
|
||||||
$agent_group = (int) agents_get_agent_group($agent_id);
|
$agent_group = (int) agents_get_agent_group($agent_id);
|
||||||
$strict_user = (bool) db_get_value("strict_acl", "tusuario",
|
$strict_user = (bool) db_get_value("strict_acl", "tusuario",
|
||||||
"id_user", $config['id_user']);
|
"id_user", $config['id_user']);
|
||||||
@ -153,14 +153,13 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent);
|
|||||||
}
|
}
|
||||||
|
|
||||||
$period = get_parameter ("period");
|
$period = get_parameter ("period");
|
||||||
$id = get_parameter ("id", 0);
|
$id = get_parameter ("id", 0);
|
||||||
|
|
||||||
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||||
/*
|
/*
|
||||||
$width = get_parameter ("width", STATWIN_DEFAULT_CHART_WIDTH);
|
$width = get_parameter ("width", STATWIN_DEFAULT_CHART_WIDTH);
|
||||||
$height = get_parameter ("height", STATWIN_DEFAULT_CHART_HEIGHT);
|
$height = get_parameter ("height", STATWIN_DEFAULT_CHART_HEIGHT);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$label = get_parameter ("label", "");
|
$label = get_parameter ("label", "");
|
||||||
$label_graph = base64_decode(get_parameter ("label", ""));
|
$label_graph = base64_decode(get_parameter ("label", ""));
|
||||||
@ -212,7 +211,6 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent);
|
|||||||
$height = $height * ($zoom / 2.1);
|
$height = $height * ($zoom / 2.1);
|
||||||
$width = $width * ($zoom / 1.4);
|
$width = $width * ($zoom / 1.4);
|
||||||
}
|
}
|
||||||
echo "<script type='text/javascript'>window.resizeTo($width + 190, $height + 260);</script>";
|
|
||||||
|
|
||||||
// Build date
|
// Build date
|
||||||
$date = strtotime("$start_date $start_time");
|
$date = strtotime("$start_date $start_time");
|
||||||
@ -480,37 +478,6 @@ ui_include_time_picker(true);
|
|||||||
$('#checkbox-time_compare_separated').removeAttr('checked');
|
$('#checkbox-time_compare_separated').removeAttr('checked');
|
||||||
});
|
});
|
||||||
|
|
||||||
<?php
|
|
||||||
//Resize window when show the overview graph.
|
|
||||||
if ($config['flash_charts']) {
|
|
||||||
?>
|
|
||||||
var show_overview = false;
|
|
||||||
var height_window;
|
|
||||||
var width_window;
|
|
||||||
|
|
||||||
$(window).ready(function() {
|
|
||||||
height_window = window.innerHeight;
|
|
||||||
width_window = window.innerWidth;
|
|
||||||
});
|
|
||||||
|
|
||||||
$("*").filter(function() {
|
|
||||||
if (typeof(this.id) == "string")
|
|
||||||
return this.id.match(/menu_overview_graph.*/);
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}).click(function() {
|
|
||||||
if (show_overview) {
|
|
||||||
window.resizeTo(width_window, height_window);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
window.resizeTo(width_window, height_window + 150);
|
|
||||||
}
|
|
||||||
show_overview = !show_overview;
|
|
||||||
});
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
// Add datepicker and timepicker
|
// Add datepicker and timepicker
|
||||||
$("#text-start_date").datepicker({
|
$("#text-start_date").datepicker({
|
||||||
dateFormat: "<?php echo DATE_FORMAT_JS; ?>"
|
dateFormat: "<?php echo DATE_FORMAT_JS; ?>"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user