enhance netapp ontap rest api volumes
This commit is contained in:
parent
b8de1d26cc
commit
4a7e0a0eab
|
@ -24,7 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||||
use Digest::MD5 qw(md5_hex);
|
use Digest::MD5 qw(md5_hex);
|
||||||
|
|
||||||
sub custom_status_output {
|
sub custom_status_output {
|
||||||
|
@ -121,11 +121,11 @@ sub set_counters {
|
||||||
];
|
];
|
||||||
|
|
||||||
$self->{maps_counters}->{nodes} = [
|
$self->{maps_counters}->{nodes} = [
|
||||||
{ label => 'node-status', threshold => 0, set => {
|
{ label => 'node-status', type => 2, critical_default => '%{state} ne "online"', set => {
|
||||||
key_values => [ { name => 'state' }, { name => 'link_status' }, { name => 'display' } ],
|
key_values => [ { name => 'state' }, { name => 'link_status' }, { name => 'display' } ],
|
||||||
closure_custom_output => $self->can('custom_status_output'),
|
closure_custom_output => $self->can('custom_status_output'),
|
||||||
closure_custom_perfdata => sub { return 0; },
|
closure_custom_perfdata => sub { return 0; },
|
||||||
closure_custom_threshold_check => \&catalog_status_threshold
|
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -137,21 +137,11 @@ sub new {
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
'unknown-node-status:s' => { name => 'unknown_node_status', default => '' },
|
|
||||||
'warning-node-status:s' => { name => 'warning_node_status', default => '' },
|
|
||||||
'critical-node-status:s' => { name => 'critical_node_status', default => '%{state} ne "online"' }
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check_options {
|
|
||||||
my ($self, %options) = @_;
|
|
||||||
$self->SUPER::check_options(%options);
|
|
||||||
|
|
||||||
$self->change_macros(macros => ['warning_node_status', 'critical_node_status', 'unknown_node_status']);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub manage_selection {
|
sub manage_selection {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||||
|
|
||||||
sub custom_status_output {
|
sub custom_status_output {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
@ -50,11 +50,11 @@ sub set_counters {
|
||||||
];
|
];
|
||||||
|
|
||||||
$self->{maps_counters}->{luns} = [
|
$self->{maps_counters}->{luns} = [
|
||||||
{ label => 'status', threshold => 0, set => {
|
{ label => 'status', type => 2, critical_default => '%{state} !~ /online/i', set => {
|
||||||
key_values => [ { name => 'state' }, { name => 'container_state' }, { name => 'display' } ],
|
key_values => [ { name => 'state' }, { name => 'container_state' }, { name => 'display' } ],
|
||||||
closure_custom_output => $self->can('custom_status_output'),
|
closure_custom_output => $self->can('custom_status_output'),
|
||||||
closure_custom_perfdata => sub { return 0; },
|
closure_custom_perfdata => sub { return 0; },
|
||||||
closure_custom_threshold_check => \&catalog_status_threshold
|
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -66,22 +66,12 @@ sub new {
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
'filter-name:s' => { name => 'filter_name' },
|
'filter-name:s' => { name => 'filter_name' }
|
||||||
'unknown-status:s' => { name => 'unknown_status', default => '' },
|
|
||||||
'warning-status:s' => { name => 'warning_status', default => '' },
|
|
||||||
'critical-status:s' => { name => 'critical_status', default => '%{state} !~ /online/i' }
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check_options {
|
|
||||||
my ($self, %options) = @_;
|
|
||||||
$self->SUPER::check_options(%options);
|
|
||||||
|
|
||||||
$self->change_macros(macros => ['warning_status', 'critical_status', 'unknown_status']);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub manage_selection {
|
sub manage_selection {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||||
|
|
||||||
sub custom_status_output {
|
sub custom_status_output {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
@ -51,11 +51,11 @@ sub set_counters {
|
||||||
];
|
];
|
||||||
|
|
||||||
$self->{maps_counters}->{snapmirrors} = [
|
$self->{maps_counters}->{snapmirrors} = [
|
||||||
{ label => 'status', threshold => 0, set => {
|
{ label => 'status', type => 2, critical_default => '%{healthy} ne "true" or %{state} eq "broken_off"', set => {
|
||||||
key_values => [ { name => 'healthy' }, { name => 'state' }, { name => 'transfer_state' }, { name => 'display' } ],
|
key_values => [ { name => 'healthy' }, { name => 'state' }, { name => 'transfer_state' }, { name => 'display' } ],
|
||||||
closure_custom_output => $self->can('custom_status_output'),
|
closure_custom_output => $self->can('custom_status_output'),
|
||||||
closure_custom_perfdata => sub { return 0; },
|
closure_custom_perfdata => sub { return 0; },
|
||||||
closure_custom_threshold_check => \&catalog_status_threshold
|
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -67,22 +67,12 @@ sub new {
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
'filter-name:s' => { name => 'filter_name' },
|
'filter-name:s' => { name => 'filter_name' }
|
||||||
'unknown-status:s' => { name => 'unknown_status', default => '' },
|
|
||||||
'warning-status:s' => { name => 'warning_status', default => '' },
|
|
||||||
'critical-status:s' => { name => 'critical_status', default => '%{healthy} ne "true" or %{state} eq "broken_off"' }
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check_options {
|
|
||||||
my ($self, %options) = @_;
|
|
||||||
$self->SUPER::check_options(%options);
|
|
||||||
|
|
||||||
$self->change_macros(macros => ['warning_status', 'critical_status', 'unknown_status']);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub manage_selection {
|
sub manage_selection {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||||
|
|
||||||
sub custom_status_output {
|
sub custom_status_output {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
@ -60,11 +60,11 @@ sub set_counters {
|
||||||
];
|
];
|
||||||
|
|
||||||
$self->{maps_counters}->{volumes} = [
|
$self->{maps_counters}->{volumes} = [
|
||||||
{ label => 'status', threshold => 0, set => {
|
{ label => 'status', type => 2, critical_default => '%{state} !~ /online/i', set => {
|
||||||
key_values => [ { name => 'state' }, { name => 'display' } ],
|
key_values => [ { name => 'state' }, { name => 'display' } ],
|
||||||
closure_custom_output => $self->can('custom_status_output'),
|
closure_custom_output => $self->can('custom_status_output'),
|
||||||
closure_custom_perfdata => sub { return 0; },
|
closure_custom_perfdata => sub { return 0; },
|
||||||
closure_custom_threshold_check => \&catalog_status_threshold
|
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'usage', nlabel => 'volume.space.usage.bytes', set => {
|
{ label => 'usage', nlabel => 'volume.space.usage.bytes', set => {
|
||||||
|
@ -86,8 +86,8 @@ sub set_counters {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'usage-prct', nlabel => 'volume.space.usage.percentage', display_ok => 0, set => {
|
{ label => 'usage-prct', nlabel => 'volume.space.usage.percentage', display_ok => 0, set => {
|
||||||
key_values => [ { name => 'prct_used_space' }, { name => 'display' } ],
|
key_values => [ { name => 'prct_used_space' }, { name => 'used_space' }, { name => 'free_space' }, { name => 'prct_free_space' }, { name => 'total_space' }, { name => 'display' }, ],
|
||||||
output_template => 'space used: %.2f %%',
|
closure_custom_output => $self->can('custom_usage_output'),
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ template => '%.2f', min => 0, max => 100,
|
{ template => '%.2f', min => 0, max => 100,
|
||||||
unit => '%', label_extra_instance => 1 }
|
unit => '%', label_extra_instance => 1 }
|
||||||
|
@ -153,22 +153,12 @@ sub new {
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
'filter-name:s' => { name => 'filter_name' },
|
'filter-name:s' => { name => 'filter_name' }
|
||||||
'unknown-status:s' => { name => 'unknown_status', default => '' },
|
|
||||||
'warning-status:s' => { name => 'warning_status', default => '' },
|
|
||||||
'critical-status:s' => { name => 'critical_status', default => '%{state} !~ /online/i' }
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check_options {
|
|
||||||
my ($self, %options) = @_;
|
|
||||||
$self->SUPER::check_options(%options);
|
|
||||||
|
|
||||||
$self->change_macros(macros => ['warning_status', 'critical_status', 'unknown_status']);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub manage_selection {
|
sub manage_selection {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
@ -189,8 +179,8 @@ sub manage_selection {
|
||||||
total_space => $_->{space}->{size},
|
total_space => $_->{space}->{size},
|
||||||
used_space => $_->{space}->{used},
|
used_space => $_->{space}->{used},
|
||||||
free_space => $_->{space}->{available},
|
free_space => $_->{space}->{available},
|
||||||
prct_used_space => $_->{space}->{used} * 100 / $_->{space}->{size},
|
prct_used_space => (defined($_->{space}->{size}) && $_->{space}->{size} > 0) ? $_->{space}->{used} * 100 / $_->{space}->{size} : undef,
|
||||||
prct_free_space => $_->{space}->{available} * 100 / $_->{space}->{size},
|
prct_free_space => (defined($_->{space}->{size}) && $_->{space}->{size} > 0) ? $_->{space}->{available} * 100 / $_->{space}->{size} : undef,
|
||||||
|
|
||||||
read => $_->{metric}->{throughput}->{read},
|
read => $_->{metric}->{throughput}->{read},
|
||||||
write => $_->{metric}->{throughput}->{write},
|
write => $_->{metric}->{throughput}->{write},
|
||||||
|
|
Loading…
Reference in New Issue