(plugin) storage::huawei::oceanstor - mode luns minor fixes (#4012)
This commit is contained in:
parent
24bf3bd9a6
commit
8b5b174800
|
@ -30,8 +30,7 @@ sub new {
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {});
|
||||||
});
|
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
@ -53,15 +52,14 @@ my $oid_lun_entry = '.1.3.6.1.4.1.34774.4.1.23.4.8.1'; # hwInfoLunTable
|
||||||
sub manage_selection {
|
sub manage_selection {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
my $snmp_result = $options{snmp}->get_table(
|
my $snmp_result = $options{snmp}->get_table(oid => $oid_lun_entry);
|
||||||
oid => $oid_lun_entry
|
|
||||||
);
|
|
||||||
|
|
||||||
my $lun = {};
|
my $lun = {};
|
||||||
foreach my $oid (keys %$snmp_result) {
|
foreach my $oid (keys %$snmp_result) {
|
||||||
next if ($oid !~ /^$mapping->{name}->{oid}\.(.*)$/);
|
next if ($oid !~ /^$mapping->{name}->{oid}\.(.*)$/);
|
||||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $1);
|
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $1);
|
||||||
if($result->{isexposed} == 0) {next;}
|
next if ($result->{isexposed} == 0);
|
||||||
|
|
||||||
$lun->{$1} = $result;
|
$lun->{$1} = $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,9 +102,7 @@ sub disco_show {
|
||||||
|
|
||||||
my $lun = $self->manage_selection(%options);
|
my $lun = $self->manage_selection(%options);
|
||||||
foreach (sort keys %$lun) {
|
foreach (sort keys %$lun) {
|
||||||
$self->{output}->add_disco_entry(
|
$self->{output}->add_disco_entry(%{$lun->{$_}});
|
||||||
%{$lun->{$_}}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,11 +112,10 @@ __END__
|
||||||
|
|
||||||
=head1 MODE
|
=head1 MODE
|
||||||
|
|
||||||
List storage pools.
|
List LUNs.
|
||||||
|
|
||||||
=over 8
|
=over 8
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
|
|
|
@ -24,18 +24,6 @@ use base qw(centreon::plugins::templates::counter);
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_calc);
|
|
||||||
#use storage::huawei::oceanstor::snmp::mode::resources qw($health_status $running_status);
|
|
||||||
|
|
||||||
#sub custom_status_output {
|
|
||||||
# my ($self, %options) = @_;
|
|
||||||
|
|
||||||
#return sprintf(
|
|
||||||
# 'health status: %s [running status: %s]',
|
|
||||||
# $self->{result_values}->{health_status},
|
|
||||||
# $self->{result_values}->{running_status}
|
|
||||||
# );
|
|
||||||
#}
|
|
||||||
|
|
||||||
sub custom_space_usage_output {
|
sub custom_space_usage_output {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
@ -49,7 +37,7 @@ sub custom_space_usage_output {
|
||||||
$total_size_value . " " . $total_size_unit,
|
$total_size_value . " " . $total_size_unit,
|
||||||
$total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used_space},
|
$total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used_space},
|
||||||
$total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free_space},
|
$total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free_space},
|
||||||
$total_prot_value . " " . $total_prot_unit, $self->{result_values}->{prot_space}
|
$total_prot_value . " " . $total_prot_unit
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +132,6 @@ my $mapping = {
|
||||||
exposed => { oid => '.1.3.6.1.4.1.34774.4.1.23.4.8.1.14' } # hwInfoLunExposedToInitiator
|
exposed => { oid => '.1.3.6.1.4.1.34774.4.1.23.4.8.1.14' } # hwInfoLunExposedToInitiator
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
sub manage_selection {
|
sub manage_selection {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
@ -153,7 +140,6 @@ sub manage_selection {
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
my $oid_sp_entry = '.1.3.6.1.4.1.34774.4.1.23.4.8.1'; # hwInfoLunTable
|
my $oid_sp_entry = '.1.3.6.1.4.1.34774.4.1.23.4.8.1'; # hwInfoLunTable
|
||||||
my $snmp_result = $options{snmp}->get_table(
|
my $snmp_result = $options{snmp}->get_table(
|
||||||
oid => $oid_sp_entry,
|
oid => $oid_sp_entry,
|
||||||
|
@ -161,12 +147,10 @@ sub manage_selection {
|
||||||
);
|
);
|
||||||
|
|
||||||
$self->{lun} = {};
|
$self->{lun} = {};
|
||||||
|
|
||||||
foreach my $oid (keys %$snmp_result) {
|
foreach my $oid (keys %$snmp_result) {
|
||||||
next if ($oid !~ /^$mapping->{name}->{oid}\.(.*)$/);
|
next if ($oid !~ /^$mapping->{name}->{oid}\.(.*)$/);
|
||||||
|
|
||||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $1);
|
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $1);
|
||||||
|
|
||||||
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 '' &&
|
||||||
$result->{name} !~ /$self->{option_results}->{filter_name}/) {
|
$result->{name} !~ /$self->{option_results}->{filter_name}/) {
|
||||||
$self->{output}->output_add(long_msg => "skipping LUN '" . $result->{name} . "'.", debug => 1);
|
$self->{output}->output_add(long_msg => "skipping LUN '" . $result->{name} . "'.", debug => 1);
|
||||||
|
@ -178,26 +162,17 @@ sub manage_selection {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{lun}->{$result->{name}} = $result; # if(defined($1));
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (keys %{$self->{lun}}) {
|
|
||||||
|
|
||||||
my $result = $self->{lun}->{$_};
|
|
||||||
$result->{total_space} *= 1024 * 1024;
|
$result->{total_space} *= 1024 * 1024;
|
||||||
$result->{used_space} *= 1024 * 1024;
|
$result->{used_space} *= 1024 * 1024;
|
||||||
my $free_space=$result->{total_space} - $result->{used_space};
|
$result->{prot_space} *= 1024;
|
||||||
|
$self->{lun}->{ $result->{name} } = {
|
||||||
$self->{lun}->{$_}->{space} = {
|
name => $result->{name},
|
||||||
name => $_,
|
storage_pool => $result->{storage_pool},
|
||||||
total_space => $result->{total_space},
|
space => $result
|
||||||
used_space => $result->{used_space},
|
|
||||||
free_space => $free_space,
|
|
||||||
prot_space => $result->{prot_space}*1024,
|
|
||||||
prct_used_space => 100 - ($free_space * 100 / $result->{total_space}),
|
|
||||||
prct_free_space => ($free_space * 100 / $result->{total_space})
|
|
||||||
};
|
};
|
||||||
|
$self->{lun}->{ $result->{name} }->{space}->{free_space} = $result->{total_space} - $result->{used_space};
|
||||||
|
$self->{lun}->{ $result->{name} }->{space}->{prct_used_space} = $result->{used_space} * 100 / $result->{total_space};
|
||||||
|
$self->{lun}->{ $result->{name} }->{space}->{prct_free_space} = 100 - $result->{used_space};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,7 +182,7 @@ __END__
|
||||||
|
|
||||||
=head1 MODE
|
=head1 MODE
|
||||||
|
|
||||||
Check storage pools.
|
Check LUNs.
|
||||||
|
|
||||||
=over 8
|
=over 8
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue