remove huawei ibmc old code (#1112)

This commit is contained in:
Colin Gagnaire 2018-08-24 16:00:54 +00:00 committed by Simon Bomm
parent 1ccdf2c78f
commit f6c659b946
2 changed files with 0 additions and 167 deletions

View File

@ -1,102 +0,0 @@
package hardware::server::huawei::ibmc::snmp::mode::components::raid;
use strict;
use warnings;
sub check {
my ($self) = @_;
my $raidStatusOid = ".1.3.6.1.4.1.2011.2.235.1.1.36.50.1.7";
my $bbuPresentOid = ".1.3.6.1.4.1.2011.2.235.1.1.36.50.1.16";
my $bbuStatusOid = ".1.3.6.1.4.1.2011.2.235.1.1.36.50.1.18";
my $tmpShortMessage = "";
my $result = $self->{snmp}->get_table(oid => $bbuPresentOid);
if (scalar(keys %$result) <= 0)
{
$tmpShortMessage = $tmpShortMessage."Get BBU info failed.";
}else
{
my $endKey;
my $temnameOid;
my $statusOid;
my $tmpMsg;
my $tmpresult;
my $v;
foreach my $k ($self->{snmp}->oid_lex_sort(keys %$result))
{
$v = $result->{$k};
$endKey = "0";
$temnameOid = "";
$statusOid = "";
$tmpMsg = "";
$k =~ /\.([0-9]+)$/;
$endKey = $1;
if ($v eq "2") # BBU present
{
$statusOid = $bbuStatusOid.".".$endKey;
$tmpresult = $self->{snmp}->get_leef(oids =>[$statusOid]);
my $tmpEachstate;
if ($tmpresult->{$statusOid} eq "0")
{
$tmpEachstate="ok";
}
else
{
$tmpEachstate="warning";
}
$tmpMsg =$tmpMsg. "BBU ".$endKey.":".$tmpEachstate." ";
$tmpShortMessage=$tmpShortMessage.$tmpMsg;
}elsif ($v eq "1")
{
$tmpShortMessage= $tmpShortMessage."BBU".$1.":absent ";
}else
{
$tmpShortMessage= $tmpShortMessage."BBU".$1.":unknown ";
}
}
}
$result = $self->{snmp}->get_table(oid =>$raidStatusOid);
my $raidseverity = "undefine";
if (scalar(keys %$result) <= 0)
{
$tmpShortMessage = $tmpShortMessage."Get raid Status failed."
}else
{
while (my($k,$v)= each %$result){
$k =~ /\.([0-9]+)$/;
if ($v eq "65535")
{
if( $raidseverity ne "warning")
{
$raidseverity = "unknown";
}
$tmpShortMessage = "RAID".$1.":unknown ".$tmpShortMessage;
}elsif ($v eq "0")
{
if (($raidseverity ne "warning")&&($raidseverity ne "unknown"))
{
$raidseverity = "ok";
}
$tmpShortMessage = "RAID".$1.":ok ".$tmpShortMessage;
}else
{
$raidseverity = "warning";
$tmpShortMessage = "RAID".$1.":warning ".$tmpShortMessage;
}
}
}
if ($raidseverity eq "undefine")
{
$raidseverity = "unknown";
}
$self->{output}->output_add(severity => $raidseverity ,
short_msg => $tmpShortMessage );
$self->{output}->display();
$self->{output}->exit();
}
1;

View File

@ -1,65 +0,0 @@
package hardware::server::huawei::ibmc::snmp::mode::hardwares;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use hardware::server::huawei::ibmc::snmp::mode::components::system;
use hardware::server::huawei::ibmc::snmp::mode::components::cpu;
use hardware::server::huawei::ibmc::snmp::mode::components::fan;
use hardware::server::huawei::ibmc::snmp::mode::components::raid;
use hardware::server::huawei::ibmc::snmp::mode::components::memory;
use hardware::server::huawei::ibmc::snmp::mode::components::psu;
use hardware::server::huawei::ibmc::snmp::mode::components::disk;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"component:s" => { name => 'component', default => 'system' },
});
$self->{components} = {};
$self->{no_components} = undef;
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
}
sub run {
my ($self, %options) = @_;
$self->{snmp} = $options{snmp};
if ($self->{option_results}->{component} eq 'system') {
hardware::server::huawei::ibmc::snmp::mode::components::system::check($self);
} elsif ($self->{option_results}->{component} eq 'cpu') {
hardware::server::huawei::ibmc::snmp::mode::components::cpu::check($self);
} elsif ($self->{option_results}->{component} eq 'fan') {
hardware::server::huawei::ibmc::snmp::mode::components::fan::check($self);
} elsif ($self->{option_results}->{component} eq 'raid') {
hardware::server::huawei::ibmc::snmp::mode::components::raid::check($self);
} elsif ($self->{option_results}->{component} eq 'memory') {
hardware::server::huawei::ibmc::snmp::mode::components::memory::check($self);
} elsif ($self->{option_results}->{component} eq 'psu') {
hardware::server::huawei::ibmc::snmp::mode::components::psu::check($self);
} elsif ($self->{option_results}->{component} eq 'disk') {
hardware::server::huawei::ibmc::snmp::mode::components::disk::check($self);
} else {
$self->{output}->add_option_msg(short_msg => "Wrong option. Cannot find component '" . $self->{option_results}->{component} . "'.");
$self->{output}->option_exit();
}
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__