Added a function to remove right zeros in precision data feature
(cherry picked from commit 26862b5f9d
)
This commit is contained in:
parent
d4be459e22
commit
834a613493
|
@ -284,7 +284,7 @@ if ($get_module_detail) {
|
|||
}
|
||||
else if (is_numeric($row[$attr[0]]) && !modules_is_string_type($row['module_type']) ) {
|
||||
|
||||
$data[] = (double) $row[$attr[0]];
|
||||
$data[] = remove_right_zeros(number_format($row[$attr[0]], $config['graph_precision']));
|
||||
}
|
||||
else {
|
||||
if ($row[$attr[0]] == '') {
|
||||
|
@ -854,7 +854,6 @@ if ($list_modules) {
|
|||
modules_get_status($module['id_agente_modulo'], $module['estado'],
|
||||
$module_value, $status, $title);
|
||||
|
||||
|
||||
$data[5] = ui_print_status_image($status, $title, true);
|
||||
if (!$show_context_help_first_time) {
|
||||
$show_context_help_first_time = true;
|
||||
|
@ -864,7 +863,6 @@ if ($list_modules) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if ($module["id_tipo_modulo"] == 24) {
|
||||
// log4x
|
||||
switch($module["datos"]) {
|
||||
|
|
|
@ -344,10 +344,10 @@ switch ($action) {
|
|||
|
||||
$return = array();
|
||||
if ($returnValue_value[1] != "") {
|
||||
$return['value'] = number_format($returnValue_value[0], $config['graph_precision']) . " " . $returnValue_value[1];
|
||||
$return['value'] = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision'])) . " " . $returnValue_value[1];
|
||||
}
|
||||
else {
|
||||
$return['value'] = number_format($returnValue_value[0], $config['graph_precision']);
|
||||
$return['value'] = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision']));
|
||||
}
|
||||
$return['max_percentile'] = $layoutData['height'];
|
||||
$return['width_percentile'] = $layoutData['width'];
|
||||
|
|
|
@ -2654,4 +2654,9 @@ function pandora_setlocale() {
|
|||
setlocale(LC_ALL,
|
||||
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,6 +21,7 @@ include_once($config['homedir'] . "/include/functions_modules.php");
|
|||
include_once($config['homedir'] . "/include/functions_users.php");
|
||||
|
||||
function get_graph_statistics ($chart_array) {
|
||||
global $config;
|
||||
|
||||
/// IMPORTANT!
|
||||
///
|
||||
|
@ -73,10 +74,10 @@ function get_graph_statistics ($chart_array) {
|
|||
}
|
||||
|
||||
//Format stat data to display properly
|
||||
$stats['last'] = round($stats['last'], 2);
|
||||
$stats['avg'] = round($stats['avg'], 2);
|
||||
$stats['min'] = round($stats['min'], 2);
|
||||
$stats['max'] = round($stats['max'], 2);
|
||||
$stats['last'] = remove_right_zeros(number_format($stats['last'], $config['graph_precision']));
|
||||
$stats['avg'] = remove_right_zeros(number_format($stats['avg'], $config['graph_precision']));
|
||||
$stats['min'] = remove_right_zeros(number_format($stats['min'], $config['graph_precision']));
|
||||
$stats['max'] = remove_right_zeros(number_format($stats['max'], $config['graph_precision']));
|
||||
|
||||
return $stats;
|
||||
}
|
||||
|
@ -733,16 +734,16 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
|
|||
|
||||
if ($dashboard || $vconsole) {
|
||||
$legend['sum'.$series_suffix] =
|
||||
__('Last') . ': ' . rtrim(number_format($graph_stats['sum']['last'], $config['graph_precision']), '.0') . ($unit ? ' ' . $unit : '') . ' ; '
|
||||
. __('Avg') . ': ' . rtrim(number_format($graph_stats['sum']['avg'], $config['graph_precision']), '.0') . ($unit ? ' ' . $unit : '');
|
||||
__('Last') . ': ' . remove_right_zeros(number_format($graph_stats['sum']['last'], $config['graph_precision'])) . ($unit ? ' ' . $unit : '') . ' ; '
|
||||
. __('Avg') . ': ' . remove_right_zeros(number_format($graph_stats['sum']['avg'], $config['graph_precision'])) . ($unit ? ' ' . $unit : '');
|
||||
}
|
||||
else if (!$avg_only) {
|
||||
$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').': '.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').': '.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');
|
||||
$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['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['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');
|
||||
}
|
||||
else {
|
||||
$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['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');
|
||||
}
|
||||
//Baseline was replaced by compare graph feature
|
||||
/*if ($baseline) {
|
||||
|
@ -1013,7 +1014,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
if ($date == 0)
|
||||
$date = get_system_time();
|
||||
$datelimit = $date - $period;
|
||||
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||
|
||||
$resolution = $config['graph_res'] * 50; //Number of points of the graph
|
||||
$interval = (int) ($period / $resolution);
|
||||
|
||||
|
@ -1084,16 +1085,36 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
|
||||
// Calculate data for each module
|
||||
for ($i = 0; $i < $module_number; $i++) {
|
||||
// If its a projection graph, first module will be data and second will be the projection
|
||||
$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_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) {
|
||||
$agent_module_id = $module_list[0];
|
||||
if ($automatic_custom_graph_meta)
|
||||
$agent_module_id = $module_list[0]['module'];
|
||||
else
|
||||
$agent_module_id = $module_list[0];
|
||||
|
||||
$id_module_type = modules_get_agentmodule_type ($agent_module_id);
|
||||
$module_type = modules_get_moduletype_name ($id_module_type);
|
||||
$uncompressed_module = is_module_uncompressed ($module_type);
|
||||
}
|
||||
else {
|
||||
$agent_module_id = $module_list[$i];
|
||||
if ($automatic_custom_graph_meta)
|
||||
$agent_module_id = $module_list[$i]['module'];
|
||||
else
|
||||
$agent_module_id = $module_list[$i];
|
||||
|
||||
|
||||
$id_module_type = modules_get_agentmodule_type ($agent_module_id);
|
||||
$module_type = modules_get_moduletype_name ($id_module_type);
|
||||
|
@ -1175,7 +1196,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
$module_name = io_safe_output(
|
||||
modules_get_agentmodule_name ($agent_module_id));
|
||||
|
||||
$module_name_list[$i] = '<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . $agent_name . " / " . $module_name. '</span>';
|
||||
$module_name_list[$i] = $agent_name ." / ". $module_name;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -1193,9 +1214,9 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
$module_name = ui_print_truncate_text($module_name, 'module_small', false, true, false, '...', false);
|
||||
|
||||
if ($labels[$agent_module_id] != '')
|
||||
$module_name_list[$i] = '<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . $labels[$agent_module_id] . '</span>';
|
||||
$module_name_list[$i] = $labels[$agent_module_id];
|
||||
else
|
||||
$module_name_list[$i] = '<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . $agent_name . ' / ' . $module_name . '</span>';
|
||||
$module_name_list[$i] = $agent_name . ' / ' . $module_name;
|
||||
}
|
||||
|
||||
// Data iterator
|
||||
|
@ -1327,30 +1348,30 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
$last = $graph_stats['last'];
|
||||
|
||||
if ($min > 1000000)
|
||||
$min = sprintf("%sM", number_format($min / 1000000, $config['graph_precision']));
|
||||
$min = sprintf("%sM", remove_right_zeros(number_format($min / 1000000, remove_right_zeros)));
|
||||
else if ($min > 1000)
|
||||
$min = sprintf("%sK", number_format($min / 1000, $config['graph_precision']));
|
||||
$min = sprintf("%sK", remove_right_zeros(number_format($min / 1000, $config['graph_precision'])));
|
||||
|
||||
if ($max > 1000000)
|
||||
$max = sprintf("%sM", number_format($max / 1000000, $config['graph_precision']));
|
||||
$max = sprintf("%sM", remove_right_zeros(number_format($max / 1000000, $config['graph_precision'])));
|
||||
else if ($max > 1000)
|
||||
$max = sprintf("%sK", number_format($max / 1000, $config['graph_precision']));
|
||||
$max = sprintf("%sK", remove_right_zeros(number_format($max / 1000, $config['graph_precision'])));
|
||||
|
||||
if ($avg > 1000000)
|
||||
$avg = sprintf("%sM", number_format($avg / 1000000, $config['graph_precision']));
|
||||
$avg = sprintf("%sM", remove_right_zeros(number_format($avg / 1000000, $config['graph_precision'])));
|
||||
else if ($avg > 1000)
|
||||
$avg = sprintf("%sK", number_format($avg / 1000, $config['graph_precision']));
|
||||
$avg = sprintf("%sK", remove_right_zeros(number_format($avg / 1000, $config['graph_precision'])));
|
||||
|
||||
if ($last > 1000000)
|
||||
$last = sprintf("%sM", number_format($last / 1000000, $config['graph_precision']));
|
||||
$last = sprintf("%sM", remove_right_zeros(number_format($last / 1000000, $config['graph_precision'])));
|
||||
else if ($last > 1000)
|
||||
$last = sprintf("%sK", number_format($last / 1000, $config['graph_precision']));
|
||||
$last = sprintf("%sK", remove_right_zeros(number_format($last / 1000, $config['graph_precision'])));
|
||||
}
|
||||
else {
|
||||
$min = number_format($graph_stats['min'], $config['graph_precision']);
|
||||
$max = number_format($graph_stats['max'], $config['graph_precision']);
|
||||
$avg = number_format($graph_stats['avg'], $config['graph_precision']);
|
||||
$last = number_format($graph_stats['last'], $config['graph_precision']);
|
||||
$min = remove_right_zeros(number_format($graph_stats['min'], $config['graph_precision']));
|
||||
$max = remove_right_zeros(number_format($graph_stats['max'], $config['graph_precision']));
|
||||
$avg = remove_right_zeros(number_format($graph_stats['avg'], $config['graph_precision']));
|
||||
$last = remove_right_zeros(number_format($graph_stats['last'], $config['graph_precision']));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1382,6 +1403,13 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
//unset($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();
|
||||
|
@ -1399,7 +1427,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
$flash_charts = false;
|
||||
}
|
||||
|
||||
if ($flash_charts === false && $stacked == CUSTOM_GRAPH_GAUGE)
|
||||
if ($flash_charts === false && $stacked == CUSTOM_GRAPH_GAUGE)
|
||||
$stacked = CUSTOM_GRAPH_BULLET_CHART;
|
||||
|
||||
switch ($stacked) {
|
||||
|
@ -1485,14 +1513,39 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
if ($temp_min < 0)
|
||||
$temp_min = 0;
|
||||
$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;
|
||||
case CUSTOM_GRAPH_HBARS:
|
||||
case CUSTOM_GRAPH_VBARS:
|
||||
$datelimit = $date - $period;
|
||||
|
||||
$label = '';
|
||||
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;
|
||||
|
||||
|
||||
$module_data = modules_get_agentmodule($module);
|
||||
$query_last_value = sprintf('
|
||||
SELECT datos
|
||||
|
@ -1511,13 +1564,36 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
else
|
||||
$label = $agent_name . " - " .$module_data['nombre'];
|
||||
$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;
|
||||
case CUSTOM_GRAPH_PIE:
|
||||
$datelimit = $date - $period;
|
||||
$total_modules = 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;
|
||||
|
||||
$data_module = modules_get_agentmodule($module);
|
||||
$query_last_value = sprintf('
|
||||
SELECT datos
|
||||
|
@ -1549,13 +1625,35 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
|
||||
$temp[$label] = array('value'=>$value,
|
||||
'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;
|
||||
|
||||
break;
|
||||
case CUSTOM_GRAPH_GAUGE:
|
||||
$datelimit = $date - $period;
|
||||
foreach ($module_list as $module) {
|
||||
$i = 0;
|
||||
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);
|
||||
$query_last_value = sprintf('
|
||||
SELECT datos
|
||||
|
@ -1593,6 +1691,14 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
$temp[$module]['max'] = ($max == 0 ) ? 100 : $max;
|
||||
}
|
||||
$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;
|
||||
default:
|
||||
|
@ -1640,7 +1746,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
|
||||
|
||||
//Work around for fixed the agents name with huge size chars.
|
||||
$fixed_font_size = $config['font_size'] - 2;
|
||||
$fixed_font_size = $config['font_size'];
|
||||
|
||||
//Set graph color
|
||||
|
||||
|
@ -3644,12 +3750,12 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
|
|||
if (!$avg_only) {
|
||||
//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['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;
|
||||
$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;
|
||||
// Boolean graph doesn't have min!!!
|
||||
// $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;
|
||||
// $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;
|
||||
}
|
||||
else {
|
||||
$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;
|
||||
$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;
|
||||
|
||||
}
|
||||
|
||||
|
@ -4310,13 +4416,13 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
|
|||
}
|
||||
|
||||
if (!$avg_only) {
|
||||
$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['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['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;
|
||||
$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;
|
||||
|
||||
if (!$avg_only) {
|
||||
$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;
|
||||
$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;
|
||||
}
|
||||
|
||||
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
|
||||
|
@ -4930,7 +5036,7 @@ function graph_monitor_wheel ($width = 550, $height = 600, $filter = false) {
|
|||
}
|
||||
|
||||
if (!empty($data_groups)) {
|
||||
$filter = array('id_grupo' => array_keys($groups));
|
||||
$filter = array('id_grupo' => array_keys($data_groups));
|
||||
$fields = array('id_agente', 'id_parent', 'id_grupo', 'nombre');
|
||||
$agents = agents_get_agents($filter, $fields);
|
||||
|
||||
|
|
|
@ -534,6 +534,7 @@ function modules_create_agent_module ($id_agent, $name, $values = false, $disabl
|
|||
'datos' => 0,
|
||||
'timestamp' => '01-01-1970 00:00:00',
|
||||
'estado' => $status,
|
||||
'known_status' => $status,
|
||||
'id_agente' => (int) $id_agent,
|
||||
'utimestamp' => 0,
|
||||
'status_changes' => 0,
|
||||
|
@ -547,6 +548,7 @@ function modules_create_agent_module ($id_agent, $name, $values = false, $disabl
|
|||
'datos' => 0,
|
||||
'timestamp' => null,
|
||||
'estado' => $status,
|
||||
'known_status' => $status,
|
||||
'id_agente' => (int) $id_agent,
|
||||
'utimestamp' => 0,
|
||||
'status_changes' => 0,
|
||||
|
@ -560,6 +562,7 @@ function modules_create_agent_module ($id_agent, $name, $values = false, $disabl
|
|||
'datos' => 0,
|
||||
'timestamp' => '#to_date(\'1970-01-01 00:00:00\', \'YYYY-MM-DD HH24:MI:SS\')',
|
||||
'estado' => $status,
|
||||
'known_status' => $status,
|
||||
'id_agente' => (int) $id_agent,
|
||||
'utimestamp' => 0,
|
||||
'status_changes' => 0,
|
||||
|
@ -1569,7 +1572,7 @@ function modules_get_agentmodule_status($id_agentmodule = 0, $without_alerts = f
|
|||
function modules_get_agentmodule_last_status($id_agentmodule = 0) {
|
||||
$status_row = db_get_row ("tagente_estado", "id_agente_modulo", $id_agentmodule);
|
||||
|
||||
return $status_row['last_known_status'];
|
||||
return $status_row['known_status'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1837,6 +1840,7 @@ function modules_get_modulegroup_name ($modulegroup_id) {
|
|||
function modules_get_status($id_agent_module, $db_status, $data, &$status, &$title) {
|
||||
$status = STATUS_MODULE_WARNING;
|
||||
$title = "";
|
||||
global $config;
|
||||
|
||||
// This module is initialized ? (has real data)
|
||||
//$module_init = db_get_value ('utimestamp', 'tagente_estado', 'id_agente_modulo', $id_agent_module);
|
||||
|
@ -1876,7 +1880,7 @@ function modules_get_status($id_agent_module, $db_status, $data, &$status, &$tit
|
|||
}
|
||||
|
||||
if (is_numeric($data)) {
|
||||
$title .= ": " . format_for_graph($data);
|
||||
$title .= ": " . remove_right_zeros(number_format($data, $config['graph_precision']));
|
||||
}
|
||||
else {
|
||||
$text = io_safe_output($data);
|
||||
|
@ -2329,6 +2333,60 @@ function modules_get_unknown_time ($id_agent_module, $date, $period){
|
|||
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) {
|
||||
global $config;
|
||||
|
||||
|
|
|
@ -353,7 +353,7 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
$row = array();
|
||||
$row[] = $sla['agent'];
|
||||
$row[] = $sla['module'];
|
||||
$row[] = number_format($sla['max'], $config['graph_precision']) . " / " . number_format($sla['min'], $config['graph_precision']);
|
||||
$row[] = remove_right_zeros(number_format($sla['max'], $config['graph_precision'])) . " / " . remove_right_zeros(number_format($sla['min'], $config['graph_precision']));
|
||||
$row[] = round($sla['sla_limit'], 2) . "%";
|
||||
|
||||
if ($sla['sla_value_unknown']) {
|
||||
|
@ -380,7 +380,7 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
$row = array();
|
||||
$row[] = $sla['agent'];
|
||||
$row[] = $sla['module'];
|
||||
$row[] = number_format($sla['max'], $config['graph_precision']) . " / " . number_format($sla['min'], $config['graph_precision']);
|
||||
$row[] = remove_right_zeros(number_format($sla['max'], $config['graph_precision'])) . " / " . remove_right_zeros(number_format($sla['min'], $config['graph_precision']));
|
||||
$row[] = round($sla['sla_limit'], 2) . "%";
|
||||
|
||||
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 . ';">';
|
||||
$table1->data['data']['ok'] .=
|
||||
html_print_image("images/module_ok.png", true) . ' ' .
|
||||
__('OK') . ': ' . number_format($item['data']["ok"]["formated_value"], $config['graph_precision']).' %</p>';
|
||||
__('OK') . ': ' . remove_right_zeros(number_format($item['data']["ok"]["formated_value"], $config['graph_precision'])).' %</p>';
|
||||
|
||||
$table1->data['data']['fail'] =
|
||||
'<p style="font: bold ' . $font_size . 'em Arial, Sans-serif; color: ' . COL_CRITICAL . ';">';
|
||||
$table1->data['data']['fail'] .=
|
||||
html_print_image("images/module_critical.png", true) . ' ' .
|
||||
__('Not OK') . ': ' . number_format($item['data']["fail"]["formated_value"], $config['graph_precision']) . ' % ' . '</p>';
|
||||
__('Not OK') . ': ' . remove_right_zeros(number_format($item['data']["fail"]["formated_value"], $config['graph_precision'])) . ' % ' . '</p>';
|
||||
}
|
||||
|
||||
$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['checks'];
|
||||
$table_row[] = $row['failed'];
|
||||
$table_row[] = number_format($row['fail'], $config['graph_precision']);
|
||||
$table_row[] = remove_right_zeros(number_format($row['fail'], $config['graph_precision']));
|
||||
$table_row[] = $row['poling_time'];
|
||||
$table_row[] = $row['time_unavaliable'];
|
||||
$table_row[] = number_format($row['ok'], $config['graph_precision']);
|
||||
$table_row[] = remove_right_zeros(number_format($row['ok'], $config['graph_precision']));
|
||||
}
|
||||
else {
|
||||
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['checks'];
|
||||
$table_row[] = $row['failed'];
|
||||
$table_row[] = number_format($row['fail'], $config['graph_precision']);
|
||||
$table_row[] = remove_right_zeros(number_format($row['fail'], $config['graph_precision']));
|
||||
$table_row[] = $row['poling_time'];
|
||||
$table_row[] = $row['time_unavaliable'];
|
||||
$table_row[] = number_format($row['ok'], $config['graph_precision']);
|
||||
$table_row[] = remove_right_zeros(number_format($row['ok'], $config['graph_precision']));
|
||||
}
|
||||
else {
|
||||
$same_agent_in_resume = $row['agent'];
|
||||
|
@ -1818,10 +1818,10 @@ function reporting_html_availability(&$table, $item) {
|
|||
|
||||
$table1->data[] = array(
|
||||
'max_text' => $item['resume']['min_text'],
|
||||
'max' => number_format($item['resume']['max'], $config['graph_precision']) . "%",
|
||||
'avg' => number_format($item['resume']['avg'], $config['graph_precision']) . "%",
|
||||
'max' => remove_right_zeros(number_format($item['resume']['max'], $config['graph_precision'])) . "%",
|
||||
'avg' => remove_right_zeros(number_format($item['resume']['avg'], $config['graph_precision'])) . "%",
|
||||
'min_text' => $item['resume']['max_text'],
|
||||
'min' => number_format($item['resume']['min'], $config['graph_precision']) . "%"
|
||||
'min' => remove_right_zeros(number_format($item['resume']['min'], $config['graph_precision'])) . "%"
|
||||
);
|
||||
|
||||
$table->colspan[2][0] = 3;
|
||||
|
|
|
@ -1016,16 +1016,16 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
$returnValue_value = explode(' ', $value);
|
||||
|
||||
if ($returnValue_value[1] != "") {
|
||||
$value = number_format($returnValue_value[0], $config['graph_precision']) . " " . $returnValue_value[1];
|
||||
$value = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision'])) . " " . $returnValue_value[1];
|
||||
}
|
||||
else {
|
||||
$value = number_format($returnValue_value[0], $config['graph_precision']);
|
||||
$value = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision']));
|
||||
}
|
||||
}
|
||||
else {
|
||||
// If the value is a string, dont format it
|
||||
if (!is_string($value)) {
|
||||
$value = format_for_graph($value, $config['graph_precision']);
|
||||
$value = remove_right_zeros(format_for_graph($value, $config['graph_precision']));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,12 +50,15 @@ function include_javascript_dependencies_flot_graph($return = false) {
|
|||
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/jquery.flot.threshold.js') .'"></script>
|
||||
<script language="javascript" type="text/javascript" src="'.
|
||||
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="'.
|
||||
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/jquery.flot.axislabels.js') .'"></script>
|
||||
<script language="javascript" type="text/javascript" src="'.
|
||||
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/pandora.flot.js') .'"></script>';
|
||||
$output .= "
|
||||
<script type='text/javascript'>
|
||||
var precision_graph = " . $config['graph_precision'] . ";
|
||||
function pieHover(event, pos, obj)
|
||||
{
|
||||
if (!obj)
|
||||
|
@ -545,11 +548,11 @@ function flot_custom_pie_chart ($flash_charts, $graph_values,
|
|||
foreach ($graph_values as $label => $value) {
|
||||
if ($value['value']) {
|
||||
if ($value['value'] > 1000000)
|
||||
$legendvalue = sprintf("%sM", number_format($value['value'] / 1000000, $config['graph_precision']));
|
||||
$legendvalue = sprintf("%sM", remove_right_zeros(number_format($value['value'] / 1000000, $config['graph_precision'])));
|
||||
else if ($value['value'] > 1000)
|
||||
$legendvalue = sprintf("%sK", number_format($value['value'] / 1000, $config['graph_precision']));
|
||||
$legendvalue = sprintf("%sK", remove_right_zeros(number_format($value['value'] / 1000, $config['graph_precision'])));
|
||||
else
|
||||
$legendvalue = $value['value'];
|
||||
$legendvalue = remove_right_zeros(number_format($value['value'], $config['graph_precision']));
|
||||
}
|
||||
else
|
||||
$legendvalue = __('No data');
|
||||
|
|
|
@ -1136,35 +1136,74 @@ if (!empty($result)) {
|
|||
__('NOT INIT'), true);
|
||||
}
|
||||
elseif ($row['estado'] == 0) {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_OK,
|
||||
__('NORMAL') . ': ' . $row['datos'], true);
|
||||
if (is_numeric($row['datos'])) {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_OK,
|
||||
__('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) {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_CRITICAL,
|
||||
__('CRITICAL') . ': ' . $row['datos'], true);
|
||||
if (is_numeric($row['datos'])) {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_CRITICAL,
|
||||
__('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) {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_WARNING,
|
||||
__('WARNING') . ': ' . $row['datos'], true);
|
||||
if (is_numeric($row['datos'])) {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_WARNING,
|
||||
__('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 {
|
||||
$last_status = modules_get_agentmodule_last_status(
|
||||
$row['id_agente_modulo']);
|
||||
switch($last_status) {
|
||||
case 0:
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
||||
__('UNKNOWN') . ' - ' . __('Last status') . " " .
|
||||
__('NORMAL') . ': ' . $row['datos'], true);
|
||||
if (is_numeric($row['datos'])) {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
||||
__('UNKNOWN') . ' - ' . __('Last status') . " " .
|
||||
__('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;
|
||||
case 1:
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
||||
__('UNKNOWN') . ' - ' . __('Last status') ." " .
|
||||
__('CRITICAL') . ': ' . $row['datos'], true);
|
||||
if (is_numeric($row['datos'])) {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
||||
__('UNKNOWN') . ' - ' . __('Last status') ." " .
|
||||
__('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;
|
||||
case 2:
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
||||
__('UNKNOWN') . ' - ' . __('Last status') . " " .
|
||||
__('WARNING') . ': ' . $row['datos'], true);
|
||||
if (is_numeric($row['datos'])) {
|
||||
$data[6] = ui_print_status_image(STATUS_MODULE_UNKNOWN,
|
||||
__('UNKNOWN') . ' - ' . __('Last status') . " " .
|
||||
__('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;
|
||||
}
|
||||
}
|
||||
|
@ -1206,12 +1245,8 @@ if (!empty($result)) {
|
|||
|
||||
$link = 'winopeng(\''.$url.'?'.$graph_params_str.'\',\''.$win_handle.'\')';
|
||||
|
||||
$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: ' .
|
||||
'show_module_detail_dialog(' .
|
||||
$row['id_agente_modulo'] . ', '.
|
||||
|
@ -1246,12 +1281,12 @@ if (!empty($result)) {
|
|||
$salida = $config['render_proc_fail'];
|
||||
break;
|
||||
default:
|
||||
$salida = number_format($row['datos'], $config['graph_precision']);
|
||||
$salida = remove_right_zeros(number_format($row['datos'], $config['graph_precision']));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$salida = number_format($row['datos'], $config['graph_precision']);
|
||||
$salida = remove_right_zeros(number_format($row['datos'], $config['graph_precision']));
|
||||
}
|
||||
|
||||
// Show units ONLY in numeric data types
|
||||
|
@ -1281,19 +1316,12 @@ if (!empty($result)) {
|
|||
"id=" . $row['id_agente_modulo'] .
|
||||
"&refr=" . $row['current_interval'] .
|
||||
"&label=" . rawurlencode(urlencode(io_safe_output($row['module_name']))) . "','" . $win_handle . "', 700,480)";
|
||||
if(!is_snapshot_data($row['datos'])){
|
||||
|
||||
$salida = '<a href="javascript:' . $link . '">' .
|
||||
html_print_image('images/default_list.png', true,
|
||||
array('border' => '0',
|
||||
'alt' => '',
|
||||
'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 {
|
||||
|
||||
|
@ -1440,27 +1468,11 @@ $('#moduletype').click(function(){
|
|||
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: ") . "\"" ?>;
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
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 + extra_parameters,
|
||||
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,
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
$("#monitor_details_window").hide ()
|
||||
|
|
Loading…
Reference in New Issue