Some fixed for the enterprise PDF reports.
This commit is contained in:
parent
e005a352ab
commit
fadeaef80a
|
@ -1557,6 +1557,17 @@ function reporting_exception($report, $content, $type = 'dinamic',
|
|||
$content['name'] = __('Exception');
|
||||
}
|
||||
|
||||
$order_uptodown = $content['order_uptodown'];
|
||||
$exception_condition_value = $content['exception_condition_value'];
|
||||
$show_graph = $content['show_graph'];
|
||||
|
||||
$formated_exception_value = $exception_condition_value;
|
||||
if (is_numeric($exception_condition_value)) {
|
||||
$formated_exception_value = format_for_graph(
|
||||
$exception_condition_value, 2);
|
||||
}
|
||||
|
||||
|
||||
$return['title'] = $content['name'];
|
||||
$exception_condition = $content['exception_condition'];
|
||||
switch ($exception_condition) {
|
||||
|
@ -1566,32 +1577,32 @@ function reporting_exception($report, $content, $type = 'dinamic',
|
|||
case REPORT_EXCEPTION_CONDITION_GE:
|
||||
$return['subtitle'] =
|
||||
sprintf(__('Exception - Modules over or equal to %s'),
|
||||
$exception_condition_value);
|
||||
$formated_exception_value);
|
||||
break;
|
||||
case REPORT_EXCEPTION_CONDITION_LE:
|
||||
$return['subtitle'] =
|
||||
sprintf(__('Exception - Modules under or equal to %s'),
|
||||
$exception_condition_value);
|
||||
$formated_exception_value);
|
||||
break;
|
||||
case REPORT_EXCEPTION_CONDITION_L:
|
||||
$return['subtitle'] =
|
||||
sprintf(__('Exception - Modules under %s'),
|
||||
$exception_condition_value);
|
||||
$formated_exception_value);
|
||||
break;
|
||||
case REPORT_EXCEPTION_CONDITION_G:
|
||||
$return['subtitle'] =
|
||||
sprintf(__('Exception - Modules over %s'),
|
||||
$exception_condition_value);
|
||||
$formated_exception_value);
|
||||
break;
|
||||
case REPORT_EXCEPTION_CONDITION_E:
|
||||
$return['subtitle'] =
|
||||
sprintf(__('Exception - Equal to %s'),
|
||||
$exception_condition_value);
|
||||
$formated_exception_value);
|
||||
break;
|
||||
case REPORT_EXCEPTION_CONDITION_NE:
|
||||
$return['subtitle'] =
|
||||
sprintf(__('Exception - Not equal to %s'),
|
||||
$exception_condition_value);
|
||||
$formated_exception_value);
|
||||
break;
|
||||
case REPORT_EXCEPTION_CONDITION_OK:
|
||||
$return['subtitle'] =
|
||||
|
@ -1609,9 +1620,7 @@ function reporting_exception($report, $content, $type = 'dinamic',
|
|||
$return["chart"] = array();
|
||||
$return["resume"] = array();
|
||||
|
||||
$order_uptodown = $content['order_uptodown'];
|
||||
$exception_condition_value = $content['exception_condition_value'];
|
||||
$show_graph = $content['show_graph'];
|
||||
|
||||
|
||||
//Get all the related data
|
||||
$sql = sprintf("
|
||||
|
@ -1885,16 +1894,34 @@ function reporting_exception($report, $content, $type = 'dinamic',
|
|||
}
|
||||
|
||||
|
||||
$return["chart"]["pie"] = pie3d_graph(false, $data_pie_graph,
|
||||
600, 150, __("other"),
|
||||
$return["chart"]["pie"] = pie3d_graph(
|
||||
false,
|
||||
$data_pie_graph,
|
||||
600,
|
||||
150,
|
||||
__("other"),
|
||||
ui_get_full_url(false, false, false, false),
|
||||
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
|
||||
$config['fontpath'], $config['font_size']);
|
||||
$return["chart"]["hbar"] = hbar_graph(false,
|
||||
$data_hbar, 600, $height,
|
||||
array(), array(), "", "", true,
|
||||
$config['fontpath'],
|
||||
$config['font_size'],
|
||||
$ttl);
|
||||
$return["chart"]["hbar"] = hbar_graph(
|
||||
false,
|
||||
$data_hbar,
|
||||
600,
|
||||
100,
|
||||
array(),
|
||||
array(),
|
||||
"",
|
||||
"",
|
||||
true,
|
||||
ui_get_full_url(false, false, false, false),
|
||||
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png", '', '', true, 1, true);
|
||||
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
$ttl,
|
||||
true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -6416,4 +6443,262 @@ function reporting_get_count_events_by_agent ($id_group, $period = 0,
|
|||
$filter_event_warning, $filter_event_no_validated,
|
||||
$filter_event_filter_search);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum value of an agent module in a period of time.
|
||||
*
|
||||
* @param int Agent module id to get the maximum value.
|
||||
* @param int Period of time to check (in seconds)
|
||||
* @param int Top date to check the values. Default current time.
|
||||
*
|
||||
* @return float The maximum module value in the interval.
|
||||
*/
|
||||
function reporting_get_agentmodule_data_max ($id_agent_module, $period=0, $date = 0) {
|
||||
global $config;
|
||||
|
||||
// Initialize variables
|
||||
if (empty ($date)) $date = get_system_time ();
|
||||
$datelimit = $date - $period;
|
||||
|
||||
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||
|
||||
$id_module_type = modules_get_agentmodule_type ($id_agent_module);
|
||||
$module_type = modules_get_moduletype_name ($id_module_type);
|
||||
$uncompressed_module = is_module_uncompressed ($module_type);
|
||||
|
||||
// Get module data
|
||||
$interval_data = db_get_all_rows_sql ('SELECT *
|
||||
FROM tagente_datos
|
||||
WHERE id_agente_modulo = ' . (int) $id_agent_module .
|
||||
' AND utimestamp > ' . (int) $datelimit .
|
||||
' AND utimestamp < ' . (int) $date .
|
||||
' ORDER BY utimestamp ASC', $search_in_history_db);
|
||||
if ($interval_data === false) $interval_data = array ();
|
||||
|
||||
// Uncompressed module data
|
||||
if ($uncompressed_module) {
|
||||
|
||||
// Compressed module data
|
||||
}
|
||||
else {
|
||||
// Get previous data
|
||||
$previous_data = modules_get_previous_data ($id_agent_module, $datelimit);
|
||||
if ($previous_data !== false) {
|
||||
$previous_data['utimestamp'] = $datelimit;
|
||||
array_unshift ($interval_data, $previous_data);
|
||||
}
|
||||
|
||||
// Get next data
|
||||
$next_data = modules_get_next_data ($id_agent_module, $date);
|
||||
if ($next_data !== false) {
|
||||
$next_data['utimestamp'] = $date;
|
||||
array_push ($interval_data, $next_data);
|
||||
}
|
||||
else if (count ($interval_data) > 0) {
|
||||
// Propagate the last known data to the end of the interval
|
||||
$next_data = array_pop ($interval_data);
|
||||
array_push ($interval_data, $next_data);
|
||||
$next_data['utimestamp'] = $date;
|
||||
array_push ($interval_data, $next_data);
|
||||
}
|
||||
}
|
||||
|
||||
// Set initial conditions
|
||||
if (empty($iterval_data)) {
|
||||
$max = 0;
|
||||
}
|
||||
else {
|
||||
if ($uncompressed_module || $interval_data[0]['utimestamp'] == $datelimit) {
|
||||
$max = $interval_data[0]['datos'];
|
||||
}
|
||||
else {
|
||||
$max = 0;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($interval_data as $data) {
|
||||
if ($data['datos'] > $max) {
|
||||
$max = $data['datos'];
|
||||
}
|
||||
}
|
||||
|
||||
return $max;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the minimum value of an agent module in a period of time.
|
||||
*
|
||||
* @param int Agent module id to get the minimum value.
|
||||
* @param int Period of time to check (in seconds)
|
||||
* @param int Top date to check the values in Unix time. Default current time.
|
||||
*
|
||||
* @return float The minimum module value of the module
|
||||
*/
|
||||
function reporting_get_agentmodule_data_min ($id_agent_module, $period=0, $date = 0) {
|
||||
global $config;
|
||||
|
||||
// Initialize variables
|
||||
if (empty ($date)) $date = get_system_time ();
|
||||
$datelimit = $date - $period;
|
||||
|
||||
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||
|
||||
$id_module_type = modules_get_agentmodule_type ($id_agent_module);
|
||||
$module_type = modules_get_moduletype_name ($id_module_type);
|
||||
$uncompressed_module = is_module_uncompressed ($module_type);
|
||||
|
||||
// Get module data
|
||||
$interval_data = db_get_all_rows_sql ('SELECT *
|
||||
FROM tagente_datos
|
||||
WHERE id_agente_modulo = ' . (int) $id_agent_module .
|
||||
' AND utimestamp > ' . (int) $datelimit .
|
||||
' AND utimestamp < ' . (int) $date .
|
||||
' ORDER BY utimestamp ASC', $search_in_history_db);
|
||||
if ($interval_data === false) $interval_data = array ();
|
||||
|
||||
// Uncompressed module data
|
||||
if ($uncompressed_module) {
|
||||
$min_necessary = 1;
|
||||
|
||||
// Compressed module data
|
||||
}
|
||||
else {
|
||||
// Get previous data
|
||||
$previous_data = modules_get_previous_data ($id_agent_module, $datelimit);
|
||||
if ($previous_data !== false) {
|
||||
$previous_data['utimestamp'] = $datelimit;
|
||||
array_unshift ($interval_data, $previous_data);
|
||||
}
|
||||
|
||||
// Get next data
|
||||
$next_data = modules_get_next_data ($id_agent_module, $date);
|
||||
if ($next_data !== false) {
|
||||
$next_data['utimestamp'] = $date;
|
||||
array_push ($interval_data, $next_data);
|
||||
}
|
||||
else if (count ($interval_data) > 0) {
|
||||
// Propagate the last known data to the end of the interval
|
||||
$next_data = array_pop ($interval_data);
|
||||
array_push ($interval_data, $next_data);
|
||||
$next_data['utimestamp'] = $date;
|
||||
array_push ($interval_data, $next_data);
|
||||
}
|
||||
}
|
||||
|
||||
if (count ($interval_data) < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set initial conditions
|
||||
$min = $interval_data[0]['datos'];
|
||||
|
||||
foreach ($interval_data as $data) {
|
||||
if ($data['datos'] < $min) {
|
||||
$min = $data['datos'];
|
||||
}
|
||||
}
|
||||
|
||||
return $min;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the sum of values of an agent module in a period of time.
|
||||
*
|
||||
* @param int Agent module id to get the sumatory.
|
||||
* @param int Period of time to check (in seconds)
|
||||
* @param int Top date to check the values. Default current time.
|
||||
*
|
||||
* @return float The sumatory of the module values in the interval.
|
||||
*/
|
||||
function reporting_get_agentmodule_data_sum ($id_agent_module,
|
||||
$period = 0, $date = 0) {
|
||||
|
||||
global $config;
|
||||
|
||||
// Initialize variables
|
||||
if (empty ($date)) $date = get_system_time ();
|
||||
$datelimit = $date - $period;
|
||||
|
||||
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||
|
||||
$id_module_type = db_get_value ('id_tipo_modulo', 'tagente_modulo',
|
||||
'id_agente_modulo', $id_agent_module);
|
||||
$module_name = db_get_value ('nombre', 'ttipo_modulo', 'id_tipo',
|
||||
$id_module_type);
|
||||
$module_interval = modules_get_interval ($id_agent_module);
|
||||
$uncompressed_module = is_module_uncompressed ($module_name);
|
||||
|
||||
// Wrong module type
|
||||
if (is_module_data_string ($module_name)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Incremental modules are treated differently
|
||||
$module_inc = is_module_inc ($module_name);
|
||||
|
||||
// Get module data
|
||||
$interval_data = db_get_all_rows_sql('
|
||||
SELECT * FROM tagente_datos
|
||||
WHERE id_agente_modulo = ' . (int) $id_agent_module . '
|
||||
AND utimestamp > ' . (int) $datelimit . '
|
||||
AND utimestamp < ' . (int) $date . '
|
||||
ORDER BY utimestamp ASC', $search_in_history_db);
|
||||
if ($interval_data === false) $interval_data = array ();
|
||||
|
||||
// Uncompressed module data
|
||||
if ($uncompressed_module) {
|
||||
$min_necessary = 1;
|
||||
|
||||
// Compressed module data
|
||||
}
|
||||
else {
|
||||
// Get previous data
|
||||
$previous_data = modules_get_previous_data ($id_agent_module, $datelimit);
|
||||
if ($previous_data !== false) {
|
||||
$previous_data['utimestamp'] = $datelimit;
|
||||
array_unshift ($interval_data, $previous_data);
|
||||
}
|
||||
|
||||
// Get next data
|
||||
$next_data = modules_get_next_data ($id_agent_module, $date);
|
||||
if ($next_data !== false) {
|
||||
$next_data['utimestamp'] = $date;
|
||||
array_push ($interval_data, $next_data);
|
||||
}
|
||||
else if (count ($interval_data) > 0) {
|
||||
// Propagate the last known data to the end of the interval
|
||||
$next_data = array_pop ($interval_data);
|
||||
array_push ($interval_data, $next_data);
|
||||
$next_data['utimestamp'] = $date;
|
||||
array_push ($interval_data, $next_data);
|
||||
}
|
||||
|
||||
$min_necessary = 2;
|
||||
}
|
||||
|
||||
if (count ($interval_data) < $min_necessary) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set initial conditions
|
||||
$total = 0;
|
||||
if (! $uncompressed_module) {
|
||||
$previous_data = array_shift ($interval_data);
|
||||
}
|
||||
|
||||
foreach ($interval_data as $data) {
|
||||
if ($uncompressed_module) {
|
||||
$total += $data['datos'];
|
||||
}
|
||||
else if ($module_inc) {
|
||||
$total += $previous_data['datos'] * ($data['utimestamp'] - $previous_data['utimestamp']);
|
||||
}
|
||||
else {
|
||||
$total += $previous_data['datos'] * ($data['utimestamp'] - $previous_data['utimestamp']) / $module_interval;
|
||||
}
|
||||
$previous_data = $data;
|
||||
}
|
||||
|
||||
return $total;
|
||||
}
|
||||
?>
|
|
@ -1816,263 +1816,11 @@ function reporting_html_sql(&$table, $item) {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the maximum value of an agent module in a period of time.
|
||||
*
|
||||
* @param int Agent module id to get the maximum value.
|
||||
* @param int Period of time to check (in seconds)
|
||||
* @param int Top date to check the values. Default current time.
|
||||
*
|
||||
* @return float The maximum module value in the interval.
|
||||
*/
|
||||
function reporting_get_agentmodule_data_max ($id_agent_module, $period=0, $date = 0) {
|
||||
global $config;
|
||||
|
||||
// Initialize variables
|
||||
if (empty ($date)) $date = get_system_time ();
|
||||
$datelimit = $date - $period;
|
||||
|
||||
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||
|
||||
$id_module_type = modules_get_agentmodule_type ($id_agent_module);
|
||||
$module_type = modules_get_moduletype_name ($id_module_type);
|
||||
$uncompressed_module = is_module_uncompressed ($module_type);
|
||||
|
||||
// Get module data
|
||||
$interval_data = db_get_all_rows_sql ('SELECT *
|
||||
FROM tagente_datos
|
||||
WHERE id_agente_modulo = ' . (int) $id_agent_module .
|
||||
' AND utimestamp > ' . (int) $datelimit .
|
||||
' AND utimestamp < ' . (int) $date .
|
||||
' ORDER BY utimestamp ASC', $search_in_history_db);
|
||||
if ($interval_data === false) $interval_data = array ();
|
||||
|
||||
// Uncompressed module data
|
||||
if ($uncompressed_module) {
|
||||
|
||||
// Compressed module data
|
||||
}
|
||||
else {
|
||||
// Get previous data
|
||||
$previous_data = modules_get_previous_data ($id_agent_module, $datelimit);
|
||||
if ($previous_data !== false) {
|
||||
$previous_data['utimestamp'] = $datelimit;
|
||||
array_unshift ($interval_data, $previous_data);
|
||||
}
|
||||
|
||||
// Get next data
|
||||
$next_data = modules_get_next_data ($id_agent_module, $date);
|
||||
if ($next_data !== false) {
|
||||
$next_data['utimestamp'] = $date;
|
||||
array_push ($interval_data, $next_data);
|
||||
}
|
||||
else if (count ($interval_data) > 0) {
|
||||
// Propagate the last known data to the end of the interval
|
||||
$next_data = array_pop ($interval_data);
|
||||
array_push ($interval_data, $next_data);
|
||||
$next_data['utimestamp'] = $date;
|
||||
array_push ($interval_data, $next_data);
|
||||
}
|
||||
}
|
||||
|
||||
// Set initial conditions
|
||||
if (empty($iterval_data)) {
|
||||
$max = 0;
|
||||
}
|
||||
else {
|
||||
if ($uncompressed_module || $interval_data[0]['utimestamp'] == $datelimit) {
|
||||
$max = $interval_data[0]['datos'];
|
||||
}
|
||||
else {
|
||||
$max = 0;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($interval_data as $data) {
|
||||
if ($data['datos'] > $max) {
|
||||
$max = $data['datos'];
|
||||
}
|
||||
}
|
||||
|
||||
return $max;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the minimum value of an agent module in a period of time.
|
||||
*
|
||||
* @param int Agent module id to get the minimum value.
|
||||
* @param int Period of time to check (in seconds)
|
||||
* @param int Top date to check the values in Unix time. Default current time.
|
||||
*
|
||||
* @return float The minimum module value of the module
|
||||
*/
|
||||
function reporting_get_agentmodule_data_min ($id_agent_module, $period=0, $date = 0) {
|
||||
global $config;
|
||||
|
||||
// Initialize variables
|
||||
if (empty ($date)) $date = get_system_time ();
|
||||
$datelimit = $date - $period;
|
||||
|
||||
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||
|
||||
$id_module_type = modules_get_agentmodule_type ($id_agent_module);
|
||||
$module_type = modules_get_moduletype_name ($id_module_type);
|
||||
$uncompressed_module = is_module_uncompressed ($module_type);
|
||||
|
||||
// Get module data
|
||||
$interval_data = db_get_all_rows_sql ('SELECT *
|
||||
FROM tagente_datos
|
||||
WHERE id_agente_modulo = ' . (int) $id_agent_module .
|
||||
' AND utimestamp > ' . (int) $datelimit .
|
||||
' AND utimestamp < ' . (int) $date .
|
||||
' ORDER BY utimestamp ASC', $search_in_history_db);
|
||||
if ($interval_data === false) $interval_data = array ();
|
||||
|
||||
// Uncompressed module data
|
||||
if ($uncompressed_module) {
|
||||
$min_necessary = 1;
|
||||
|
||||
// Compressed module data
|
||||
}
|
||||
else {
|
||||
// Get previous data
|
||||
$previous_data = modules_get_previous_data ($id_agent_module, $datelimit);
|
||||
if ($previous_data !== false) {
|
||||
$previous_data['utimestamp'] = $datelimit;
|
||||
array_unshift ($interval_data, $previous_data);
|
||||
}
|
||||
|
||||
// Get next data
|
||||
$next_data = modules_get_next_data ($id_agent_module, $date);
|
||||
if ($next_data !== false) {
|
||||
$next_data['utimestamp'] = $date;
|
||||
array_push ($interval_data, $next_data);
|
||||
}
|
||||
else if (count ($interval_data) > 0) {
|
||||
// Propagate the last known data to the end of the interval
|
||||
$next_data = array_pop ($interval_data);
|
||||
array_push ($interval_data, $next_data);
|
||||
$next_data['utimestamp'] = $date;
|
||||
array_push ($interval_data, $next_data);
|
||||
}
|
||||
}
|
||||
|
||||
if (count ($interval_data) < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set initial conditions
|
||||
$min = $interval_data[0]['datos'];
|
||||
|
||||
foreach ($interval_data as $data) {
|
||||
if ($data['datos'] < $min) {
|
||||
$min = $data['datos'];
|
||||
}
|
||||
}
|
||||
|
||||
return $min;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the sum of values of an agent module in a period of time.
|
||||
*
|
||||
* @param int Agent module id to get the sumatory.
|
||||
* @param int Period of time to check (in seconds)
|
||||
* @param int Top date to check the values. Default current time.
|
||||
*
|
||||
* @return float The sumatory of the module values in the interval.
|
||||
*/
|
||||
function reporting_get_agentmodule_data_sum ($id_agent_module,
|
||||
$period = 0, $date = 0) {
|
||||
|
||||
global $config;
|
||||
|
||||
// Initialize variables
|
||||
if (empty ($date)) $date = get_system_time ();
|
||||
$datelimit = $date - $period;
|
||||
|
||||
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||
|
||||
$id_module_type = db_get_value ('id_tipo_modulo', 'tagente_modulo',
|
||||
'id_agente_modulo', $id_agent_module);
|
||||
$module_name = db_get_value ('nombre', 'ttipo_modulo', 'id_tipo',
|
||||
$id_module_type);
|
||||
$module_interval = modules_get_interval ($id_agent_module);
|
||||
$uncompressed_module = is_module_uncompressed ($module_name);
|
||||
|
||||
// Wrong module type
|
||||
if (is_module_data_string ($module_name)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Incremental modules are treated differently
|
||||
$module_inc = is_module_inc ($module_name);
|
||||
|
||||
// Get module data
|
||||
$interval_data = db_get_all_rows_sql('
|
||||
SELECT * FROM tagente_datos
|
||||
WHERE id_agente_modulo = ' . (int) $id_agent_module . '
|
||||
AND utimestamp > ' . (int) $datelimit . '
|
||||
AND utimestamp < ' . (int) $date . '
|
||||
ORDER BY utimestamp ASC', $search_in_history_db);
|
||||
if ($interval_data === false) $interval_data = array ();
|
||||
|
||||
// Uncompressed module data
|
||||
if ($uncompressed_module) {
|
||||
$min_necessary = 1;
|
||||
|
||||
// Compressed module data
|
||||
}
|
||||
else {
|
||||
// Get previous data
|
||||
$previous_data = modules_get_previous_data ($id_agent_module, $datelimit);
|
||||
if ($previous_data !== false) {
|
||||
$previous_data['utimestamp'] = $datelimit;
|
||||
array_unshift ($interval_data, $previous_data);
|
||||
}
|
||||
|
||||
// Get next data
|
||||
$next_data = modules_get_next_data ($id_agent_module, $date);
|
||||
if ($next_data !== false) {
|
||||
$next_data['utimestamp'] = $date;
|
||||
array_push ($interval_data, $next_data);
|
||||
}
|
||||
else if (count ($interval_data) > 0) {
|
||||
// Propagate the last known data to the end of the interval
|
||||
$next_data = array_pop ($interval_data);
|
||||
array_push ($interval_data, $next_data);
|
||||
$next_data['utimestamp'] = $date;
|
||||
array_push ($interval_data, $next_data);
|
||||
}
|
||||
|
||||
$min_necessary = 2;
|
||||
}
|
||||
|
||||
if (count ($interval_data) < $min_necessary) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set initial conditions
|
||||
$total = 0;
|
||||
if (! $uncompressed_module) {
|
||||
$previous_data = array_shift ($interval_data);
|
||||
}
|
||||
|
||||
foreach ($interval_data as $data) {
|
||||
if ($uncompressed_module) {
|
||||
$total += $data['datos'];
|
||||
}
|
||||
else if ($module_inc) {
|
||||
$total += $previous_data['datos'] * ($data['utimestamp'] - $previous_data['utimestamp']);
|
||||
}
|
||||
else {
|
||||
$total += $previous_data['datos'] * ($data['utimestamp'] - $previous_data['utimestamp']) / $module_interval;
|
||||
}
|
||||
$previous_data = $data;
|
||||
}
|
||||
|
||||
return $total;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get SLA of a module.
|
||||
|
|
Loading…
Reference in New Issue