mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
Revert "Added a function to remove right zeros in precision data feature"
This reverts commit 834a613493e48e973e9cb7b7176c951365f8491e.
This commit is contained in:
parent
2959fe3ce8
commit
c8189b1014
@ -284,7 +284,7 @@ if ($get_module_detail) {
|
|||||||
}
|
}
|
||||||
else if (is_numeric($row[$attr[0]]) && !modules_is_string_type($row['module_type']) ) {
|
else if (is_numeric($row[$attr[0]]) && !modules_is_string_type($row['module_type']) ) {
|
||||||
|
|
||||||
$data[] = remove_right_zeros(number_format($row[$attr[0]], $config['graph_precision']));
|
$data[] = (double) $row[$attr[0]];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($row[$attr[0]] == '') {
|
if ($row[$attr[0]] == '') {
|
||||||
@ -854,6 +854,7 @@ if ($list_modules) {
|
|||||||
modules_get_status($module['id_agente_modulo'], $module['estado'],
|
modules_get_status($module['id_agente_modulo'], $module['estado'],
|
||||||
$module_value, $status, $title);
|
$module_value, $status, $title);
|
||||||
|
|
||||||
|
|
||||||
$data[5] = ui_print_status_image($status, $title, true);
|
$data[5] = ui_print_status_image($status, $title, true);
|
||||||
if (!$show_context_help_first_time) {
|
if (!$show_context_help_first_time) {
|
||||||
$show_context_help_first_time = true;
|
$show_context_help_first_time = true;
|
||||||
@ -863,6 +864,7 @@ if ($list_modules) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($module["id_tipo_modulo"] == 24) {
|
if ($module["id_tipo_modulo"] == 24) {
|
||||||
// log4x
|
// log4x
|
||||||
switch($module["datos"]) {
|
switch($module["datos"]) {
|
||||||
|
@ -344,10 +344,10 @@ switch ($action) {
|
|||||||
|
|
||||||
$return = array();
|
$return = array();
|
||||||
if ($returnValue_value[1] != "") {
|
if ($returnValue_value[1] != "") {
|
||||||
$return['value'] = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision'])) . " " . $returnValue_value[1];
|
$return['value'] = number_format($returnValue_value[0], $config['graph_precision']) . " " . $returnValue_value[1];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$return['value'] = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision']));
|
$return['value'] = number_format($returnValue_value[0], $config['graph_precision']);
|
||||||
}
|
}
|
||||||
$return['max_percentile'] = $layoutData['height'];
|
$return['max_percentile'] = $layoutData['height'];
|
||||||
$return['width_percentile'] = $layoutData['width'];
|
$return['width_percentile'] = $layoutData['width'];
|
||||||
|
@ -2654,9 +2654,4 @@ function pandora_setlocale() {
|
|||||||
setlocale(LC_ALL,
|
setlocale(LC_ALL,
|
||||||
str_replace(array_keys($replace_locale), $replace_locale, $user_language));
|
str_replace(array_keys($replace_locale), $replace_locale, $user_language));
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove_right_zeros ($value) {
|
|
||||||
$value_to_return = rtrim($value, "0");
|
|
||||||
return rtrim($value_to_return, ".");
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
|
@ -21,7 +21,6 @@ include_once($config['homedir'] . "/include/functions_modules.php");
|
|||||||
include_once($config['homedir'] . "/include/functions_users.php");
|
include_once($config['homedir'] . "/include/functions_users.php");
|
||||||
|
|
||||||
function get_graph_statistics ($chart_array) {
|
function get_graph_statistics ($chart_array) {
|
||||||
global $config;
|
|
||||||
|
|
||||||
/// IMPORTANT!
|
/// IMPORTANT!
|
||||||
///
|
///
|
||||||
@ -74,10 +73,10 @@ function get_graph_statistics ($chart_array) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Format stat data to display properly
|
//Format stat data to display properly
|
||||||
$stats['last'] = remove_right_zeros(number_format($stats['last'], $config['graph_precision']));
|
$stats['last'] = round($stats['last'], 2);
|
||||||
$stats['avg'] = remove_right_zeros(number_format($stats['avg'], $config['graph_precision']));
|
$stats['avg'] = round($stats['avg'], 2);
|
||||||
$stats['min'] = remove_right_zeros(number_format($stats['min'], $config['graph_precision']));
|
$stats['min'] = round($stats['min'], 2);
|
||||||
$stats['max'] = remove_right_zeros(number_format($stats['max'], $config['graph_precision']));
|
$stats['max'] = round($stats['max'], 2);
|
||||||
|
|
||||||
return $stats;
|
return $stats;
|
||||||
}
|
}
|
||||||
@ -734,16 +733,16 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
|
|||||||
|
|
||||||
if ($dashboard || $vconsole) {
|
if ($dashboard || $vconsole) {
|
||||||
$legend['sum'.$series_suffix] =
|
$legend['sum'.$series_suffix] =
|
||||||
__('Last') . ': ' . remove_right_zeros(number_format($graph_stats['sum']['last'], $config['graph_precision'])) . ($unit ? ' ' . $unit : '') . ' ; '
|
__('Last') . ': ' . rtrim(number_format($graph_stats['sum']['last'], $config['graph_precision']), '.0') . ($unit ? ' ' . $unit : '') . ' ; '
|
||||||
. __('Avg') . ': ' . remove_right_zeros(number_format($graph_stats['sum']['avg'], $config['graph_precision'])) . ($unit ? ' ' . $unit : '');
|
. __('Avg') . ': ' . rtrim(number_format($graph_stats['sum']['avg'], $config['graph_precision']), '.0') . ($unit ? ' ' . $unit : '');
|
||||||
}
|
}
|
||||||
else if (!$avg_only) {
|
else if (!$avg_only) {
|
||||||
$legend['max'.$series_suffix] = __('Max').$series_suffix_str.': '.__('Last').': '.remove_right_zeros(number_format($graph_stats['max']['last'], $config['graph_precision'])).' '.$unit.' ; '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['max']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['max']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['max']['min'], $config['graph_precision'])).' '.$unit.' --> '.__('Selected');
|
$legend['max'.$series_suffix] = __('Max').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['max']['last'], $config['graph_precision']), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['max']['avg'], $config['graph_precision']), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['max']['max'], $config['graph_precision']), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['max']['min'], $config['graph_precision']), '.0').' '.$unit.' --> '.__('Selected');
|
||||||
$legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Last').': '.remove_right_zeros(number_format($graph_stats['sum']['last'], $config['graph_precision'])).' '.$unit.' ; '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['sum']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['sum']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['sum']['min'], $config['graph_precision'])).' '.$unit.' --> '.__('Selected');
|
$legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['sum']['last'], $config['graph_precision']), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['sum']['avg'], $config['graph_precision']), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['sum']['max'], $config['graph_precision']), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['sum']['min'], $config['graph_precision']), '.0').' '.$unit.' --> '.__('Selected');
|
||||||
$legend['min'.$series_suffix] = __('Min').$series_suffix_str.': '.__('Last').': '.remove_right_zeros(number_format($graph_stats['min']['last'], $config['graph_precision'])).' '.$unit.' ; '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['min']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['min']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['min']['min'], $config['graph_precision'])).' '.$unit.' --> '.__('Selected');
|
$legend['min'.$series_suffix] = __('Min').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['min']['last'], $config['graph_precision']), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['min']['avg'], $config['graph_precision']), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['min']['max'], $config['graph_precision']), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['min']['min'], $config['graph_precision']), '.0').' '.$unit.' --> '.__('Selected');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Last').': '.remove_right_zeros(number_format($graph_stats['sum']['last'], $config['graph_precision'])).' '.$unit.' ; '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['sum']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['sum']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['sum']['min'], $config['graph_precision'])).' '.$unit.' --> '.__('Selected');
|
$legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['sum']['last'], $config['graph_precision']), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['sum']['avg'], $config['graph_precision']), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['sum']['max'], $config['graph_precision']), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['sum']['min'], $config['graph_precision']), '.0').' '.$unit.' --> '.__('Selected');
|
||||||
}
|
}
|
||||||
//Baseline was replaced by compare graph feature
|
//Baseline was replaced by compare graph feature
|
||||||
/*if ($baseline) {
|
/*if ($baseline) {
|
||||||
@ -1014,7 +1013,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
if ($date == 0)
|
if ($date == 0)
|
||||||
$date = get_system_time();
|
$date = get_system_time();
|
||||||
$datelimit = $date - $period;
|
$datelimit = $date - $period;
|
||||||
|
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||||
$resolution = $config['graph_res'] * 50; //Number of points of the graph
|
$resolution = $config['graph_res'] * 50; //Number of points of the graph
|
||||||
$interval = (int) ($period / $resolution);
|
$interval = (int) ($period / $resolution);
|
||||||
|
|
||||||
@ -1085,36 +1084,16 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
|
|
||||||
// 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;
|
// If its a projection graph, first module will be data and second will be the projection
|
||||||
if ($config['metaconsole']) {
|
|
||||||
// Automatic custom graph from the report template in metaconsole
|
|
||||||
if (is_array($module_list[$i])) {
|
|
||||||
$server = metaconsole_get_connection_by_id ($module_list[$i]['server']);
|
|
||||||
metaconsole_connect($server);
|
|
||||||
$automatic_custom_graph_meta = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$search_in_history_db = db_search_in_history_db($datelimit);
|
|
||||||
|
|
||||||
// If its a projection graph,
|
|
||||||
// first module will be data and second will be the projection
|
|
||||||
if ($projection != false && $i != 0) {
|
if ($projection != false && $i != 0) {
|
||||||
if ($automatic_custom_graph_meta)
|
$agent_module_id = $module_list[0];
|
||||||
$agent_module_id = $module_list[0]['module'];
|
|
||||||
else
|
|
||||||
$agent_module_id = $module_list[0];
|
|
||||||
|
|
||||||
$id_module_type = modules_get_agentmodule_type ($agent_module_id);
|
$id_module_type = modules_get_agentmodule_type ($agent_module_id);
|
||||||
$module_type = modules_get_moduletype_name ($id_module_type);
|
$module_type = modules_get_moduletype_name ($id_module_type);
|
||||||
$uncompressed_module = is_module_uncompressed ($module_type);
|
$uncompressed_module = is_module_uncompressed ($module_type);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($automatic_custom_graph_meta)
|
$agent_module_id = $module_list[$i];
|
||||||
$agent_module_id = $module_list[$i]['module'];
|
|
||||||
else
|
|
||||||
$agent_module_id = $module_list[$i];
|
|
||||||
|
|
||||||
|
|
||||||
$id_module_type = modules_get_agentmodule_type ($agent_module_id);
|
$id_module_type = modules_get_agentmodule_type ($agent_module_id);
|
||||||
$module_type = modules_get_moduletype_name ($id_module_type);
|
$module_type = modules_get_moduletype_name ($id_module_type);
|
||||||
@ -1196,7 +1175,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
$module_name = io_safe_output(
|
$module_name = io_safe_output(
|
||||||
modules_get_agentmodule_name ($agent_module_id));
|
modules_get_agentmodule_name ($agent_module_id));
|
||||||
|
|
||||||
$module_name_list[$i] = $agent_name ." / ". $module_name;
|
$module_name_list[$i] = '<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . $agent_name . " / " . $module_name. '</span>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1214,9 +1193,9 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
$module_name = ui_print_truncate_text($module_name, 'module_small', false, true, false, '...', false);
|
$module_name = ui_print_truncate_text($module_name, 'module_small', false, true, false, '...', false);
|
||||||
|
|
||||||
if ($labels[$agent_module_id] != '')
|
if ($labels[$agent_module_id] != '')
|
||||||
$module_name_list[$i] = $labels[$agent_module_id];
|
$module_name_list[$i] = '<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . $labels[$agent_module_id] . '</span>';
|
||||||
else
|
else
|
||||||
$module_name_list[$i] = $agent_name . ' / ' . $module_name;
|
$module_name_list[$i] = '<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . $agent_name . ' / ' . $module_name . '</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Data iterator
|
// Data iterator
|
||||||
@ -1348,30 +1327,30 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
$last = $graph_stats['last'];
|
$last = $graph_stats['last'];
|
||||||
|
|
||||||
if ($min > 1000000)
|
if ($min > 1000000)
|
||||||
$min = sprintf("%sM", remove_right_zeros(number_format($min / 1000000, remove_right_zeros)));
|
$min = sprintf("%sM", number_format($min / 1000000, $config['graph_precision']));
|
||||||
else if ($min > 1000)
|
else if ($min > 1000)
|
||||||
$min = sprintf("%sK", remove_right_zeros(number_format($min / 1000, $config['graph_precision'])));
|
$min = sprintf("%sK", number_format($min / 1000, $config['graph_precision']));
|
||||||
|
|
||||||
if ($max > 1000000)
|
if ($max > 1000000)
|
||||||
$max = sprintf("%sM", remove_right_zeros(number_format($max / 1000000, $config['graph_precision'])));
|
$max = sprintf("%sM", number_format($max / 1000000, $config['graph_precision']));
|
||||||
else if ($max > 1000)
|
else if ($max > 1000)
|
||||||
$max = sprintf("%sK", remove_right_zeros(number_format($max / 1000, $config['graph_precision'])));
|
$max = sprintf("%sK", number_format($max / 1000, $config['graph_precision']));
|
||||||
|
|
||||||
if ($avg > 1000000)
|
if ($avg > 1000000)
|
||||||
$avg = sprintf("%sM", remove_right_zeros(number_format($avg / 1000000, $config['graph_precision'])));
|
$avg = sprintf("%sM", number_format($avg / 1000000, $config['graph_precision']));
|
||||||
else if ($avg > 1000)
|
else if ($avg > 1000)
|
||||||
$avg = sprintf("%sK", remove_right_zeros(number_format($avg / 1000, $config['graph_precision'])));
|
$avg = sprintf("%sK", number_format($avg / 1000, $config['graph_precision']));
|
||||||
|
|
||||||
if ($last > 1000000)
|
if ($last > 1000000)
|
||||||
$last = sprintf("%sM", remove_right_zeros(number_format($last / 1000000, $config['graph_precision'])));
|
$last = sprintf("%sM", number_format($last / 1000000, $config['graph_precision']));
|
||||||
else if ($last > 1000)
|
else if ($last > 1000)
|
||||||
$last = sprintf("%sK", remove_right_zeros(number_format($last / 1000, $config['graph_precision'])));
|
$last = sprintf("%sK", number_format($last / 1000, $config['graph_precision']));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$min = remove_right_zeros(number_format($graph_stats['min'], $config['graph_precision']));
|
$min = number_format($graph_stats['min'], $config['graph_precision']);
|
||||||
$max = remove_right_zeros(number_format($graph_stats['max'], $config['graph_precision']));
|
$max = number_format($graph_stats['max'], $config['graph_precision']);
|
||||||
$avg = remove_right_zeros(number_format($graph_stats['avg'], $config['graph_precision']));
|
$avg = number_format($graph_stats['avg'], $config['graph_precision']);
|
||||||
$last = remove_right_zeros(number_format($graph_stats['last'], $config['graph_precision']));
|
$last = number_format($graph_stats['last'], $config['graph_precision']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1403,13 +1382,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
//unset($graph_values[$i]);
|
//unset($graph_values[$i]);
|
||||||
|
|
||||||
//$graph_values[$i] = $graph_values[$i];
|
//$graph_values[$i] = $graph_values[$i];
|
||||||
|
|
||||||
if ($config['metaconsole']) {
|
|
||||||
// Automatic custom graph from the report template in metaconsole
|
|
||||||
if (is_array($module_list[0])) {
|
|
||||||
metaconsole_restore_db();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$temp = array();
|
$temp = array();
|
||||||
@ -1427,7 +1399,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
$flash_charts = false;
|
$flash_charts = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
@ -1513,39 +1485,14 @@ 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']) {
|
|
||||||
// Automatic custom graph from the report template in metaconsole
|
|
||||||
if (is_array($module_list[0])) {
|
|
||||||
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) {
|
||||||
$automatic_custom_graph_meta = false;
|
|
||||||
if ($config['metaconsole']) {
|
|
||||||
// Automatic custom graph from the report template in metaconsole
|
|
||||||
if (is_array($module_list[$i])) {
|
|
||||||
$server = metaconsole_get_connection_by_id ($module_item['server']);
|
|
||||||
metaconsole_connect($server);
|
|
||||||
$automatic_custom_graph_meta = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($automatic_custom_graph_meta)
|
|
||||||
$module = $module_item['module'];
|
|
||||||
else
|
|
||||||
$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
|
||||||
@ -1564,36 +1511,13 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
else
|
else
|
||||||
$label = $agent_name . " - " .$module_data['nombre'];
|
$label = $agent_name . " - " .$module_data['nombre'];
|
||||||
$temp[$label]['g'] = round($temp_data,4);
|
$temp[$label]['g'] = round($temp_data,4);
|
||||||
|
|
||||||
|
|
||||||
if ($config['metaconsole']) {
|
|
||||||
// Automatic custom graph from the report template in metaconsole
|
|
||||||
if (is_array($module_list[0])) {
|
|
||||||
metaconsole_restore_db();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CUSTOM_GRAPH_PIE:
|
case CUSTOM_GRAPH_PIE:
|
||||||
$datelimit = $date - $period;
|
$datelimit = $date - $period;
|
||||||
$total_modules = 0;
|
$total_modules = 0;
|
||||||
foreach ($module_list as $module_item) {
|
|
||||||
$automatic_custom_graph_meta = false;
|
foreach ($module_list as $module) {
|
||||||
if ($config['metaconsole']) {
|
|
||||||
// Automatic custom graph from the report template in metaconsole
|
|
||||||
if (is_array($module_list[$i])) {
|
|
||||||
$server = metaconsole_get_connection_by_id ($module_item['server']);
|
|
||||||
metaconsole_connect($server);
|
|
||||||
$automatic_custom_graph_meta = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($automatic_custom_graph_meta)
|
|
||||||
$module = $module_item['module'];
|
|
||||||
else
|
|
||||||
$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
|
||||||
@ -1625,35 +1549,13 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
|
|
||||||
$temp[$label] = array('value'=>$value,
|
$temp[$label] = array('value'=>$value,
|
||||||
'unit'=>$data_module['unit']);
|
'unit'=>$data_module['unit']);
|
||||||
if ($config['metaconsole']) {
|
|
||||||
// Automatic custom graph from the report template in metaconsole
|
|
||||||
if (is_array($module_list[0])) {
|
|
||||||
metaconsole_restore_db();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$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;
|
||||||
$i = 0;
|
foreach ($module_list as $module) {
|
||||||
foreach ($module_list as $module_item) {
|
|
||||||
$automatic_custom_graph_meta = false;
|
|
||||||
if ($config['metaconsole']) {
|
|
||||||
// Automatic custom graph from the report template in metaconsole
|
|
||||||
if (is_array($module_list[$i])) {
|
|
||||||
$server = metaconsole_get_connection_by_id ($module_item['server']);
|
|
||||||
metaconsole_connect($server);
|
|
||||||
$automatic_custom_graph_meta = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($automatic_custom_graph_meta)
|
|
||||||
$module = $module_item['module'];
|
|
||||||
else
|
|
||||||
$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
|
||||||
@ -1691,14 +1593,6 @@ 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']) {
|
|
||||||
// Automatic custom graph from the report template in metaconsole
|
|
||||||
if (is_array($module_list[0])) {
|
|
||||||
metaconsole_restore_db();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1746,7 +1640,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
|
|
||||||
|
|
||||||
//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'] - 2;
|
||||||
|
|
||||||
//Set graph color
|
//Set graph color
|
||||||
|
|
||||||
@ -3750,12 +3644,12 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
|
|||||||
if (!$avg_only) {
|
if (!$avg_only) {
|
||||||
//Boolean graph doesn't have max!!!
|
//Boolean graph doesn't have max!!!
|
||||||
//$legend['max'.$series_suffix] = __('Max').$series_suffix_str .': '.__('Last').': '.$graph_stats['max']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['max']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['max']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['max']['min'].' '.$unit;
|
//$legend['max'.$series_suffix] = __('Max').$series_suffix_str .': '.__('Last').': '.$graph_stats['max']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['max']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['max']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['max']['min'].' '.$unit;
|
||||||
$legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Last').': '.remove_right_zeros(number_format($graph_stats['sum']['last'], $config['graph_precision'])).' '.$unit.' ; '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['sum']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['sum']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['sum']['min'], $config['graph_precision'])).' '.$unit;
|
$legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Last').': '.$graph_stats['sum']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['sum']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['sum']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['sum']['min'].' '.$unit;
|
||||||
// Boolean graph doesn't have min!!!
|
// Boolean graph doesn't have min!!!
|
||||||
// $legend['min'.$series_suffix] = __('Min').$series_suffix_str .': '.__('Last').': '.number_format($graph_stats['min']['last'], $config['graph_precision']).' '.$unit.' ; '.__('Avg').': '.number_format($graph_stats['min']['avg'], $config['graph_precision']).' '.$unit.' ; '.__('Max').': '.number_format($graph_stats['min']['max'], $config['graph_precision']).' '.$unit.' ; '.__('Min').': '.number_format($graph_stats['min']['min'], $config['graph_precision']).' '.$unit;
|
// $legend['min'.$series_suffix] = __('Min').$series_suffix_str .': '.__('Last').': '.$graph_stats['min']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['min']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['min']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['min']['min'].' '.$unit;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Last').': '.remove_right_zeros(number_format($graph_stats['sum']['last'], $config['graph_precision'])).' '.$unit.' ; '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['sum']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['sum']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['sum']['min'], $config['graph_precision'])).' '.$unit;
|
$legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Last').': '.$graph_stats['sum']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['sum']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['sum']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['sum']['min'].' '.$unit;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4416,13 +4310,13 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$avg_only) {
|
if (!$avg_only) {
|
||||||
$legend['max'] = __('Max').': '.__('Last').': '.remove_right_zeros(number_format($graph_stats['max']['last'], $config['graph_precision'])).' '.$unit.' ; '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['max']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['max']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['max']['min'], $config['graph_precision'])).' '.$unit;
|
$legend['max'] = __('Max').': '.__('Last').': '.$graph_stats['max']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['max']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['max']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['max']['min'].' '.$unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$legend['sum'] = __('Avg').': '.__('Last').': '.remove_right_zeros(number_format($graph_stats['sum']['last'], $config['graph_precision'])).' '.$unit.' ; '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['sum']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['sum']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['sum']['min'], $config['graph_precision'])).' '.$unit;
|
$legend['sum'] = __('Avg').': '.__('Last').': '.$graph_stats['sum']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['sum']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['sum']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['sum']['min'].' '.$unit;
|
||||||
|
|
||||||
if (!$avg_only) {
|
if (!$avg_only) {
|
||||||
$legend['min'] = __('Min').': '.__('Last').': '.remove_right_zeros(number_format($graph_stats['min']['last'], $config['graph_precision'])).' '.$unit.' ; '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['min']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['min']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['min']['min'], $config['graph_precision'])).' '.$unit;
|
$legend['min'] = __('Min').': '.__('Last').': '.$graph_stats['min']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['min']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['min']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['min']['min'].' '.$unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
|
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
|
||||||
@ -5036,7 +4930,7 @@ function graph_monitor_wheel ($width = 550, $height = 600, $filter = false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($data_groups)) {
|
if (!empty($data_groups)) {
|
||||||
$filter = array('id_grupo' => array_keys($data_groups));
|
$filter = array('id_grupo' => array_keys($groups));
|
||||||
$fields = array('id_agente', 'id_parent', 'id_grupo', 'nombre');
|
$fields = array('id_agente', 'id_parent', 'id_grupo', 'nombre');
|
||||||
$agents = agents_get_agents($filter, $fields);
|
$agents = agents_get_agents($filter, $fields);
|
||||||
|
|
||||||
|
@ -534,7 +534,6 @@ function modules_create_agent_module ($id_agent, $name, $values = false, $disabl
|
|||||||
'datos' => 0,
|
'datos' => 0,
|
||||||
'timestamp' => '01-01-1970 00:00:00',
|
'timestamp' => '01-01-1970 00:00:00',
|
||||||
'estado' => $status,
|
'estado' => $status,
|
||||||
'known_status' => $status,
|
|
||||||
'id_agente' => (int) $id_agent,
|
'id_agente' => (int) $id_agent,
|
||||||
'utimestamp' => 0,
|
'utimestamp' => 0,
|
||||||
'status_changes' => 0,
|
'status_changes' => 0,
|
||||||
@ -548,7 +547,6 @@ function modules_create_agent_module ($id_agent, $name, $values = false, $disabl
|
|||||||
'datos' => 0,
|
'datos' => 0,
|
||||||
'timestamp' => null,
|
'timestamp' => null,
|
||||||
'estado' => $status,
|
'estado' => $status,
|
||||||
'known_status' => $status,
|
|
||||||
'id_agente' => (int) $id_agent,
|
'id_agente' => (int) $id_agent,
|
||||||
'utimestamp' => 0,
|
'utimestamp' => 0,
|
||||||
'status_changes' => 0,
|
'status_changes' => 0,
|
||||||
@ -562,7 +560,6 @@ function modules_create_agent_module ($id_agent, $name, $values = false, $disabl
|
|||||||
'datos' => 0,
|
'datos' => 0,
|
||||||
'timestamp' => '#to_date(\'1970-01-01 00:00:00\', \'YYYY-MM-DD HH24:MI:SS\')',
|
'timestamp' => '#to_date(\'1970-01-01 00:00:00\', \'YYYY-MM-DD HH24:MI:SS\')',
|
||||||
'estado' => $status,
|
'estado' => $status,
|
||||||
'known_status' => $status,
|
|
||||||
'id_agente' => (int) $id_agent,
|
'id_agente' => (int) $id_agent,
|
||||||
'utimestamp' => 0,
|
'utimestamp' => 0,
|
||||||
'status_changes' => 0,
|
'status_changes' => 0,
|
||||||
@ -1572,7 +1569,7 @@ function modules_get_agentmodule_status($id_agentmodule = 0, $without_alerts = f
|
|||||||
function modules_get_agentmodule_last_status($id_agentmodule = 0) {
|
function modules_get_agentmodule_last_status($id_agentmodule = 0) {
|
||||||
$status_row = db_get_row ("tagente_estado", "id_agente_modulo", $id_agentmodule);
|
$status_row = db_get_row ("tagente_estado", "id_agente_modulo", $id_agentmodule);
|
||||||
|
|
||||||
return $status_row['known_status'];
|
return $status_row['last_known_status'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1840,7 +1837,6 @@ function modules_get_modulegroup_name ($modulegroup_id) {
|
|||||||
function modules_get_status($id_agent_module, $db_status, $data, &$status, &$title) {
|
function modules_get_status($id_agent_module, $db_status, $data, &$status, &$title) {
|
||||||
$status = STATUS_MODULE_WARNING;
|
$status = STATUS_MODULE_WARNING;
|
||||||
$title = "";
|
$title = "";
|
||||||
global $config;
|
|
||||||
|
|
||||||
// This module is initialized ? (has real data)
|
// This module is initialized ? (has real data)
|
||||||
//$module_init = db_get_value ('utimestamp', 'tagente_estado', 'id_agente_modulo', $id_agent_module);
|
//$module_init = db_get_value ('utimestamp', 'tagente_estado', 'id_agente_modulo', $id_agent_module);
|
||||||
@ -1880,7 +1876,7 @@ function modules_get_status($id_agent_module, $db_status, $data, &$status, &$tit
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_numeric($data)) {
|
if (is_numeric($data)) {
|
||||||
$title .= ": " . remove_right_zeros(number_format($data, $config['graph_precision']));
|
$title .= ": " . format_for_graph($data);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$text = io_safe_output($data);
|
$text = io_safe_output($data);
|
||||||
@ -2333,60 +2329,6 @@ function modules_get_unknown_time ($id_agent_module, $date, $period){
|
|||||||
return $unknown_seconds;
|
return $unknown_seconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function modules_get_module_group_status($id_agent, $id_module_group) {
|
|
||||||
$status_return = null;
|
|
||||||
|
|
||||||
|
|
||||||
$modules = db_get_all_rows_filter('tagente_modulo',
|
|
||||||
array('id_agente' => $id_agent,
|
|
||||||
'id_module_group' => $id_module_group));
|
|
||||||
|
|
||||||
if (empty($modules))
|
|
||||||
$module = array();
|
|
||||||
|
|
||||||
foreach ($modules as $module) {
|
|
||||||
$status = modules_get_status($module['id_agente_modulo']);
|
|
||||||
|
|
||||||
// This code is copied from the networkmap old code
|
|
||||||
switch ($status) {
|
|
||||||
case AGENT_MODULE_STATUS_NORMAL:
|
|
||||||
if (is_null($status_return)) {
|
|
||||||
$status_return = AGENT_MODULE_STATUS_NORMAL;
|
|
||||||
}
|
|
||||||
elseif ($status_return == AGENT_MODULE_STATUS_ALL) {
|
|
||||||
$status_return = AGENT_MODULE_STATUS_NORMAL;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case AGENT_MODULE_STATUS_CRITICAL_BAD:
|
|
||||||
$status_return = AGENT_MODULE_STATUS_CRITICAL_BAD;
|
|
||||||
break;
|
|
||||||
case AGENT_MODULE_STATUS_WARNING:
|
|
||||||
if (is_null($status_return)) {
|
|
||||||
$status_return = AGENT_MODULE_STATUS_NORMAL;
|
|
||||||
}
|
|
||||||
elseif ($status_return != AGENT_MODULE_STATUS_CRITICAL_BAD) {
|
|
||||||
$status_return = AGENT_MODULE_STATUS_WARNING;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case AGENT_MODULE_STATUS_NO_DATA:
|
|
||||||
if (is_null($status_return)) {
|
|
||||||
$status_return = AGENT_MODULE_STATUS_NO_DATA;
|
|
||||||
}
|
|
||||||
elseif (($status_return == AGENT_MODULE_STATUS_NORMAL) ||
|
|
||||||
($status_return == AGENT_MODULE_STATUS_ALL)) {
|
|
||||||
$status_return = AGENT_MODULE_STATUS_NO_DATA;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$status_return = AGENT_MODULE_STATUS_ALL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $status_return;
|
|
||||||
}
|
|
||||||
|
|
||||||
function modules_get_modules_name ($sql_from , $sql_conditions = '', $meta = false) {
|
function modules_get_modules_name ($sql_from , $sql_conditions = '', $meta = false) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||||||
$row = array();
|
$row = array();
|
||||||
$row[] = $sla['agent'];
|
$row[] = $sla['agent'];
|
||||||
$row[] = $sla['module'];
|
$row[] = $sla['module'];
|
||||||
$row[] = remove_right_zeros(number_format($sla['max'], $config['graph_precision'])) . " / " . remove_right_zeros(number_format($sla['min'], $config['graph_precision']));
|
$row[] = number_format($sla['max'], $config['graph_precision']) . " / " . number_format($sla['min'], $config['graph_precision']);
|
||||||
$row[] = round($sla['sla_limit'], 2) . "%";
|
$row[] = round($sla['sla_limit'], 2) . "%";
|
||||||
|
|
||||||
if ($sla['sla_value_unknown']) {
|
if ($sla['sla_value_unknown']) {
|
||||||
@ -380,7 +380,7 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||||||
$row = array();
|
$row = array();
|
||||||
$row[] = $sla['agent'];
|
$row[] = $sla['agent'];
|
||||||
$row[] = $sla['module'];
|
$row[] = $sla['module'];
|
||||||
$row[] = remove_right_zeros(number_format($sla['max'], $config['graph_precision'])) . " / " . remove_right_zeros(number_format($sla['min'], $config['graph_precision']));
|
$row[] = number_format($sla['max'], $config['graph_precision']) . " / " . number_format($sla['min'], $config['graph_precision']);
|
||||||
$row[] = round($sla['sla_limit'], 2) . "%";
|
$row[] = round($sla['sla_limit'], 2) . "%";
|
||||||
|
|
||||||
if ($sla['sla_value_unknown']) {
|
if ($sla['sla_value_unknown']) {
|
||||||
@ -1509,13 +1509,13 @@ function reporting_html_monitor_report($table, $item, $mini) {
|
|||||||
'<p style="font: bold ' . $font_size . 'em Arial, Sans-serif; color: ' . COL_NORMAL . ';">';
|
'<p style="font: bold ' . $font_size . 'em Arial, Sans-serif; color: ' . COL_NORMAL . ';">';
|
||||||
$table1->data['data']['ok'] .=
|
$table1->data['data']['ok'] .=
|
||||||
html_print_image("images/module_ok.png", true) . ' ' .
|
html_print_image("images/module_ok.png", true) . ' ' .
|
||||||
__('OK') . ': ' . remove_right_zeros(number_format($item['data']["ok"]["formated_value"], $config['graph_precision'])).' %</p>';
|
__('OK') . ': ' . number_format($item['data']["ok"]["formated_value"], $config['graph_precision']).' %</p>';
|
||||||
|
|
||||||
$table1->data['data']['fail'] =
|
$table1->data['data']['fail'] =
|
||||||
'<p style="font: bold ' . $font_size . 'em Arial, Sans-serif; color: ' . COL_CRITICAL . ';">';
|
'<p style="font: bold ' . $font_size . 'em Arial, Sans-serif; color: ' . COL_CRITICAL . ';">';
|
||||||
$table1->data['data']['fail'] .=
|
$table1->data['data']['fail'] .=
|
||||||
html_print_image("images/module_critical.png", true) . ' ' .
|
html_print_image("images/module_critical.png", true) . ' ' .
|
||||||
__('Not OK') . ': ' . remove_right_zeros(number_format($item['data']["fail"]["formated_value"], $config['graph_precision'])) . ' % ' . '</p>';
|
__('Not OK') . ': ' . number_format($item['data']["fail"]["formated_value"], $config['graph_precision']) . ' % ' . '</p>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->data['module']['cell'] = html_print_table($table1, true);
|
$table->data['module']['cell'] = html_print_table($table1, true);
|
||||||
@ -1753,10 +1753,10 @@ function reporting_html_availability(&$table, $item) {
|
|||||||
$table_row[] = $row['availability_item'];
|
$table_row[] = $row['availability_item'];
|
||||||
$table_row[] = $row['checks'];
|
$table_row[] = $row['checks'];
|
||||||
$table_row[] = $row['failed'];
|
$table_row[] = $row['failed'];
|
||||||
$table_row[] = remove_right_zeros(number_format($row['fail'], $config['graph_precision']));
|
$table_row[] = number_format($row['fail'], $config['graph_precision']);
|
||||||
$table_row[] = $row['poling_time'];
|
$table_row[] = $row['poling_time'];
|
||||||
$table_row[] = $row['time_unavaliable'];
|
$table_row[] = $row['time_unavaliable'];
|
||||||
$table_row[] = remove_right_zeros(number_format($row['ok'], $config['graph_precision']));
|
$table_row[] = number_format($row['ok'], $config['graph_precision']);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($item['date']['to'] > $the_first_men_time) {
|
if ($item['date']['to'] > $the_first_men_time) {
|
||||||
@ -1765,10 +1765,10 @@ function reporting_html_availability(&$table, $item) {
|
|||||||
$table_row[] = $row['availability_item'];
|
$table_row[] = $row['availability_item'];
|
||||||
$table_row[] = $row['checks'];
|
$table_row[] = $row['checks'];
|
||||||
$table_row[] = $row['failed'];
|
$table_row[] = $row['failed'];
|
||||||
$table_row[] = remove_right_zeros(number_format($row['fail'], $config['graph_precision']));
|
$table_row[] = number_format($row['fail'], $config['graph_precision']);
|
||||||
$table_row[] = $row['poling_time'];
|
$table_row[] = $row['poling_time'];
|
||||||
$table_row[] = $row['time_unavaliable'];
|
$table_row[] = $row['time_unavaliable'];
|
||||||
$table_row[] = remove_right_zeros(number_format($row['ok'], $config['graph_precision']));
|
$table_row[] = number_format($row['ok'], $config['graph_precision']);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$same_agent_in_resume = $row['agent'];
|
$same_agent_in_resume = $row['agent'];
|
||||||
@ -1818,10 +1818,10 @@ function reporting_html_availability(&$table, $item) {
|
|||||||
|
|
||||||
$table1->data[] = array(
|
$table1->data[] = array(
|
||||||
'max_text' => $item['resume']['min_text'],
|
'max_text' => $item['resume']['min_text'],
|
||||||
'max' => remove_right_zeros(number_format($item['resume']['max'], $config['graph_precision'])) . "%",
|
'max' => number_format($item['resume']['max'], $config['graph_precision']) . "%",
|
||||||
'avg' => remove_right_zeros(number_format($item['resume']['avg'], $config['graph_precision'])) . "%",
|
'avg' => number_format($item['resume']['avg'], $config['graph_precision']) . "%",
|
||||||
'min_text' => $item['resume']['max_text'],
|
'min_text' => $item['resume']['max_text'],
|
||||||
'min' => remove_right_zeros(number_format($item['resume']['min'], $config['graph_precision'])) . "%"
|
'min' => number_format($item['resume']['min'], $config['graph_precision']) . "%"
|
||||||
);
|
);
|
||||||
|
|
||||||
$table->colspan[2][0] = 3;
|
$table->colspan[2][0] = 3;
|
||||||
|
@ -1016,16 +1016,16 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
$returnValue_value = explode(' ', $value);
|
$returnValue_value = explode(' ', $value);
|
||||||
|
|
||||||
if ($returnValue_value[1] != "") {
|
if ($returnValue_value[1] != "") {
|
||||||
$value = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision'])) . " " . $returnValue_value[1];
|
$value = number_format($returnValue_value[0], $config['graph_precision']) . " " . $returnValue_value[1];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$value = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision']));
|
$value = number_format($returnValue_value[0], $config['graph_precision']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// If the value is a string, dont format it
|
// If the value is a string, dont format it
|
||||||
if (!is_string($value)) {
|
if (!is_string($value)) {
|
||||||
$value = remove_right_zeros(format_for_graph($value, $config['graph_precision']));
|
$value = format_for_graph($value, $config['graph_precision']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,15 +50,12 @@ function include_javascript_dependencies_flot_graph($return = false) {
|
|||||||
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/jquery.flot.threshold.js') .'"></script>
|
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/jquery.flot.threshold.js') .'"></script>
|
||||||
<script language="javascript" type="text/javascript" src="'.
|
<script language="javascript" type="text/javascript" src="'.
|
||||||
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/jquery.flot.symbol.min.js') .'"></script>
|
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/jquery.flot.symbol.min.js') .'"></script>
|
||||||
<script language="javascript" type="text/javascript" src="'.
|
|
||||||
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/jquery.flot.exportdata.pandora.js') .'"></script>
|
|
||||||
<script language="javascript" type="text/javascript" src="'.
|
<script language="javascript" type="text/javascript" src="'.
|
||||||
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/jquery.flot.axislabels.js') .'"></script>
|
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/jquery.flot.axislabels.js') .'"></script>
|
||||||
<script language="javascript" type="text/javascript" src="'.
|
<script language="javascript" type="text/javascript" src="'.
|
||||||
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/pandora.flot.js') .'"></script>';
|
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/pandora.flot.js') .'"></script>';
|
||||||
$output .= "
|
$output .= "
|
||||||
<script type='text/javascript'>
|
<script type='text/javascript'>
|
||||||
var precision_graph = " . $config['graph_precision'] . ";
|
|
||||||
function pieHover(event, pos, obj)
|
function pieHover(event, pos, obj)
|
||||||
{
|
{
|
||||||
if (!obj)
|
if (!obj)
|
||||||
@ -548,11 +545,11 @@ function flot_custom_pie_chart ($flash_charts, $graph_values,
|
|||||||
foreach ($graph_values as $label => $value) {
|
foreach ($graph_values as $label => $value) {
|
||||||
if ($value['value']) {
|
if ($value['value']) {
|
||||||
if ($value['value'] > 1000000)
|
if ($value['value'] > 1000000)
|
||||||
$legendvalue = sprintf("%sM", remove_right_zeros(number_format($value['value'] / 1000000, $config['graph_precision'])));
|
$legendvalue = sprintf("%sM", number_format($value['value'] / 1000000, $config['graph_precision']));
|
||||||
else if ($value['value'] > 1000)
|
else if ($value['value'] > 1000)
|
||||||
$legendvalue = sprintf("%sK", remove_right_zeros(number_format($value['value'] / 1000, $config['graph_precision'])));
|
$legendvalue = sprintf("%sK", number_format($value['value'] / 1000, $config['graph_precision']));
|
||||||
else
|
else
|
||||||
$legendvalue = remove_right_zeros(number_format($value['value'], $config['graph_precision']));
|
$legendvalue = $value['value'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$legendvalue = __('No data');
|
$legendvalue = __('No data');
|
||||||
|
@ -1136,74 +1136,35 @@ if (!empty($result)) {
|
|||||||
__('NOT INIT'), true);
|
__('NOT INIT'), true);
|
||||||
}
|
}
|
||||||
elseif ($row['estado'] == 0) {
|
elseif ($row['estado'] == 0) {
|
||||||
if (is_numeric($row['datos'])) {
|
$data[6] = ui_print_status_image(STATUS_MODULE_OK,
|
||||||
$data[6] = ui_print_status_image(STATUS_MODULE_OK,
|
__('NORMAL') . ': ' . $row['datos'], true);
|
||||||
__('NORMAL') . ': ' . remove_right_zeros(number_format($row['datos'], $config['graph_precision'])), true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$data[6] = ui_print_status_image(STATUS_MODULE_OK,
|
|
||||||
__('NORMAL') . ': ' . $row['datos'], true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
elseif ($row['estado'] == 1) {
|
elseif ($row['estado'] == 1) {
|
||||||
if (is_numeric($row['datos'])) {
|
$data[6] = ui_print_status_image(STATUS_MODULE_CRITICAL,
|
||||||
$data[6] = ui_print_status_image(STATUS_MODULE_CRITICAL,
|
__('CRITICAL') . ': ' . $row['datos'], true);
|
||||||
__('CRITICAL') . ': ' . remove_right_zeros(number_format($row['datos'], $config['graph_precision'])), true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$data[6] = ui_print_status_image(STATUS_MODULE_CRITICAL,
|
|
||||||
__('CRITICAL') . ': ' . $row['datos'], true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
elseif ($row['estado'] == 2) {
|
elseif ($row['estado'] == 2) {
|
||||||
if (is_numeric($row['datos'])) {
|
$data[6] = ui_print_status_image(STATUS_MODULE_WARNING,
|
||||||
$data[6] = ui_print_status_image(STATUS_MODULE_WARNING,
|
__('WARNING') . ': ' . $row['datos'], true);
|
||||||
__('WARNING') . ': ' . remove_right_zeros(number_format($row['datos'], $config['graph_precision'])), true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$data[6] = ui_print_status_image(STATUS_MODULE_WARNING,
|
|
||||||
__('WARNING') . ': ' . $row['datos'], true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$last_status = modules_get_agentmodule_last_status(
|
$last_status = modules_get_agentmodule_last_status(
|
||||||
$row['id_agente_modulo']);
|
$row['id_agente_modulo']);
|
||||||
switch($last_status) {
|
switch($last_status) {
|
||||||
case 0:
|
case 0:
|
||||||
if (is_numeric($row['datos'])) {
|
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
||||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
__('UNKNOWN') . ' - ' . __('Last status') . " " .
|
||||||
__('UNKNOWN') . ' - ' . __('Last status') . " " .
|
__('NORMAL') . ': ' . $row['datos'], true);
|
||||||
__('NORMAL') . ': ' . remove_right_zeros(number_format($row['datos'], $config['graph_precision'])), true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
|
||||||
__('UNKNOWN') . ' - ' . __('Last status') . " " .
|
|
||||||
__('NORMAL') . ': ' . $row['datos'], true);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (is_numeric($row['datos'])) {
|
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
||||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
__('UNKNOWN') . ' - ' . __('Last status') ." " .
|
||||||
__('UNKNOWN') . ' - ' . __('Last status') ." " .
|
__('CRITICAL') . ': ' . $row['datos'], true);
|
||||||
__('CRITICAL') . ': ' . remove_right_zeros(number_format($row['datos'], $config['graph_precision'])), true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
|
||||||
__('UNKNOWN') . ' - ' . __('Last status') ." " .
|
|
||||||
__('CRITICAL') . ': ' . $row['datos'], true);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (is_numeric($row['datos'])) {
|
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
||||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
__('UNKNOWN') . ' - ' . __('Last status') . " " .
|
||||||
__('UNKNOWN') . ' - ' . __('Last status') . " " .
|
__('WARNING') . ': ' . $row['datos'], true);
|
||||||
__('WARNING') . ': ' . remove_right_zeros(number_format($row['datos'], $config['graph_precision'])), true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
|
||||||
__('UNKNOWN') . ' - ' . __('Last status') . " " .
|
|
||||||
__('WARNING') . ': ' . $row['datos'], true);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1245,8 +1206,12 @@ if (!empty($result)) {
|
|||||||
|
|
||||||
$link = 'winopeng(\''.$url.'?'.$graph_params_str.'\',\''.$win_handle.'\')';
|
$link = 'winopeng(\''.$url.'?'.$graph_params_str.'\',\''.$win_handle.'\')';
|
||||||
|
|
||||||
$data[7] = '<a href="javascript:'.$link.'">' . html_print_image('images/chart_curve.png', true, array('border' => '0', 'alt' => '')) . '</a>';
|
$data[7] = '';
|
||||||
|
|
||||||
|
if(!is_snapshot_data($row['datos'])){
|
||||||
|
|
||||||
|
$data[7] = '<a href="javascript:'.$link.'">' . html_print_image('images/chart_curve.png', true, array('border' => '0', 'alt' => '')) . '</a>';
|
||||||
|
}
|
||||||
$data[7] .= '<a href="javascript: ' .
|
$data[7] .= '<a href="javascript: ' .
|
||||||
'show_module_detail_dialog(' .
|
'show_module_detail_dialog(' .
|
||||||
$row['id_agente_modulo'] . ', '.
|
$row['id_agente_modulo'] . ', '.
|
||||||
@ -1281,12 +1246,12 @@ if (!empty($result)) {
|
|||||||
$salida = $config['render_proc_fail'];
|
$salida = $config['render_proc_fail'];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$salida = remove_right_zeros(number_format($row['datos'], $config['graph_precision']));
|
$salida = number_format($row['datos'], $config['graph_precision']);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$salida = remove_right_zeros(number_format($row['datos'], $config['graph_precision']));
|
$salida = number_format($row['datos'], $config['graph_precision']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show units ONLY in numeric data types
|
// Show units ONLY in numeric data types
|
||||||
@ -1316,12 +1281,19 @@ if (!empty($result)) {
|
|||||||
"id=" . $row['id_agente_modulo'] .
|
"id=" . $row['id_agente_modulo'] .
|
||||||
"&refr=" . $row['current_interval'] .
|
"&refr=" . $row['current_interval'] .
|
||||||
"&label=" . rawurlencode(urlencode(io_safe_output($row['module_name']))) . "','" . $win_handle . "', 700,480)";
|
"&label=" . rawurlencode(urlencode(io_safe_output($row['module_name']))) . "','" . $win_handle . "', 700,480)";
|
||||||
|
if(!is_snapshot_data($row['datos'])){
|
||||||
$salida = '<a href="javascript:' . $link . '">' .
|
$salida = '<a href="javascript:' . $link . '">' .
|
||||||
html_print_image('images/default_list.png', true,
|
html_print_image('images/default_list.png', true,
|
||||||
array('border' => '0',
|
array('border' => '0',
|
||||||
'alt' => '',
|
'alt' => '',
|
||||||
'title' => __('Snapshot view'))) . '</a> ';
|
'title' => __('Snapshot view'))) . '</a> ';
|
||||||
|
}else{
|
||||||
|
$salida = '<a href="javascript:' . $link . '">' .
|
||||||
|
html_print_image('images/photo.png', true,
|
||||||
|
array('border' => '0',
|
||||||
|
'alt' => '',
|
||||||
|
'title' => __('Snapshot view'))) . '</a> ';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
@ -1468,11 +1440,27 @@ $('#moduletype').click(function(){
|
|||||||
period = <?php echo SECONDS_1DAY; ?>;
|
period = <?php echo SECONDS_1DAY; ?>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var server_name = '';
|
||||||
|
var extra_parameters = '';
|
||||||
|
if ($('input[name=selection_mode]:checked').val()) {
|
||||||
|
|
||||||
|
period = $('#period').val();
|
||||||
|
|
||||||
|
var selection_mode = $('input[name=selection_mode]:checked').val();
|
||||||
|
var date_from = $('#text-date_from').val();
|
||||||
|
var time_from = $('#text-time_from').val();
|
||||||
|
var date_to = $('#text-date_to').val();
|
||||||
|
var time_to = $('#text-time_to').val();
|
||||||
|
|
||||||
|
extra_parameters = '&selection_mode=' + selection_mode + '&date_from=' + date_from + '&date_to=' + date_to + '&time_from=' + time_from + '&time_to=' + time_to;
|
||||||
|
|
||||||
|
}
|
||||||
title = <?php echo "\"" . __("Module: ") . "\"" ?>;
|
title = <?php echo "\"" . __("Module: ") . "\"" ?>;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||||
data: "page=include/ajax/module&get_module_detail=1&server_name="+server_name+"&id_agent="+id_agent+"&id_module=" + module_id+"&offset="+offset+"&period="+period,
|
data: "page=include/ajax/module&get_module_detail=1&server_name="+server_name+"&id_agent="+id_agent+"&id_module=" + module_id+"&offset="+offset+"&period="+period + extra_parameters,
|
||||||
dataType: "html",
|
dataType: "html",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$("#monitor_details_window").hide ()
|
$("#monitor_details_window").hide ()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user