From c947ded618f0838beb447bcf5c35c3836c909ac3 Mon Sep 17 00:00:00 2001 From: Julien Mathis Date: Mon, 29 Jun 2009 11:55:47 +0000 Subject: [PATCH] remove warning git-svn-id: http://svn.centreon.com/trunk/plugins-2.x@8538 6bcd3966-0018-0410-8128-fd23d134de7e --- centreon-plugins/src/check_meta_service | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/centreon-plugins/src/check_meta_service b/centreon-plugins/src/check_meta_service index 38080bd06..3c8c89fa7 100644 --- a/centreon-plugins/src/check_meta_service +++ b/centreon-plugins/src/check_meta_service @@ -128,30 +128,29 @@ sub calculate_meta() { @metric_value_tab = sort(@metric_value_tab); if (defined($metric_value_tab[0])) { $result = $metric_value_tab[0]; - } - else { + } else { $result = 0; } - } - elsif ($calculation eq "MAX") { + } elsif ($calculation eq "MAX") { @metric_value_tab = sort(@metric_value_tab); if (defined($metric_value_tab[0])) { $result = $metric_value_tab[scalar(@metric_value_tab) - 1]; - } - else { + } else { $result = 0; } - } - elsif ($calculation eq "SOM") { + } elsif ($calculation eq "SOM") { $result = 0; foreach $val (@metric_value_tab) { - $result += $val; + if ($val) { + $result += $val; + } } - } - elsif ($calculation eq "AVE") { + } elsif ($calculation eq "AVE") { $result = 0; foreach $val (@metric_value_tab) { - $result += $val; + if ($val) { + $result = $result + $val; + } } $total = scalar(@metric_value_tab); if (!$total) { @@ -215,7 +214,7 @@ sub retrieve_by_list() { while ($row4->{'perfdata'} =~ m/\'?([a-zA-Z0-9\_\-\/\.\:\ ]+)\'?=([0-9\.\,\-]+)/g) { if (defined($1) && defined($2) && $1 =~ $row3->{'metric_name'}) { - $metric_value_tab[$2] = $2; + $metric_value_tab[$i] = $2; $i++; } }