From cc370eb5fbcdef9d0a6330b129482b020a008f46 Mon Sep 17 00:00:00 2001 From: qgarnier Date: Fri, 6 Nov 2020 14:28:55 +0100 Subject: [PATCH] fix json (#2327) --- apps/protocols/http/mode/jsoncontent.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/protocols/http/mode/jsoncontent.pm b/apps/protocols/http/mode/jsoncontent.pm index 338f1674c..cbca8e453 100644 --- a/apps/protocols/http/mode/jsoncontent.pm +++ b/apps/protocols/http/mode/jsoncontent.pm @@ -231,12 +231,12 @@ sub lookup { my $count = 0; foreach my $value (@{$self->{values}}) { $count++; - if ($value =~ /^[0-9.]+$/) { - $value = centreon::plugins::misc::expand_exponential(value => $value); + if ($value =~ /^(?:[0-9.]+|([0-9.]*)e([-+]?)(\d*))$/) { + my $value_expand = centreon::plugins::misc::expand_exponential(value => $value); if ($self->{option_results}->{threshold_value} eq 'values') { my $exit = lc( $self->{perfdata}->threshold_check( - value => $value, + value => $value_expand, threshold => [ { label => 'critical-numeric', exit_litteral => 'critical' }, { label => 'warning-numeric', exit_litteral => 'warning' } ] ) ); @@ -245,7 +245,7 @@ sub lookup { } $self->{output}->perfdata_add( label => 'element_' . $count, - value => $value, + value => $value_expand, warning => $self->{option_results}->{threshold_value} eq 'values' ? $self->{perfdata}->get_perfdata_for_output(label => 'warning-numeric') : undef, critical => $self->{option_results}->{threshold_value} eq 'values' ? $self->{perfdata}->get_perfdata_for_output(label => 'critical-numeric') : undef );