2011-08-16 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_graph.php, operation/agentes/stat_win.php: fixeds to
	show always units, and now show only avg by default, and now run the
	showing baseline again.
	
	Fixes: #3390113



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4745 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2011-08-16 17:09:43 +00:00
parent 95fb9a34c9
commit 75a01d0d15
3 changed files with 76 additions and 26 deletions

View File

@ -1,3 +1,11 @@
2011-08-16 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, operation/agentes/stat_win.php: fixeds to
show always units, and now show only avg by default, and now run the
showing baseline again.
Fixes: #3390113
2011-08-16 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* pandoradb.oracle.sql

View File

@ -34,6 +34,8 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
global $config;
global $graphic_type;
enterprise_include_once("include/functions_reporting.php");
// Set variables
if ($date == 0) $date = get_system_time();
$datelimit = $date - $period;
@ -122,19 +124,24 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
if ($data[0]['utimestamp'] == $datelimit) {
$previous_data = $data[0]['datos'];
$j++;
} else {
}
else {
$previous_data = 0;
}
// Get baseline data
$baseline_data = array ();
if ($baseline == 1) {
$baseline_data = enterprise_hook ('reporting_enterprise_get_baseline', array ($agent_module_id, $period, $width, $height , $title, $unit_name, $date));
if ($baseline_data === ENTERPRISE_NOT_HOOK) {
$baseline_data = array ();
if ($baseline) {
$baseline_data = array ();
if ($baseline == 1) {
$baseline_data = enterprise_hook ('reporting_enterprise_get_baseline', array ($agent_module_id, $period, $width, $height , $title, $unit_name, $date));
if ($baseline_data === ENTERPRISE_NOT_HOOK) {
$baseline_data = array ();
}
}
}
$units = modules_get_unit($agent_module_id);
// Calculate chart data
for ($i = 0; $i < $resolution; $i++) {
$timestamp = $datelimit + ($interval * $i);
@ -210,20 +217,37 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
// Data
if ($count > 0) {
$chart[$timestamp]['sum'] = $total;
$chart[$timestamp]['min'] = $interval_min;
$chart[$timestamp]['max'] = $interval_max;
if ($avg_only) {
$chart[$timestamp]['sum'] = $total;
}
else {
$chart[$timestamp]['sum'] = $total;
$chart[$timestamp]['min'] = $interval_min;
$chart[$timestamp]['max'] = $interval_max;
}
$previous_data = $total;
// Compressed data
} else {
}
else {
if ($uncompressed_module || ($timestamp > time ())) {
$chart[$timestamp]['sum'] = 0;
$chart[$timestamp]['min'] = 0;
$chart[$timestamp]['max'] = 0;
} else {
$chart[$timestamp]['sum'] = $previous_data;
$chart[$timestamp]['min'] = $previous_data;
$chart[$timestamp]['max'] = $previous_data;
if ($avg_only) {
$chart[$timestamp]['sum'] = 0;
}
else {
$chart[$timestamp]['sum'] = 0;
$chart[$timestamp]['min'] = 0;
$chart[$timestamp]['max'] = 0;
}
}
else {
if ($avg_only) {
$chart[$timestamp]['sum'] = $previous_data;
}
else {
$chart[$timestamp]['sum'] = $previous_data;
$chart[$timestamp]['min'] = $previous_data;
$chart[$timestamp]['max'] = $previous_data;
}
}
}
@ -238,12 +262,16 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
if($show_alerts) {
$chart[$timestamp]['alert'] = $alert_value;
}
$chart[$timestamp]['baseline'] = array_shift ($baseline_data);
if ($chart[$timestamp]['baseline'] == NULL) {
$chart[$timestamp]['baseline'] = 0;
if ($baseline) {
$chart[$timestamp]['baseline'] = array_shift ($baseline_data);
if ($chart[$timestamp]['baseline'] == NULL) {
$chart[$timestamp]['baseline'] = 0;
}
}
if (!empty($units)) {
$chart[$timestamp]['unit'] = 0;
}
$units = modules_get_unit($agent_module_id);
$chart[$timestamp]['unit'] = 0;
}
// Return chart data and don't draw

View File

@ -96,6 +96,15 @@ function getTermEle(ele) {
}
return ele;
}
function show_others() {
if (!$("#checkbox-avg_only").attr('checked')) {
$("#hidden-show_other").val(1);
}
else {
$("#hidden-show_other").val(0);
}
}
//-->
</script>
</head>
@ -111,7 +120,11 @@ if (!isset($_GET["period"]) OR (!isset($_GET["id"]))) {
$period = get_parameter ( "period", 3600);
$draw_alerts = get_parameter("draw_alerts", 0);
$avg_only = get_parameter ("avg_only", 0);
$avg_only = get_parameter ("avg_only", 1);
$show_other = (bool)get_parameter('show_other', false);
if ($show_other) {
$avg_only = 0;
}
$period = get_parameter ("period", 86400);
$id = get_parameter ("id", 0);
$width = get_parameter ("width", 555);
@ -186,7 +199,8 @@ html_print_input_text ("refresh", $refresh, '', 5);
echo '&nbsp;&nbsp;&nbsp;'.__('Avg. Only');
html_print_checkbox ("avg_only", 1, (bool) $avg_only);
html_print_checkbox ("avg_only", 1, (bool) $avg_only, false, false, 'show_others()');
html_print_input_hidden('show_other', 0);
echo '<tr><td>'.__('Begin date').'</td><td>';