diff --git a/apps/selenium/mode/scenariokatalon.pm b/apps/selenium/mode/scenariokatalon.pm index 66410b082..1d479cfe4 100644 --- a/apps/selenium/mode/scenariokatalon.pm +++ b/apps/selenium/mode/scenariokatalon.pm @@ -235,17 +235,7 @@ sub check_options { $self->{output}->option_exit(); } - $self->change_macros(); -} - -sub change_macros { - my ($self, %options) = @_; - - foreach (('warning_state', 'critical_state')) { - if (defined($self->{option_results}->{$_})) { - $self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g; - } - } + $self->change_macros(macros => ['warning_state', 'critical_state']); } sub manage_selection { diff --git a/centreon/plugins/templates/counter.pm b/centreon/plugins/templates/counter.pm index 32a7006b8..6d32fa039 100644 --- a/centreon/plugins/templates/counter.pm +++ b/centreon/plugins/templates/counter.pm @@ -425,6 +425,16 @@ sub manage_selection { #$self->{cache_name} = "choose_name_" . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' . $self->{mode} . '_' . # (defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all')); } + +sub change_macros { + my ($self, %options) = @_; + + foreach (@{$options{macros}}) { + if (defined($self->{option_results}->{$_})) { + $self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g; + } + } +} 1; diff --git a/hardware/ups/apc/snmp/mode/batterystatus.pm b/hardware/ups/apc/snmp/mode/batterystatus.pm index 9a9abba3b..e9682342f 100644 --- a/hardware/ups/apc/snmp/mode/batterystatus.pm +++ b/hardware/ups/apc/snmp/mode/batterystatus.pm @@ -125,17 +125,7 @@ sub check_options { my ($self, %options) = @_; $self->SUPER::check_options(%options); - $self->change_macros(); -} - -sub change_macros { - my ($self, %options) = @_; - - foreach (('warning_status', 'critical_status', 'unknown_status')) { - if (defined($self->{option_results}->{$_})) { - $self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g; - } - } + $self->change_macros(macros => ['warning_status', 'critical_status', 'unknown_status']); } my %map_battery_status = (