mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-27 07:34:35 +02:00
fix(eclipse-mosquitto-mqtt): fix stringvalue mode regexp threshold (#5278)
Refs: CTOR-789
This commit is contained in:
parent
27541845b8
commit
2a165e1e50
@ -70,12 +70,14 @@ sub custom_stringvalue_threshold {
|
|||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
my $severity = 'ok';
|
my $severity = 'ok';
|
||||||
|
my $value = $self->{result_values}->{stringvalue};
|
||||||
|
my $option_results = $self->{instance_mode}->{option_results};
|
||||||
foreach my $check_severity (('critical', 'warning', 'unknown')) {
|
foreach my $check_severity (('critical', 'warning', 'unknown')) {
|
||||||
next if (centreon::plugins::misc::is_empty($self->{option_results}->{$check_severity . '_regexp'}));
|
next if (centreon::plugins::misc::is_empty($option_results->{$check_severity . '_regexp'}));
|
||||||
my $regexp = $self->{option_results}->{$check_severity . '_regexp'};
|
my $regexp = $option_results->{$check_severity . '_regexp'};
|
||||||
if (defined($self->{option_results}->{use_iregexp}) && $options{value} =~ /$regexp/i) {
|
if (defined($option_results->{use_iregexp}) && $value =~ /$regexp/i) {
|
||||||
$severity = $check_severity;
|
$severity = $check_severity;
|
||||||
} elsif (!defined($self->{option_results}->{use_iregexp}) && $options{value} =~ /$regexp/) {
|
} elsif (!defined($option_results->{use_iregexp}) && $value =~ /$regexp/) {
|
||||||
$severity = $check_severity;
|
$severity = $check_severity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -93,7 +95,7 @@ sub set_counters {
|
|||||||
$self->{maps_counters}->{global} = [
|
$self->{maps_counters}->{global} = [
|
||||||
{ label => 'generic',
|
{ label => 'generic',
|
||||||
set => {
|
set => {
|
||||||
key_values => [{ name => 'stringvalue' }],
|
key_values => [ { name => 'stringvalue' } ],
|
||||||
closure_custom_output => $self->can('custom_stringvalue_output'),
|
closure_custom_output => $self->can('custom_stringvalue_output'),
|
||||||
closure_custom_threshold_check => \&custom_stringvalue_threshold
|
closure_custom_threshold_check => \&custom_stringvalue_threshold
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user