+ Fix ssd-iops mode

This commit is contained in:
garnier-quentin 2015-09-18 15:32:52 +02:00
parent 930ced398e
commit 30387a09eb
1 changed files with 16 additions and 18 deletions

View File

@ -30,28 +30,28 @@ my $maps_counters = {
ssd => { ssd => {
'000_global' => { set => { '000_global' => { set => {
key_values => [ { name => 'global_iops' }, { name => 'display' }, ], key_values => [ { name => 'global_iops' }, { name => 'display' }, ],
output_template => 'Global IOPs : %.2f %%', output_template => 'Global IOPs : %s',
perfdatas => [ perfdatas => [
{ label => 'global_iops', value => 'global_iops_absolute', template => '%.2f', { label => 'global_iops', value => 'global_iops_absolute', template => '%s',
min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'num_absolute' }, min => 0, unit => 'iops', label_extra_instance => 1, instance_use => 'num_absolute' },
], ],
} }
}, },
'001_read' => { set => { '001_read' => { set => {
key_values => [ { name => 'read_iops' }, { name => 'display' }, ], key_values => [ { name => 'read_iops' }, { name => 'display' }, ],
output_template => 'Read IOPs : %.2f %%', output_template => 'Read IOPs : %s',
perfdatas => [ perfdatas => [
{ label => 'read_iops', value => 'read_iops_absolute', template => '%.2f', { label => 'read_iops', value => 'read_iops_absolute', template => '%s',
min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'num_absolute' }, min => 0, unit => 'iops', label_extra_instance => 1, instance_use => 'num_absolute' },
], ],
} }
}, },
'002_write' => { set => { '002_write' => { set => {
key_values => [ { name => 'write_iops' }, { name => 'display' }, ], key_values => [ { name => 'write_iops' }, { name => 'display' }, ],
output_template => 'Write IOPs : %.2f %%', output_template => 'Write IOPs : %s',
perfdatas => [ perfdatas => [
{ label => 'write_iops', value => 'global_iops_absolute', template => '%.2f', { label => 'write_iops', value => 'global_iops_absolute', template => '%s',
min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'num_absolute' }, min => 0, unit => 'iops', label_extra_instance => 1, instance_use => 'num_absolute' },
], ],
} }
}, },
@ -96,13 +96,11 @@ sub check_options {
$maps_counters->{$key}->{$_}->{obj}->init(option_results => $self->{option_results}); $maps_counters->{$key}->{$_}->{obj}->init(option_results => $self->{option_results});
} }
} }
$self->{statefile_cache}->check_options(%options);
} }
sub run { sub run {
my ($self, %options) = @_; my ($self, %options) = @_;
my $xtremio = $options{custom}; $self->{xtremio} = $options{custom};
$self->manage_selection(); $self->manage_selection();
@ -167,8 +165,8 @@ sub manage_selection {
$self->{ssd} = {}; $self->{ssd} = {};
my $urlbase = '/api/json/types/'; my $urlbase = '/api/json/types/';
my @items = $xtremio->get_items(url => $urlbase, my @items = $self->{xtremio}->get_items(url => $urlbase,
obj => 'ssds'); obj => 'ssds');
foreach my $item (@items) { foreach my $item (@items) {
if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' &&
$item !~ /$self->{option_results}->{filter_name}/) { $item !~ /$self->{option_results}->{filter_name}/) {
@ -176,9 +174,9 @@ sub manage_selection {
next; next;
} }
my $details = $xtremio->get_details(url => $urlbase, my $details = $self->{xtremio}->get_details(url => $urlbase,
obj => 'ssds', obj => 'ssds',
name => $item); name => $item);
$self->{ssd}->{$item} = { display => $item, global_iops => $details->{iops}, $self->{ssd}->{$item} = { display => $item, global_iops => $details->{iops},
read_iops => $details->{'rd-iops'}, write_iops => $details->{'wr-iops'} }; read_iops => $details->{'rd-iops'}, write_iops => $details->{'wr-iops'} };