diff --git a/centreon-plugins/apps/backup/veeam/local/mode/jobstatus.pm b/centreon-plugins/apps/backup/veeam/local/mode/jobstatus.pm index 90f268eb0..7ef1aae0b 100644 --- a/centreon-plugins/apps/backup/veeam/local/mode/jobstatus.pm +++ b/centreon-plugins/apps/backup/veeam/local/mode/jobstatus.pm @@ -26,7 +26,7 @@ use strict; use warnings; use centreon::common::powershell::veeam::jobstatus; use apps::backup::veeam::local::mode::resources::types qw($job_type $job_result); -use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold catalog_status_calc); +use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold); use centreon::plugins::misc; use JSON::XS; @@ -65,7 +65,7 @@ sub set_counters { ]; $self->{maps_counters}->{global} = [ - { label => 'total', set => { + { label => 'total', nlabel => 'jobs.total.count', set => { key_values => [ { name => 'total' } ], output_template => 'Total Jobs : %s', perfdatas => [ @@ -78,7 +78,6 @@ sub set_counters { $self->{maps_counters}->{job} = [ { label => 'status', threshold => 0, set => { key_values => [ { name => 'status' }, { name => 'display' }, { name => 'type' }, { name => 'is_running' } ], - closure_custom_calc => \&catalog_status_calc, closure_custom_output => $self->can('custom_status_output'), closure_custom_perfdata => sub { return 0; }, closure_custom_threshold_check => \&catalog_status_threshold diff --git a/centreon-plugins/apps/backup/veeam/local/mode/tapejobs.pm b/centreon-plugins/apps/backup/veeam/local/mode/tapejobs.pm index a9228e996..e0726e15c 100644 --- a/centreon-plugins/apps/backup/veeam/local/mode/tapejobs.pm +++ b/centreon-plugins/apps/backup/veeam/local/mode/tapejobs.pm @@ -26,7 +26,7 @@ use strict; use warnings; use centreon::common::powershell::veeam::tapejobs; use apps::backup::veeam::local::mode::resources::types qw($job_tape_type $job_tape_result $job_tape_state); -use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold); +use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng); use centreon::plugins::misc; use JSON::XS; @@ -41,6 +41,12 @@ sub custom_status_output { ); } +sub prefix_job_output { + my ($self, %options) = @_; + + return "Tape job '" . $options{instance_value}->{display} . "' "; +} + sub set_counters { my ($self, %options) = @_; @@ -61,7 +67,7 @@ sub set_counters { ]; $self->{maps_counters}->{job} = [ - { label => 'status', threshold => 0, set => { + { label => 'status', type => 2, critical => '%{enabled} == 1 and not %{last_result} =~ /Success|None/i', set => { key_values => [ { name => 'display' }, { name => 'enabled' }, { name => 'type' }, { name => 'last_result' }, @@ -69,7 +75,7 @@ sub set_counters { ], closure_custom_output => $self->can('custom_status_output'), closure_custom_perfdata => sub { return 0; }, - closure_custom_threshold_check => \&catalog_status_threshold + closure_custom_threshold_check => \&catalog_status_threshold_ng } } ]; @@ -81,36 +87,20 @@ sub new { bless $self, $class; $options{options}->add_options(arguments => { - 'timeout:s' => { name => 'timeout', default => 50 }, - 'command:s' => { name => 'command', default => 'powershell.exe' }, - 'command-path:s' => { name => 'command_path' }, - 'command-options:s' => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' }, - 'no-ps' => { name => 'no_ps' }, - 'ps-exec-only' => { name => 'ps_exec_only' }, - 'ps-display' => { name => 'ps_display' }, - 'filter-name:s' => { name => 'filter_name' }, - 'filter-type:s' => { name => 'filter_type' }, - 'unknown-status:s' => { name => 'unknown_status', default => '' }, - 'warning-status:s' => { name => 'warning_status', default => '' }, - 'critical-status:s' => { name => 'critical_status', default => '%{enabled} == 1 and not %{last_result} =~ /Success|None/i' } + 'timeout:s' => { name => 'timeout', default => 50 }, + 'command:s' => { name => 'command', default => 'powershell.exe' }, + 'command-path:s' => { name => 'command_path' }, + 'command-options:s' => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' }, + 'no-ps' => { name => 'no_ps' }, + 'ps-exec-only' => { name => 'ps_exec_only' }, + 'ps-display' => { name => 'ps_display' }, + 'filter-name:s' => { name => 'filter_name' }, + 'filter-type:s' => { name => 'filter_type' } }); return $self; } -sub check_options { - my ($self, %options) = @_; - $self->SUPER::check_options(%options); - - $self->change_macros(macros => ['unknown_status', 'warning_status', 'critical_status']); -} - -sub prefix_job_output { - my ($self, %options) = @_; - - return "Tape job '" . $options{instance_value}->{display} . "' "; -} - sub manage_selection { my ($self, %options) = @_; @@ -171,7 +161,7 @@ sub manage_selection { $self->{output}->output_add(long_msg => "skipping job '" . $job->{name} . "': no matching filter type.", debug => 1); next; } - + $self->{job}->{ $job->{name} } = { display => $job->{name}, type => $job_tape_type->{ $job->{type} },