git-svn-id: http://svn.centreon.com/trunk/plugins-2.x@9171 6bcd3966-0018-0410-8128-fd23d134de7e
This commit is contained in:
Julien Mathis 2009-10-07 13:27:28 +00:00
parent feca2ed006
commit 4039ecd486
1 changed files with 15 additions and 8 deletions

View File

@ -77,6 +77,7 @@ my $critical;
my $calculation;
my $regexp;
my $metric_select;
my $display;
###############
# HELP FUNCTION
@ -234,7 +235,7 @@ sub retrieve_by_list() {
## First query
##
##################################################
my $query = "SELECT calcul_type, regexp_str, warning, critical, metric, meta_select_mode FROM `meta_service` WHERE meta_id = '".$OPTION{'id'}."' LIMIT 1";
my $query = "SELECT meta_display, calcul_type, regexp_str, warning, critical, metric, meta_select_mode FROM `meta_service` WHERE meta_id = '".$OPTION{'id'}."' LIMIT 1";
my $DBRES = $dbh->prepare($query);
if (!$DBRES->execute) {die "Error:" . $DBRES->errstr . "\n";}
$row = $DBRES->fetchrow_hashref();
@ -253,11 +254,13 @@ $critical = $row->{'critical'};
$calculation = $row->{'calcul_type'};
$regexp = $row->{'regexp_str'};
$metric_select = $row->{'metric'};
$display = $row->{'meta_display'};
my $selection_mode = $row->{'meta_select_mode'};
if ($selection_mode eq '2') {
retrieve_by_regexp();
retrieve_by_regexp();
}
else {
retrieve_by_list();
@ -286,18 +289,22 @@ if (defined($warning) && defined($critical)) {
}
}
if ($calculation eq "AVE") {
if (!defined($display) || !$display) {
if ($calculation eq "AVE") {
$msg .= "Average - ";
} elsif ($calculation eq "SOM") {
} elsif ($calculation eq "SOM") {
$msg .= "Sum - ";
} elsif ($calculation eq "MIN") {
} elsif ($calculation eq "MIN") {
$msg .= "Min - ";
} elsif ($calculation eq "MAX") {
} elsif ($calculation eq "MAX") {
$msg .= "Max - ";
}
$msg .= "value : " . $res . "|value=".$res;
} else {
$msg = sprintf($display, $res);
$msg .= "|value=".$res;
}
$msg .= "value : " . $res . "|value=".$res;
##############
# PRINT RESULT
##############