2010-07-28 Junichi Satoh <junichi@rworks.jp>

* lib/PandoraFMS/PredictionServer.pm: Fixed problem that pandora
	server daemon is aborted by division by zero, if numeric data to
	predict are mostly 0.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3071 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
jsatoh 2010-07-28 01:10:27 +00:00
parent 986a09f3ea
commit 077a4e43c9
2 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2010-07-28 Junichi Satoh <junichi@rworks.jp>
* lib/PandoraFMS/PredictionServer.pm: Fixed problem that pandora
server daemon is aborted by division by zero, if numeric data to
predict are mostly 0.
2010-07-27 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Core.pm: Make sure delete_pending is set to 0

View File

@ -205,7 +205,7 @@ sub exec_prediction_module ($$$$) {
next unless defined ($first_data);
$sum_data++ if ($last_data != 0);
$sum_data++ if ($first_data != 0);
$week_data[$i] = (($last_data + $first_data) / $sum_data);
$week_data[$i] = ($sum_data > 0) ? (($last_data + $first_data) / $sum_data) : 0;
} else {
$week_data[$i] = $average_interval;
}
@ -232,7 +232,7 @@ sub exec_prediction_module ($$$$) {
$typical_deviation = $typical_deviation + (($week_data[$i] - $average)**2);
}
}
$typical_deviation = sqrt ($typical_deviation / ($n-1));
$typical_deviation = ($n > 1) ? sqrt ($typical_deviation / ($n-1)) : 0;
my $current_value = get_db_value ($dbh, 'SELECT datos FROM tagente_estado WHERE id_agente_modulo = ?', $target_module->{'id_agente_modulo'});
if ( ($current_value > ($average - $typical_deviation)) && ($current_value < ($average + $typical_deviation)) ){