remove warning

git-svn-id: http://svn.centreon.com/trunk/plugins-2.x@8538 6bcd3966-0018-0410-8128-fd23d134de7e
This commit is contained in:
Julien Mathis 2009-06-29 11:55:47 +00:00
parent 775626a107
commit c947ded618
1 changed files with 12 additions and 13 deletions

View File

@ -128,30 +128,29 @@ sub calculate_meta() {
@metric_value_tab = sort(@metric_value_tab); @metric_value_tab = sort(@metric_value_tab);
if (defined($metric_value_tab[0])) { if (defined($metric_value_tab[0])) {
$result = $metric_value_tab[0]; $result = $metric_value_tab[0];
} } else {
else {
$result = 0; $result = 0;
} }
} } elsif ($calculation eq "MAX") {
elsif ($calculation eq "MAX") {
@metric_value_tab = sort(@metric_value_tab); @metric_value_tab = sort(@metric_value_tab);
if (defined($metric_value_tab[0])) { if (defined($metric_value_tab[0])) {
$result = $metric_value_tab[scalar(@metric_value_tab) - 1]; $result = $metric_value_tab[scalar(@metric_value_tab) - 1];
} } else {
else {
$result = 0; $result = 0;
} }
} } elsif ($calculation eq "SOM") {
elsif ($calculation eq "SOM") {
$result = 0; $result = 0;
foreach $val (@metric_value_tab) { foreach $val (@metric_value_tab) {
$result += $val; if ($val) {
$result += $val;
}
} }
} } elsif ($calculation eq "AVE") {
elsif ($calculation eq "AVE") {
$result = 0; $result = 0;
foreach $val (@metric_value_tab) { foreach $val (@metric_value_tab) {
$result += $val; if ($val) {
$result = $result + $val;
}
} }
$total = scalar(@metric_value_tab); $total = scalar(@metric_value_tab);
if (!$total) { if (!$total) {
@ -215,7 +214,7 @@ sub retrieve_by_list() {
while ($row4->{'perfdata'} =~ m/\'?([a-zA-Z0-9\_\-\/\.\:\ ]+)\'?=([0-9\.\,\-]+)/g) { while ($row4->{'perfdata'} =~ m/\'?([a-zA-Z0-9\_\-\/\.\:\ ]+)\'?=([0-9\.\,\-]+)/g) {
if (defined($1) && defined($2) && $1 =~ $row3->{'metric_name'}) { if (defined($1) && defined($2) && $1 =~ $row3->{'metric_name'}) {
$metric_value_tab[$2] = $2; $metric_value_tab[$i] = $2;
$i++; $i++;
} }
} }