parent
22185f8985
commit
5d184d7b91
|
@ -24,7 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold catalog_status_calc);
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
sub custom_status_output {
|
||||
|
@ -66,12 +66,17 @@ sub set_counters {
|
|||
];
|
||||
|
||||
$self->{maps_counters}->{controllers} = [
|
||||
{ label => 'controller-status', threshold => 0, set => {
|
||||
{
|
||||
label => 'controller-status',
|
||||
type => 2,
|
||||
unknown_default => '%{status} =~ /unknown/i',
|
||||
warning_default => '%{status} =~ /rpaParErr|degraded/i',
|
||||
critical_default => '%{status} =~ /failed/i',
|
||||
set => {
|
||||
key_values => [ { name => 'status' }, { name => 'display' } ],
|
||||
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
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||
}
|
||||
},
|
||||
{ label => 'cpu-utilization', nlabel => 'volume.cpu.utilization.percentage', set => {
|
||||
|
@ -125,23 +130,13 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-storage-name:s' => { name => 'filter_storage_name' },
|
||||
'filter-controller-name:s' => { name => 'filter_controller_name' },
|
||||
'unknown-controller-status:s' => { name => 'unknown_controller_status', default => '%{status} =~ /unknown/i' },
|
||||
'warning-controller-status:s' => { name => 'warning_controller_status', default => '%{status} =~ /rpaParErr|degraded/i' },
|
||||
'critical-controller-status:s' => { name => 'critical_controller_status', default => '%{status} =~ /failed/i' }
|
||||
'filter-storage-name:s' => { name => 'filter_storage_name' },
|
||||
'filter-controller-name:s' => { name => 'filter_controller_name' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$self->change_macros(macros => ['warning_controller_status', 'critical_controller_status', 'unknown_controller_status']);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold catalog_status_calc);
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -36,6 +36,20 @@ sub custom_status_output {
|
|||
);
|
||||
}
|
||||
|
||||
sub custom_space_usage_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{total});
|
||||
my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{used});
|
||||
my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{free});
|
||||
return sprintf(
|
||||
"space usage total: %s used: %s (%.2f%%) free: %s (%.2f%%)",
|
||||
$total_size_value . " " . $total_size_unit,
|
||||
$total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used},
|
||||
$total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free}
|
||||
);
|
||||
}
|
||||
|
||||
sub ss_long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
@ -66,12 +80,40 @@ sub set_counters {
|
|||
];
|
||||
|
||||
$self->{maps_counters}->{pools} = [
|
||||
{ label => 'pool-status', threshold => 0, set => {
|
||||
{
|
||||
label => 'pool-status',
|
||||
type => 2,
|
||||
warning_default => '%{raid_status} =~ /degraded/i',
|
||||
critical_default => '%{raid_status} =~ /failed/i',
|
||||
set => {
|
||||
key_values => [ { name => 'raid_status' }, { name => 'state'}, { name => 'display' } ],
|
||||
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
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||
}
|
||||
},
|
||||
{ label => 'space-usage', nlabel => 'pool.space.usage.bytes', set => {
|
||||
key_values => [ { name => 'used' }, { name => 'free' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' } ],
|
||||
closure_custom_output => $self->can('custom_space_usage_output'),
|
||||
perfdatas => [
|
||||
{ template => '%d', min => 0, max => 'total', unit => 'B', cast_int => 1, label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'space-usage-free', display_ok => 0, nlabel => 'pool.space.free.bytes', set => {
|
||||
key_values => [ { name => 'free' }, { name => 'used' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' } ],
|
||||
closure_custom_output => $self->can('custom_space_usage_output'),
|
||||
perfdatas => [
|
||||
{ template => '%d', min => 0, max => 'total', unit => 'B', cast_int => 1, label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'space-usage-prct', display_ok => 0, nlabel => 'pool.space.usage.percentage', set => {
|
||||
key_values => [ { name => 'prct_used' }, { name => 'used' }, { name => 'free' }, { name => 'prct_free' }, { name => 'total' } ],
|
||||
closure_custom_output => $self->can('custom_space_usage_output'),
|
||||
perfdatas => [
|
||||
{ template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1 }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
|
@ -83,23 +125,13 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-storage-name:s' => { name => 'filter_storage_name' },
|
||||
'filter-pool-name:s' => { name => 'filter_pool_name' },
|
||||
'unknown-pool-status:s' => { name => 'unknown_pool_status', default => '' },
|
||||
'warning-pool-status:s' => { name => 'warning_pool_status', default => '%{raid_status} =~ /degraded/i' },
|
||||
'critical-pool-status:s' => { name => 'critical_pool_status', default => '%{raid_status} =~ /failed/i' }
|
||||
'filter-storage-name:s' => { name => 'filter_storage_name' },
|
||||
'filter-pool-name:s' => { name => 'filter_pool_name' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$self->change_macros(macros => ['warning_pool_status', 'critical_pool_status', 'unknown_pool_status']);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
@ -129,6 +161,15 @@ sub manage_selection {
|
|||
state => $entry->{state},
|
||||
raid_status => $entry->{raidStatus}
|
||||
};
|
||||
if (defined($entry->{totalRaidedSpace}) && $entry->{totalRaidedSpace} > 0) {
|
||||
$self->{ss}->{$storage_name}->{pools}->{ $entry->{name} }->{total} = $entry->{totalRaidedSpace};
|
||||
$self->{ss}->{$storage_name}->{pools}->{ $entry->{name} }->{free} = $entry->{freeSpace};
|
||||
$self->{ss}->{$storage_name}->{pools}->{ $entry->{name} }->{used} = $entry->{totalRaidedSpace} - $entry->{freeSpace};
|
||||
$self->{ss}->{$storage_name}->{pools}->{ $entry->{name} }->{prct_free} =
|
||||
$entry->{freeSpace} * 100 / $entry->{totalRaidedSpace};
|
||||
$self->{ss}->{$storage_name}->{pools}->{ $entry->{name} }->{prct_used} =
|
||||
100 - $self->{ss}->{$storage_name}->{pools}->{ $entry->{name} }->{prct_free};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -171,6 +212,11 @@ Can used special variables like: %{raid_status}, %{state}, %{display}
|
|||
Set critical threshold for status (Default: '%{raid_status} =~ /failed/i').
|
||||
Can used special variables like: %{raid_status}, %{state}, %{display}
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Thresholds.
|
||||
Can be: 'space-usage-prct', 'space-usage', 'space-usage-free'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
|
@ -24,7 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold catalog_status_calc);
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||
|
||||
sub custom_status_output {
|
||||
my ($self, %options) = @_;
|
||||
|
@ -64,12 +64,11 @@ sub set_counters {
|
|||
];
|
||||
|
||||
$self->{maps_counters}->{ss} = [
|
||||
{ label => 'status', threshold => 0, set => {
|
||||
{ label => 'status', type => 2, critical_default => '%{status} =~ /needsAttn/i', set => {
|
||||
key_values => [ { name => 'status' }, { name => 'display' } ],
|
||||
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
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||
}
|
||||
},
|
||||
{ label => 'usage', nlabel => 'pool.space.usage.bytes', set => {
|
||||
|
@ -108,22 +107,12 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-storage-name:s' => { name => 'filter_storage_name' },
|
||||
'unknown-status:s' => { name => 'unknown_status', default => '' },
|
||||
'warning-status:s' => { name => 'warning_status', default => '' },
|
||||
'critical-status:s' => { name => 'critical_status', default => '%{status} =~ /needsAttn/i' }
|
||||
'filter-storage-name:s' => { name => 'filter_storage_name' }
|
||||
});
|
||||
|
||||
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 {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold catalog_status_calc);
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
sub custom_status_output {
|
||||
|
@ -66,12 +66,16 @@ sub set_counters {
|
|||
];
|
||||
|
||||
$self->{maps_counters}->{volumes} = [
|
||||
{ label => 'volume-status', threshold => 0, set => {
|
||||
{
|
||||
label => 'volume-status',
|
||||
type => 2,
|
||||
warning_default => '%{status} =~ /degraded/i',
|
||||
critical_default => '%{status} =~ /failed/i',
|
||||
set => {
|
||||
key_values => [ { name => 'status' }, { name => 'display' } ],
|
||||
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
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||
}
|
||||
},
|
||||
{ label => 'read', nlabel => 'volume.io.read.usage.bytespersecond', set => {
|
||||
|
@ -117,23 +121,13 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-storage-name:s' => { name => 'filter_storage_name' },
|
||||
'filter-volume-name:s' => { name => 'filter_volume_name' },
|
||||
'unknown-volume-status:s' => { name => 'unknown_volume_status', default => '' },
|
||||
'warning-volume-status:s' => { name => 'warning_volume_status', default => '%{status} =~ /degraded/i' },
|
||||
'critical-volume-status:s' => { name => 'critical_volume_status', default => '%{status} =~ /failed/i' }
|
||||
'filter-storage-name:s' => { name => 'filter_storage_name' },
|
||||
'filter-volume-name:s' => { name => 'filter_volume_name' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$self->change_macros(macros => ['warning_volume_status', 'critical_volume_status', 'unknown_volume_status']);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
|
|
@ -30,15 +30,15 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$self->{version} = '0.1';
|
||||
%{ $self->{modes} } = (
|
||||
$self->{modes} = {
|
||||
'hardware' => 'storage::netapp::santricity::restapi::mode::hardware',
|
||||
'storage-controllers' => 'storage::netapp::santricity::restapi::mode::storagecontrollers',
|
||||
'storage-pools' => 'storage::netapp::santricity::restapi::mode::storagepools',
|
||||
'storage-systems' => 'storage::netapp::santricity::restapi::mode::storagesystems',
|
||||
'storage-volumes' => 'storage::netapp::santricity::restapi::mode::storagevolumes'
|
||||
);
|
||||
};
|
||||
|
||||
$self->{custom_modes}{api} = 'storage::netapp::santricity::restapi::custom::api';
|
||||
$self->{custom_modes}->{api} = 'storage::netapp::santricity::restapi::custom::api';
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue