mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-27 23:54:18 +02:00
enh(netbackup): metrics v2 (#3271)
This commit is contained in:
parent
55f4dacc8c
commit
fb483ebe69
@ -63,9 +63,9 @@ sub set_counters {
|
|||||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'usage', set => {
|
{ label => 'usage', nlabel => 'disk_pool.deduplication.usage.percentage', set => {
|
||||||
key_values => [ { name => 'usage' }, { name => 'watermark' }, { name => 'display' } ],
|
key_values => [ { name => 'usage' }, { name => 'watermark' }, { name => 'display' } ],
|
||||||
output_template => 'Use: %s %%',
|
output_template => 'use: %s %%',
|
||||||
closure_custom_threshold_check => $self->can('custom_usage_threshold'),
|
closure_custom_threshold_check => $self->can('custom_usage_threshold'),
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'used', template => '%s',
|
{ label => 'used', template => '%s',
|
||||||
|
@ -33,7 +33,7 @@ sub set_counters {
|
|||||||
];
|
];
|
||||||
|
|
||||||
$self->{maps_counters}->{drive} = [
|
$self->{maps_counters}->{drive} = [
|
||||||
{ label => 'cleaning', set => {
|
{ label => 'cleaning', nlabel => 'drives.unclean.count', set => {
|
||||||
key_values => [ { name => 'num_cleaning' }, { name => 'total' } ],
|
key_values => [ { name => 'num_cleaning' }, { name => 'total' } ],
|
||||||
output_template => '%d drives needs a reset mount time',
|
output_template => '%d drives needs a reset mount time',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
|
@ -88,6 +88,24 @@ sub custom_frozen_calc {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub policy_long_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
return "Checking policy '" . $options{instance_value}->{display} . "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub prefix_policy_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
return "Policy '" . $options{instance_value}->{display} . "' ";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub prefix_job_output {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
return "Job '" . $options{instance_value}->{display} . "' [Type: " . $options{instance_value}->{type} . "] [State: " . $options{instance_value}->{state} . "] " ;
|
||||||
|
}
|
||||||
|
|
||||||
sub set_counters {
|
sub set_counters {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
@ -100,9 +118,9 @@ sub set_counters {
|
|||||||
];
|
];
|
||||||
|
|
||||||
$self->{maps_counters}->{global} = [
|
$self->{maps_counters}->{global} = [
|
||||||
{ label => 'total', set => {
|
{ label => 'total', nlabel = 'jobs.total.count', set => {
|
||||||
key_values => [ { name => 'total' } ],
|
key_values => [ { name => 'total' } ],
|
||||||
output_template => 'Total Jobs : %s',
|
output_template => 'total jobs : %s',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'total', value => 'total', template => '%s', min => 0 }
|
{ label => 'total', value => 'total', template => '%s', min => 0 }
|
||||||
]
|
]
|
||||||
@ -172,24 +190,6 @@ sub check_options {
|
|||||||
$self->change_macros(macros => ['ok_status', 'warning_status', 'critical_status']);
|
$self->change_macros(macros => ['ok_status', 'warning_status', 'critical_status']);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub policy_long_output {
|
|
||||||
my ($self, %options) = @_;
|
|
||||||
|
|
||||||
return "Checking policy '" . $options{instance_value}->{display} . "'";
|
|
||||||
}
|
|
||||||
|
|
||||||
sub prefix_policy_output {
|
|
||||||
my ($self, %options) = @_;
|
|
||||||
|
|
||||||
return "Policy '" . $options{instance_value}->{display} . "' ";
|
|
||||||
}
|
|
||||||
|
|
||||||
sub prefix_job_output {
|
|
||||||
my ($self, %options) = @_;
|
|
||||||
|
|
||||||
return "Job '" . $options{instance_value}->{display} . "' [Type: " . $options{instance_value}->{type} . "] [State: " . $options{instance_value}->{state} . "] " ;
|
|
||||||
}
|
|
||||||
|
|
||||||
my %job_type = (
|
my %job_type = (
|
||||||
0 => 'backup', 1 => 'archive', 2 => 'restore', 3 => 'verify', 4 => 'duplicate', 5 => 'phase 1 or phase 2 import',
|
0 => 'backup', 1 => 'archive', 2 => 'restore', 3 => 'verify', 4 => 'duplicate', 5 => 'phase 1 or phase 2 import',
|
||||||
6 => 'catalog backup', 7 => 'vault duplicate', 8 => 'label tape', 9 => 'erase tape',
|
6 => 'catalog backup', 7 => 'vault duplicate', 8 => 'label tape', 9 => 'erase tape',
|
||||||
|
@ -29,9 +29,11 @@ sub custom_usage_perfdata {
|
|||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
my $label = 'used';
|
my $label = 'used';
|
||||||
|
my $nlabel = $self->{option_results}->{units} eq '%' ? 'tape.usage.percentage' : 'tape.usage.bytes';
|
||||||
my $value_perf = $self->{result_values}->{used};
|
my $value_perf = $self->{result_values}->{used};
|
||||||
if (defined($self->{instance_mode}->{option_results}->{free})) {
|
if (defined($self->{instance_mode}->{option_results}->{free})) {
|
||||||
$label = 'free';
|
$label = 'free';
|
||||||
|
$nlabel = $self->{option_results}->{units} eq '%' ? 'tape.free.usage.percentage' : 'tape.free.usage.bytes';
|
||||||
$value_perf = $self->{result_values}->{free};
|
$value_perf = $self->{result_values}->{free};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,6 +45,7 @@ sub custom_usage_perfdata {
|
|||||||
|
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => $label,
|
label => $label,
|
||||||
|
nlabel => $nlabel,
|
||||||
value => $value_perf,
|
value => $value_perf,
|
||||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label}, %total_options),
|
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label}, %total_options),
|
||||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label}, %total_options),
|
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label}, %total_options),
|
||||||
@ -68,7 +71,7 @@ sub custom_usage_output {
|
|||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
return sprintf(
|
return sprintf(
|
||||||
"Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)",
|
"total: %s used: %s (%.2f%%) free: %s (%.2f%%)",
|
||||||
$self->{result_values}->{total},
|
$self->{result_values}->{total},
|
||||||
$self->{result_values}->{used}, $self->{result_values}->{prct_used},
|
$self->{result_values}->{used}, $self->{result_values}->{prct_used},
|
||||||
$self->{result_values}->{free}, $self->{result_values}->{prct_free}
|
$self->{result_values}->{free}, $self->{result_values}->{prct_free}
|
||||||
|
@ -30,14 +30,14 @@ sub new {
|
|||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$self->{version} = '0.1';
|
$self->{version} = '0.1';
|
||||||
%{$self->{modes}} = (
|
$self->{modes} = {
|
||||||
'dedup-status' => 'apps::backup::netbackup::local::mode::dedupstatus',
|
'dedup-status' => 'apps::backup::netbackup::local::mode::dedupstatus',
|
||||||
'drive-cleaning' => 'apps::backup::netbackup::local::mode::drivecleaning',
|
'drive-cleaning' => 'apps::backup::netbackup::local::mode::drivecleaning',
|
||||||
'drive-status' => 'apps::backup::netbackup::local::mode::drivestatus',
|
'drive-status' => 'apps::backup::netbackup::local::mode::drivestatus',
|
||||||
'job-status' => 'apps::backup::netbackup::local::mode::jobstatus',
|
'job-status' => 'apps::backup::netbackup::local::mode::jobstatus',
|
||||||
'list-policies' => 'apps::backup::netbackup::local::mode::listpolicies',
|
'list-policies' => 'apps::backup::netbackup::local::mode::listpolicies',
|
||||||
'tape-usage' => 'apps::backup::netbackup::local::mode::tapeusage'
|
'tape-usage' => 'apps::backup::netbackup::local::mode::tapeusage'
|
||||||
);
|
};
|
||||||
|
|
||||||
$self->{custom_modes}->{cli} = 'centreon::plugins::script_custom::cli';
|
$self->{custom_modes}->{cli} = 'centreon::plugins::script_custom::cli';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user