mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-27 07:34:35 +02:00
better compat between map-values and convert-custom-values options (#4902)
Co-authored-by: omercier <omercier@centreon.com>
This commit is contained in:
parent
444066f78a
commit
d1b9530e7d
@ -123,16 +123,19 @@ sub get_change_value {
|
|||||||
|
|
||||||
my $value = $options{value};
|
my $value = $options{value};
|
||||||
return '' if (!defined($options{value}));
|
return '' if (!defined($options{value}));
|
||||||
if (defined($self->{map_values}->{$options{value}})) {
|
|
||||||
|
if (defined($self->{option_results}->{convert_custom_values}) && $self->{option_results}->{convert_custom_values} ne '') {
|
||||||
|
eval "\$value = $self->{option_results}->{convert_custom_values}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defined($value) && defined($self->{map_values}->{$value})) {
|
||||||
|
$value = $self->{map_values}->{$value}
|
||||||
|
} elsif (defined($self->{map_values}->{$options{value}})) {
|
||||||
$value = $self->{map_values}->{$options{value}};
|
$value = $self->{map_values}->{$options{value}};
|
||||||
} elsif (defined($self->{option_results}->{map_value_other}) && $self->{option_results}->{map_value_other} ne '') {
|
} elsif (defined($self->{option_results}->{map_value_other}) && $self->{option_results}->{map_value_other} ne '') {
|
||||||
$value = $self->{option_results}->{map_value_other};
|
$value = $self->{option_results}->{map_value_other};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defined($self->{option_results}->{convert_custom_values}) && $self->{option_results}->{convert_custom_values} ne '') {
|
|
||||||
eval "\$value = $self->{option_results}->{convert_custom_values}";
|
|
||||||
}
|
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,9 +319,9 @@ __END__
|
|||||||
|
|
||||||
=head1 MODE
|
=head1 MODE
|
||||||
|
|
||||||
Check SNMP string values (can be a String or an Integer).
|
Check SNMP string values (can be a string or an integer).
|
||||||
|
|
||||||
Check values absent:
|
Check absent values:
|
||||||
centreon_plugins.pl --plugin=snmp_standard::plugin --mode=string-value --hostname=127.0.0.1 --snmp-version=2c --snmp-community=public
|
centreon_plugins.pl --plugin=snmp_standard::plugin --mode=string-value --hostname=127.0.0.1 --snmp-version=2c --snmp-community=public
|
||||||
--oid-table='.1.3.6.1.2.1.25.4.2.1.2' --format-ok='%{filter_rows} processes' --format-critical='processes are absent: %{details_critical}' --critical-absent='centengine' --critical-absent='crond' --filter-table-value='centengine|crond'
|
--oid-table='.1.3.6.1.2.1.25.4.2.1.2' --format-ok='%{filter_rows} processes' --format-critical='processes are absent: %{details_critical}' --critical-absent='centengine' --critical-absent='crond' --filter-table-value='centengine|crond'
|
||||||
|
|
||||||
@ -392,7 +395,7 @@ Separator uses between values (default: coma).
|
|||||||
=item B<--convert-custom-values>
|
=item B<--convert-custom-values>
|
||||||
|
|
||||||
Custom code to convert values.
|
Custom code to convert values.
|
||||||
Example to convert octetstring to macaddress: --convert-custom-values='join(":", unpack("(H2)*", $value))'
|
Example to convert octet string to MAC address: --convert-custom-values='join(":", unpack("(H2)*", $value))'
|
||||||
|
|
||||||
=item B<--use-perl-mod>
|
=item B<--use-perl-mod>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user