2012-01-31 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* include/functions_reporting: Fixed bug when the module has only 
	one value.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5455 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2012-01-31 12:52:22 +00:00
parent 6a82c5c0a9
commit 16e724fb57
2 changed files with 22 additions and 22 deletions

View File

@ -1,3 +1,8 @@
2012-01-31 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_reporting: Fixed bug when the module has only
one value.
2012-01-31 Vanessa Gil <vanessa.gil@artica.es>
* include/functions_reporting: Modified SLA reports when

View File

@ -718,29 +718,24 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
$first_data = array_shift ($interval_data);
$previous_utimestamp = $date - $period;
if ($previous_utimestamp == $first_data['utimestamp']) {
$previous_value = $first_data ['datos'];
$previous_status = 0;
if ($previous_value < 0) {// 4 for the Unknown value
$previous_status = 4;
} elseif ((($previous_value > ($min_value - $percent)) && ($previous_value < ($min_value + $percent))) ||
(($previous_value > ($max_value - $percent)) && ($previous_value < ($max_value + $percent)))) {//2 when value is within the edges
$previous_status = 2;
} elseif (($previous_value >= ($min_value + $percent)) && ($previous_value <= ($max_value - $percent))) { //1 when value is OK
$previous_status = 1;
} elseif (($previous_value <= ($min_value - $percent)) || ($previous_value >= ($max_value + $percent))) { //3 when value is Wrong
$previous_status = 3;
}
foreach ($downtime_dates as $date_dt) {
if (($date_dt['date_from'] <= $first_data['utimestamp']) AND ($date_dt['date_to'] >= $first_data['utimestamp'])) {
$previous_status = 1;
}
}
}
else {
$previous_value = $first_data ['datos'];
$previous_status = 0;
if ($previous_value < 0) {// 4 for the Unknown value
$previous_status = 4;
} elseif ((($previous_value > ($min_value - $percent)) && ($previous_value < ($min_value + $percent))) ||
(($previous_value > ($max_value - $percent)) && ($previous_value < ($max_value + $percent)))) {//2 when value is within the edges
$previous_status = 2;
} elseif (($previous_value >= ($min_value + $percent)) && ($previous_value <= ($max_value - $percent))) { //1 when value is OK
$previous_status = 1;
} elseif (($previous_value <= ($min_value - $percent)) || ($previous_value >= ($max_value + $percent))) { //3 when value is Wrong
$previous_status = 3;
}
foreach ($downtime_dates as $date_dt) {
if (($date_dt['date_from'] <= $first_data['utimestamp']) AND ($date_dt['date_to'] >= $first_data['utimestamp'])) {
$previous_status = 1;
}
}
$data_colors = array();