typo(dell/me4): some cleaning (#3039)
This commit is contained in:
parent
a306311c20
commit
416d82cc04
|
@ -26,6 +26,12 @@ use strict;
|
|||
use warnings;
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
sub prefix_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Controller '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
@ -36,120 +42,114 @@ sub set_counters {
|
|||
$self->{maps_counters}->{controllers} = [
|
||||
{ label => 'data-read', nlabel => 'controller.data.read.bytespersecond', set => {
|
||||
key_values => [ { name => 'data-read-numeric', per_second => 1 }, { name => 'display' } ],
|
||||
output_template => 'Data Read: %s%s/s',
|
||||
output_template => 'data read: %s%s/s',
|
||||
output_change_bytes => 1,
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0, unit => 'B/s', label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%s', min => 0, unit => 'B/s', label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'data-written', nlabel => 'controller.data.written.bytespersecond', set => {
|
||||
key_values => [ { name => 'data-written-numeric', per_second => 1 }, { name => 'display' } ],
|
||||
output_template => 'Data Written: %s%s/s',
|
||||
output_template => 'data written: %s%s/s',
|
||||
output_change_bytes => 1,
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0, unit => 'B/s', label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%s', min => 0, unit => 'B/s', label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'reads', nlabel => 'controller.reads.count', set => {
|
||||
key_values => [ { name => 'number-of-reads', per_second => 1 }, { name => 'display' } ],
|
||||
output_template => 'Reads: %s/s',
|
||||
output_template => 'reads: %s/s',
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'writes', nlabel => 'controller.writes.count', set => {
|
||||
key_values => [ { name => 'number-of-writes', per_second => 1 }, { name => 'display' } ],
|
||||
output_template => 'Writes: %s/s',
|
||||
output_template => 'writes: %s/s',
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'data-transfer', nlabel => 'controller.data.transfer.bytespersecond', set => {
|
||||
key_values => [ { name => 'bytes-per-second-numeric'}, { name => 'display' } ],
|
||||
output_template => 'Data Transfer: %s%s/s',
|
||||
output_template => 'data transfer: %s%s/s',
|
||||
output_change_bytes => 1,
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0, unit => 'B/s', label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%s', min => 0, unit => 'B/s', label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'iops', nlabel => 'controller.iops.ops', set => {
|
||||
key_values => [ { name => 'iops'}, { name => 'display' } ],
|
||||
output_template => 'IOPS: %d ops',
|
||||
output_template => 'iops: %d ops',
|
||||
perfdatas => [
|
||||
{ template => '%d', min => 0, unit => 'ops', label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%d', min => 0, unit => 'ops', label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'forwarded-cmds', nlabel => 'controller.commands.forwarded.count', set => {
|
||||
key_values => [ { name => 'num-forwarded-cmds'}, { name => 'display' } ],
|
||||
output_template => 'Forwarded Commands: %d',
|
||||
output_template => 'forwarded commands: %d',
|
||||
perfdatas => [
|
||||
{ template => '%d', min => 0, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%d', min => 0, label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'write-cache-used', nlabel => 'controller.cache.write.usage.percentage', set => {
|
||||
key_values => [ { name => 'write-cache-used'}, { name => 'display' } ],
|
||||
output_template => 'Cache Write Usage: %s%%',
|
||||
output_template => 'cache write usage: %s%%',
|
||||
perfdatas => [
|
||||
{ template => '%d', min => 0, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%d', min => 0, label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'write-cache-hits', nlabel => 'controller.cache.write.hits.count', set => {
|
||||
key_values => [ { name => 'write-cache-hits', per_second => 1 }, { name => 'display' } ],
|
||||
output_template => 'Cache Write Hits: %s/s',
|
||||
output_template => 'cache write hits: %s/s',
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'write-cache-misses', nlabel => 'controller.cache.write.misses.count', set => {
|
||||
key_values => [ { name => 'write-cache-misses', per_second => 1 }, { name => 'display' } ],
|
||||
output_template => 'Cache Write Misses: %s/s',
|
||||
output_template => 'cache write misses: %s/s',
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'read-cache-hits', nlabel => 'controller.cache.read.hits.count', set => {
|
||||
key_values => [ { name => 'read-cache-hits', per_second => 1 }, { name => 'display' } ],
|
||||
output_template => 'Cache Read Hits: %s/s',
|
||||
output_template => 'cache read hits: %s/s',
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'read-cache-misses', nlabel => 'controller.cache.read.misses.count', set => {
|
||||
key_values => [ { name => 'read-cache-misses', per_second => 1 }, { name => 'display' } ],
|
||||
output_template => 'Cache Read Misses: %s/s',
|
||||
output_template => 'cache read misses: %s/s',
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'cpu-utilization', nlabel => 'controller.cpu.utilization.percentage', set => {
|
||||
key_values => [ { name => 'cpu-load'}, { name => 'display' } ],
|
||||
output_template => 'CPU Utilization: %.2f%%',
|
||||
output_template => 'cpu utilization: %.2f%%',
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub prefix_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Controller '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1, force_new_perfdata => 1);
|
||||
|
@ -168,14 +168,13 @@ sub manage_selection {
|
|||
my $results = $options{custom}->request_api(method => 'GET', url_path => '/api/show/controller-statistics');
|
||||
|
||||
$self->{controllers} = {};
|
||||
|
||||
foreach my $controller (@{$results->{'controller-statistics'}}) {
|
||||
next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne ''
|
||||
&& $controller->{'durable-id'} !~ /$self->{option_results}->{filter_name}/);
|
||||
|
||||
$self->{controllers}->{$controller->{'durable-id'}} = { display => $controller->{'durable-id'}, %{$controller} };
|
||||
}
|
||||
|
||||
|
||||
if (scalar(keys %{$self->{controllers}}) <= 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "No controllers found.");
|
||||
$self->{output}->option_exit();
|
||||
|
|
|
@ -44,7 +44,7 @@ sub set_system {
|
|||
['Down', 'CRITICAL'],
|
||||
['N/A', 'UNKNOWN'],
|
||||
['Unknown', 'UNKNOWN'],
|
||||
['Not Installed', 'UNKNOWN'],
|
||||
['Not Installed', 'UNKNOWN']
|
||||
],
|
||||
disk => [
|
||||
['OK', 'OK'],
|
||||
|
@ -70,7 +70,7 @@ sub set_system {
|
|||
['UNUSABLE', 'CRITICAL'],
|
||||
['N/A', 'UNKNOWN'],
|
||||
['Unknown', 'UNKNOWN'],
|
||||
['Not Present', 'UNKNOWN'],
|
||||
['Not Present', 'UNKNOWN']
|
||||
],
|
||||
fan => [
|
||||
['OK', 'OK'],
|
||||
|
@ -81,14 +81,14 @@ sub set_system {
|
|||
['Missing', 'UNKNOWN'],
|
||||
['Off', 'UNKNOWN'],
|
||||
['N/A', 'UNKNOWN'],
|
||||
['Unknown', 'UNKNOWN'],
|
||||
['Unknown', 'UNKNOWN']
|
||||
],
|
||||
fru => [
|
||||
['OK', 'OK'],
|
||||
['Fault', 'CRITICAL'],
|
||||
['Invalid Data', 'CRITICAL'],
|
||||
['Power OFF', 'UNKNOWN'],
|
||||
['Absent', 'UNKNOWN'],
|
||||
['Absent', 'UNKNOWN']
|
||||
],
|
||||
psu => [
|
||||
['OK', 'OK'],
|
||||
|
@ -99,7 +99,7 @@ sub set_system {
|
|||
['Missing', 'UNKNOWN'],
|
||||
['Off', 'UNKNOWN'],
|
||||
['N/A', 'UNKNOWN'],
|
||||
['Unknown', 'UNKNOWN'],
|
||||
['Unknown', 'UNKNOWN']
|
||||
],
|
||||
sensor => [
|
||||
['OK', 'OK'],
|
||||
|
@ -109,15 +109,15 @@ sub set_system {
|
|||
['Unrecoverable', 'UNKNOWN'],
|
||||
['Not Installed', 'UNKNOWN'],
|
||||
['Unsupported', 'UNKNOWN'],
|
||||
['Unknown', 'UNKNOWN'],
|
||||
['Unknown', 'UNKNOWN']
|
||||
],
|
||||
volume => [
|
||||
['OK', 'OK'],
|
||||
['Degraded', 'WARNING'],
|
||||
['Fault', 'CRITICAL'],
|
||||
['N/A', 'UNKNOWN'],
|
||||
['Unknown', 'UNKNOWN'],
|
||||
],
|
||||
['Unknown', 'UNKNOWN']
|
||||
]
|
||||
};
|
||||
|
||||
$self->{components_path} = 'storage::dell::me4::restapi::mode::components';
|
||||
|
|
|
@ -25,7 +25,7 @@ use base qw(centreon::plugins::templates::counter);
|
|||
use strict;
|
||||
use warnings;
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
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) = @_;
|
||||
|
@ -37,6 +37,24 @@ sub custom_status_output {
|
|||
);
|
||||
}
|
||||
|
||||
sub port_long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "checking port '" . $options{instance_value}->{display} . "'";
|
||||
}
|
||||
|
||||
sub prefix_port_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "port '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub prefix_interface_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "interface '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
@ -44,18 +62,23 @@ sub set_counters {
|
|||
{ name => 'ports', type => 3, cb_prefix_output => 'prefix_port_output', cb_long_output => 'port_long_output', indent_long_output => ' ', message_multiple => 'All interfaces are ok',
|
||||
group => [
|
||||
{ name => 'port_global', type => 0, skipped_code => { -10 => 1 } },
|
||||
{ name => 'interfaces', display_long => 1, cb_prefix_output => 'prefix_interface_output', message_multiple => 'All interfaces are ok', type => 1, skipped_code => { -10 => 1 } },
|
||||
{ name => 'interfaces', display_long => 1, cb_prefix_output => 'prefix_interface_output', message_multiple => 'All interfaces are ok', type => 1, skipped_code => { -10 => 1 } }
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{port_global} = [
|
||||
{ label => 'port-status', threshold => 0, set => {
|
||||
{
|
||||
label => 'port-status',
|
||||
type => 2,
|
||||
unknown_default => '%{health} =~ /unknown/i',
|
||||
warning_default => '%{health} =~ /degraded/i',
|
||||
critical_default => '%{health} =~ /fault/i',
|
||||
set => {
|
||||
key_values => [ { name => 'status' }, { name => 'health'}, { 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-iops', nlabel => 'port.io.read.usage.iops', set => {
|
||||
|
@ -122,46 +145,18 @@ sub set_counters {
|
|||
];
|
||||
}
|
||||
|
||||
sub port_long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "checking port '" . $options{instance_value}->{display} . "'";
|
||||
}
|
||||
|
||||
sub prefix_port_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "port '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub prefix_interface_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "interface '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-port-name:s' => { name => 'filter_port_name' },
|
||||
'unknown-port-status:s' => { name => 'unknown_port_status', default => '%{health} =~ /unknown/i' },
|
||||
'warning-port-status:s' => { name => 'warning_port_status', default => '%{health} =~ /degraded/i' },
|
||||
'critical-port-status:s' => { name => 'critical_port_status', default => '%{health} =~ /fault/i' }
|
||||
'filter-port-name:s' => { name => 'filter_port_name' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$self->change_macros(macros => ['warning_port_status', 'critical_port_status', 'unknown_port_status']);
|
||||
}
|
||||
|
||||
my $mapping_status = {
|
||||
0 => 'up',
|
||||
1 => 'down',
|
||||
|
|
|
@ -56,20 +56,25 @@ sub run {
|
|||
next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne ''
|
||||
&& $controller->{'durable-id'} !~ /$self->{option_results}->{filter_name}/);
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("[name = %s]",
|
||||
$controller->{'durable-id'},
|
||||
));
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"[name = %s]",
|
||||
$controller->{'durable-id'}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => 'List controllers:');
|
||||
$self->{output}->output_add(
|
||||
severity => 'OK',
|
||||
short_msg => 'List controllers:'
|
||||
);
|
||||
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
||||
sub disco_format {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
||||
$self->{output}->add_disco_format(elements => ['name']);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ sub new {
|
|||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'filter-name:s' => { name => 'filter_name' },
|
||||
});
|
||||
|
@ -56,14 +56,19 @@ sub run {
|
|||
next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne ''
|
||||
&& $volume->{'volume-name'} !~ /$self->{option_results}->{filter_name}/);
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("[name = %s][volumegroup = %s]",
|
||||
$volume->{'volume-name'},
|
||||
$volume->{'volume-group'},
|
||||
));
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"[name = %s][volumegroup = %s]",
|
||||
$volume->{'volume-name'},
|
||||
$volume->{'volume-group'}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => 'List volumes:');
|
||||
$self->{output}->output_add(
|
||||
severity => 'OK',
|
||||
short_msg => 'List volumes:'
|
||||
);
|
||||
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
|
|
@ -26,6 +26,12 @@ use strict;
|
|||
use warnings;
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
sub prefix_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Volume '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
@ -36,104 +42,98 @@ sub set_counters {
|
|||
$self->{maps_counters}->{volumes} = [
|
||||
{ label => 'data-read', nlabel => 'volume.data.read.bytespersecond', set => {
|
||||
key_values => [ { name => 'data-read-numeric', per_second => 1 }, { name => 'display' } ],
|
||||
output_template => 'Data Read: %s%s/s',
|
||||
output_template => 'data read: %s%s/s',
|
||||
output_change_bytes => 1,
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0, unit => 'B/s', label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%s', min => 0, unit => 'B/s', label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'data-written', nlabel => 'volume.data.written.bytespersecond', set => {
|
||||
key_values => [ { name => 'data-written-numeric', per_second => 1 }, { name => 'display' } ],
|
||||
output_template => 'Data Written: %s%s/s',
|
||||
output_template => 'data written: %s%s/s',
|
||||
output_change_bytes => 1,
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0, unit => 'B/s', label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%s', min => 0, unit => 'B/s', label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'reads', nlabel => 'volume.reads.count', set => {
|
||||
key_values => [ { name => 'number-of-reads', per_second => 1 }, { name => 'display' } ],
|
||||
output_template => 'Reads: %s/s',
|
||||
output_template => 'reads: %s/s',
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'writes', nlabel => 'volume.writes.count', set => {
|
||||
key_values => [ { name => 'number-of-writes', per_second => 1 }, { name => 'display' } ],
|
||||
output_template => 'Writes: %s/s',
|
||||
output_template => 'writes: %s/s',
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'data-transfer', nlabel => 'volume.data.transfer.bytespersecond', set => {
|
||||
key_values => [ { name => 'bytes-per-second-numeric' }, { name => 'display' } ],
|
||||
output_template => 'Data Transfer: %s%s/s',
|
||||
output_template => 'data transfer: %s%s/s',
|
||||
output_change_bytes => 1,
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0, unit => 'B/s', label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%s', min => 0, unit => 'B/s', label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'iops', nlabel => 'volume.iops.ops', set => {
|
||||
key_values => [ { name => 'iops' }, { name => 'display' } ],
|
||||
output_template => 'IOPS: %d ops',
|
||||
output_template => 'iops: %d ops',
|
||||
perfdatas => [
|
||||
{ template => '%d', min => 0, unit => 'ops', label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%d', min => 0, unit => 'ops', label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'write-cache-percent', nlabel => 'volume.cache.write.usage.percentage', set => {
|
||||
key_values => [ { name => 'write-cache-percent'}, { name => 'display' } ],
|
||||
output_template => 'Cache Write Usage: %s%%',
|
||||
output_template => 'cache write usage: %s%%',
|
||||
perfdatas => [
|
||||
{ template => '%d', min => 0, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%d', min => 0, label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'write-cache-hits', nlabel => 'volume.cache.write.hits.count', set => {
|
||||
key_values => [ { name => 'write-cache-hits', per_second => 1 }, { name => 'display' } ],
|
||||
output_template => 'Cache Write Hits: %s/s',
|
||||
output_template => 'cache write hits: %s/s',
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'write-cache-misses', nlabel => 'volume.cache.write.misses.count', set => {
|
||||
key_values => [ { name => 'write-cache-misses', per_second => 1 }, { name => 'display' } ],
|
||||
output_template => 'Cache Write Misses: %s/s',
|
||||
output_template => 'cache write misses: %s/s',
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'read-cache-hits', nlabel => 'volume.cache.read.hits.count', set => {
|
||||
key_values => [ { name => 'read-cache-hits', per_second => 1 }, { name => 'display' } ],
|
||||
output_template => 'Cache Read Hits: %s/s',
|
||||
output_template => 'cache read hits: %s/s',
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' },
|
||||
],
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'read-cache-misses', nlabel => 'volume.cache.read.misses.count', set => {
|
||||
key_values => [ { name => 'read-cache-misses', per_second => 1 }, { name => 'display'} ],
|
||||
output_template => 'Cache Read Misses: %s/s',
|
||||
output_template => 'cache read misses: %s/s',
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' },
|
||||
{ template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub prefix_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Volume '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1, force_new_perfdata => 1);
|
||||
|
@ -152,20 +152,19 @@ sub manage_selection {
|
|||
my $results = $options{custom}->request_api(method => 'GET', url_path => '/api/show/volume-statistics');
|
||||
|
||||
$self->{volumes} = {};
|
||||
|
||||
foreach my $volume (@{$results->{'volume-statistics'}}) {
|
||||
next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne ''
|
||||
&& $volume->{'volume-name'} !~ /$self->{option_results}->{filter_name}/);
|
||||
|
||||
$self->{volumes}->{$volume->{'volume-name'}} = { display => $volume->{'volume-name'}, %{$volume} };
|
||||
}
|
||||
|
||||
|
||||
if (scalar(keys %{$self->{volumes}}) <= 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "No volumes found.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{cache_name} = "dell_me4_" . $self->{mode} . '_' . $options{custom}->get_hostname() . '_' .
|
||||
$self->{cache_name} = 'dell_me4_' . $self->{mode} . '_' . $options{custom}->get_hostname() . '_' .
|
||||
(defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all')) . '_' .
|
||||
(defined($self->{option_results}->{filter_name}) ? md5_hex($self->{option_results}->{filter_name}) : md5_hex('all'));
|
||||
|
||||
|
|
|
@ -30,16 +30,16 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$self->{version} = '0.1';
|
||||
%{ $self->{modes} } = (
|
||||
$self->{modes} = {
|
||||
'controller-statistics' => 'storage::dell::me4::restapi::mode::controllerstatistics',
|
||||
'hardware' => 'storage::dell::me4::restapi::mode::hardware',
|
||||
'interfaces' => 'storage::dell::me4::restapi::mode::interfaces',
|
||||
'list-controllers' => 'storage::dell::me4::restapi::mode::listcontrollers',
|
||||
'list-volumes' => 'storage::dell::me4::restapi::mode::listvolumes',
|
||||
'volume-statistics' => 'storage::dell::me4::restapi::mode::volumestatistics'
|
||||
);
|
||||
};
|
||||
|
||||
$self->{custom_modes}{api} = 'storage::dell::me4::restapi::custom::api';
|
||||
$self->{custom_modes}->{api} = 'storage::dell::me4::restapi::custom::api';
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue