fix rubrik (#2332)

This commit is contained in:
qgarnier 2020-11-09 17:36:32 +01:00 committed by GitHub
parent cb5b393f6e
commit 2ed3388508
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 10 deletions

View File

@ -133,11 +133,7 @@ sub manage_selection {
$self->{clusters} = {
$name => {
name => $name,
status => $status->{status},
read => 0,
write => 0,
read_iops => 0,
write_iops => 0
status => $status->{status}
}
};
@ -147,10 +143,12 @@ sub manage_selection {
)) {
my $count = 0;
foreach (@{$io_stats->{ $entry->[0] }->{ $entry->[1] }}) {
$self->{clusters}->{$name}->{ $entry->[2] } = 0
if (!defined($self->{clusters}->{$name}->{ $entry->[2] }));
$self->{clusters}->{$name}->{ $entry->[2] } += $_->{stat};
$count++;
}
$self->{clusters}->{$name}->{ $entry->[2] } = int($self->{clusters}->{$name}->{ $entry->[2] } / $count);
$self->{clusters}->{$name}->{ $entry->[2] } = int($self->{clusters}->{$name}->{ $entry->[2] } / $count) if ($count > 0);
}
}

View File

@ -139,8 +139,8 @@ sub manage_selection {
};
foreach (@{$disks->{data}}) {
my $id = $_->{nodeId} . ':' . $_->{id};
next if (defined($options{filter_disk_id}) && $options{filter_disk_id} ne '' &&
$id !~ /$options{filter_disk_id}/);
next if (defined($self->{option_results}->{filter_disk_id}) && $self->{option_results}->{filter_disk_id} ne '' &&
$id !~ /$self->{option_results}->{filter_disk_id}/);
$self->{clusters}->{$name}->{disks}->{$id} = {
id => $id,

View File

@ -138,8 +138,8 @@ sub manage_selection {
}
};
foreach (@{$nodes->{data}}) {
next if (defined($options{filter_node_id}) && $options{filter_node_id} ne '' &&
$_->{id} !~ /$options{filter_node_id}/);
next if (defined($self->{option_results}->{filter_node_id}) && $self->{option_results}->{filter_node_id} ne '' &&
$_->{id} !~ /$self->{option_results}->{filter_node_id}/);
$self->{clusters}->{$name}->{nodes}->{ $_->{id} } = {
id => $_->{id},