diff --git a/storage/quantum/dxi/ssh/mode/dedupvtl.pm b/storage/quantum/dxi/ssh/mode/dedupvtl.pm index 5c4502bbb..ac4f20e1b 100644 --- a/storage/quantum/dxi/ssh/mode/dedupvtl.pm +++ b/storage/quantum/dxi/ssh/mode/dedupvtl.pm @@ -25,32 +25,7 @@ use strict; use warnings; use DateTime; - - my $instance_mode; - - sub custom_status_threshold { - my ($self, %options) = @_; - my $status = 'ok'; - my $message; - - eval { - local $SIG{__WARN__} = sub { $message = $_[0]; }; - local $SIG{__DIE__} = sub { $message = $_[0]; }; - - if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' && - eval "$instance_mode->{option_results}->{critical_status}") { - $status = 'critical'; - } elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' && - eval "$instance_mode->{option_results}->{warning_status}") { - $status = 'warning'; - } - }; - if (defined($message)) { - $self->{output}->output_add(long_msg => 'filter status issue: ' . $message); - } - - return $status; - } + use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold); sub custom_status_output { my ($self, %options) = @_; @@ -89,6 +64,7 @@ sub prefix_output { my ($self, %options) = @_; + return "VTL deduplication '" . $options{instance_value}->{name} . "' "; } @@ -106,7 +82,7 @@ closure_custom_calc => $self->can('custom_status_calc'), closure_custom_output => $self->can('custom_status_output'), closure_custom_perfdata => sub { return 0; }, - closure_custom_threshold_check => $self->can('custom_status_threshold'), + closure_custom_threshold_check => \&catalog_status_threshold, } }, { label => 'original-data-size', set => { @@ -164,18 +140,7 @@ $self->{option_results}->{remote} = 1; } - $instance_mode = $self; - $self->change_macros(); - } - - sub change_macros { - my ($self, %options) = @_; - - foreach (('warning_status', 'critical_status')) { - if (defined($self->{option_results}->{$_})) { - $self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g; - } - } + $self->change_macros(macros => ['warning_status', 'critical_status']); } sub manage_selection { @@ -241,7 +206,8 @@ 1; - + __END__ + =head1 MODE Check deduped VTL on source.