diff options
Diffstat (limited to 'nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem')
15 files changed, 2838 insertions, 0 deletions
diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Da.pm b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Da.pm new file mode 100755 index 0000000..5dbc5ef --- /dev/null +++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Da.pm @@ -0,0 +1,407 @@ +package HP::Proliant::Component::DiskSubsystem::Da; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + runtime => $params{runtime}, + rawdata => $params{rawdata}, + method => $params{method}, + controllers => [], + accelerators => [], + enclosures => [], + physical_drives => [], + logical_drives => [], + spare_drives => [], + condition => undef, + blacklisted => 0, + }; + bless $self, $class; + if ($self->{method} eq 'snmp') { + bless $self, 'HP::Proliant::Component::DiskSubsystem::Da::SNMP'; + } else { + bless $self, 'HP::Proliant::Component::DiskSubsystem::Da::CLI'; + } + $self->init(); + $self->assemble(); + return $self; +} + +sub check { + my $self = shift; + foreach (@{$self->{controllers}}) { + $_->check(); + } +} + +sub dump { + my $self = shift; + foreach (@{$self->{controllers}}) { + $_->dump(); + } +} + +package HP::Proliant::Component::DiskSubsystem::Da::Controller; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Da); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + runtime => $params{runtime}, + cpqDaCntlrIndex => $params{cpqDaCntlrIndex}, + cpqDaCntlrSlot => $params{cpqDaCntlrSlot}, + cpqDaCntlrModel => $params{cpqDaCntlrModel}, + cpqDaCntlrCondition => $params{cpqDaCntlrCondition}, + cpqDaCntlrBoardCondition => $params{cpqDaCntlrBoardCondition}, + blacklisted => 0, + }; + $self->{name} = $params{name} || $self->{cpqDaCntlrSlot}; + $self->{controllerindex} = $self->{cpqDaCntlrIndex}; + bless $self, $class; + return $self; +} + +sub check { + my $self = shift; +#$self->dumper($self); + $self->blacklist('daco', $self->{cpqDaCntlrIndex}); + foreach (@{$self->{accelerators}}) { + $_->check(); + } + foreach (@{$self->{enclosures}}) { + $_->check(); + } + foreach (@{$self->{logical_drives}}) { + $_->check(); + } + foreach (@{$self->{physical_drives}}) { + $_->check(); + } + foreach (@{$self->{spare_drives}}) { + $_->check(); + } + if ($self->{cpqDaCntlrCondition} eq 'other') { + if (scalar(@{$self->{physical_drives}})) { + $self->add_message(CRITICAL, + sprintf 'da controller %s in slot %s needs attention', + $self->{cpqDaCntlrIndex}, $self->{cpqDaCntlrSlot}); + $self->add_info(sprintf 'da controller %s in slot %s needs attention', + $self->{cpqDaCntlrIndex}, $self->{cpqDaCntlrSlot}); + } else { + $self->add_info(sprintf 'da controller %s in slot %s is ok and unused', + $self->{cpqDaCntlrIndex}, $self->{cpqDaCntlrSlot}); + $self->{blacklisted} = 1; + } + } elsif ($self->{cpqDaCntlrCondition} eq 'degraded') { + # maybe only the battery has failed and is disabled, no problem + if (scalar(grep { + $_->has_failed() && $_->is_disabled() + } @{$self->{accelerators}})) { + # message was already written in the accel code + } else { + $self->add_message(CRITICAL, + sprintf 'da controller %s in slot %s needs attention', + $self->{cpqDaCntlrIndex}, $self->{cpqDaCntlrSlot}); + $self->add_info(sprintf 'da controller %s in slot %s needs attention', + $self->{cpqDaCntlrIndex}, $self->{cpqDaCntlrSlot}); + } + } elsif ($self->{cpqDaCntlrCondition} ne 'ok') { + $self->add_message(CRITICAL, + sprintf 'da controller %s in slot %s needs attention', + $self->{cpqDaCntlrIndex}, $self->{cpqDaCntlrSlot}); + $self->add_info(sprintf 'da controller %s in slot %s needs attention', + $self->{cpqDaCntlrIndex}, $self->{cpqDaCntlrSlot}); + } else { + $self->add_info(sprintf 'da controller %s in slot %s is ok', + $self->{cpqDaCntlrIndex}, $self->{cpqDaCntlrSlot}); + } +} + +sub dump { + my $self = shift; + printf "[DA_CONTROLLER_%s]\n", $self->{name}; + foreach (qw(cpqDaCntlrSlot cpqDaCntlrIndex cpqDaCntlrCondition + cpqDaCntlrModel)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "\n"; + foreach (@{$self->{accelerators}}) { + $_->dump(); + } + foreach (@{$self->{enclosures}}) { + $_->dump(); + } + foreach (@{$self->{logical_drives}}) { + $_->dump(); + } + foreach (@{$self->{physical_drives}}) { + $_->dump(); + } + foreach (@{$self->{spare_drives}}) { + $_->dump(); + } +} + + +package HP::Proliant::Component::DiskSubsystem::Da::Accelerator; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Da); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + runtime => $params{runtime}, + cpqDaAccelCntlrIndex => $params{cpqDaAccelCntlrIndex}, + cpqDaAccelBattery => $params{cpqDaAccelBattery} || 'notPresent', + cpqDaAccelCondition => $params{cpqDaAccelCondition}, + cpqDaAccelStatus => $params{cpqDaAccelStatus}, + cpqDaAccelErrCode => $params{cpqDaAccelErrCode}, + blacklisted => 0, + failed => 0, + }; + $self->{controllerindex} = $self->{cpqDaAccelCntlrIndex}; + bless $self, $class; + return $self; +} + +sub check { + my $self = shift; + $self->blacklist('daac', $self->{cpqDaAccelCntlrIndex}); + $self->add_info(sprintf 'controller accelerator is %s', + $self->{cpqDaAccelCondition}); + if ($self->{cpqDaAccelCondition} eq "failed" || $self->{cpqDaAccelCondition} eq "degraded") { + $self->add_message(CRITICAL, sprintf + "controller accelerator is %s (reason: %s) and needs attention", + $self->{cpqDaAccelCondition}, $self->{cpqDaAccelErrCode}); + } + $self->blacklist('daacb', $self->{cpqDaAccelCntlrIndex}); + $self->add_info(sprintf 'controller accelerator battery is %s', + $self->{cpqDaAccelBattery}); + if ($self->{cpqDaAccelBattery} eq "notPresent") { + } elsif ($self->{cpqDaAccelBattery} eq "recharging") { + $self->add_message(WARNING, "controller accelerator battery recharging"); + } elsif ($self->{cpqDaAccelBattery} eq "failed" && + $self->{cpqDaAccelStatus} eq "tmpDisabled") { + $self->add_message(WARNING, "controller accelerator battery needs attention"); + } elsif ($self->{cpqDaAccelBattery} ne "ok") { + # (other) failed degraded + $self->add_message(CRITICAL, "controller accelerator battery needs attention"); + } +} + +sub has_failed { + my $self = shift; + return $self->{cpqDaAccelStatus} =~ /Disabled/ ? 1 : 0; +} + +sub is_disabled { + my $self = shift; + return $self->{cpqDaAccelStatus} =~ /Disabled/ ? 1 : 0; +} + +sub dump { + my $self = shift; + printf "[ACCELERATOR]\n"; + foreach (qw(cpqDaAccelCntlrIndex cpqDaAccelBattery + cpqDaAccelStatus cpqDaAccelCondition cpqDaAccelErrCode)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "\n"; +} + +package HP::Proliant::Component::DiskSubsystem::Da::Enclosure; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Da); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + runtime => $params{runtime}, + name => $params{name}, + cpqDaEnclCntlrIndex => $params{cpqDaEnclCntlrIndex}, + cpqDaEnclIndex => $params{cpqDaEnclIndex}, + cpqDaEnclPort => $params{cpqDaEnclPort}, + cpqDaEnclBox => $params{cpqDaEnclBox}, + cpqDaEnclCondition => $params{cpqDaEnclCondition}, + blacklisted => 0, + }; + bless $self, $class; + $self->{name} = $params{name} || + $self->{cpqDaEnclPort}.':'.$self->{cpqDaEnclBox}; ##vorerst + $self->{controllerindex} = $self->{cpqDaEnclCntlrIndex}; + return $self; +} + +sub check { + my $self = shift; + $self->blacklist('dae', $self->{name}); + $self->add_info( + sprintf "disk enclosure %s is %s", + $self->{name}, $self->{cpqDaEnclCondition}); + if ($self->{cpqDaEnclCondition} !~ /^OK/) { + $self->add_message(CRITICAL, + sprintf "disk enclosure %s is %s", + $self->{name}, $self->{cpqDaEnclCondition}); + } +} + +sub dump { + my $self = shift; + printf "[Disk Enclosure]\n"; + foreach (qw(cpqDaEnclCntlrIndex cpqDaEnclIndex cpqDaEnclPort + cpqDaEnclBox cpqDaEnclCondition)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "\n"; +} + +package HP::Proliant::Component::DiskSubsystem::Da::LogicalDrive; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Da); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + runtime => $params{runtime}, + cpqDaLogDrvIndex => $params{cpqDaLogDrvIndex}, + cpqDaLogDrvCntlrIndex => $params{cpqDaLogDrvCntlrIndex}, + cpqDaLogDrvSize => $params{cpqDaLogDrvSize}, + cpqDaLogDrvFaultTol => $params{cpqDaLogDrvFaultTol}, + cpqDaLogDrvPercentRebuild => $params{cpqDaLogDrvPercentRebuild}, + cpqDaLogDrvStatus => $params{cpqDaLogDrvStatus}, + cpqDaLogDrvCondition => $params{cpqDaLogDrvCondition}, + cpqDaLogDrvPhyDrvIDs => $params{cpqDaLogDrvPhyDrvIDs}, + blacklisted => 0, + }; + bless $self, $class; + $self->{name} = $params{name} || + $self->{cpqDaLogDrvCntlrIndex}.':'.$self->{cpqDaLogDrvIndex}; ##vorerst + $self->{controllerindex} = $self->{cpqDaLogDrvCntlrIndex}; + if (! $self->{cpqDaLogDrvPercentRebuild} || + $self->{cpqDaLogDrvPercentRebuild} == 4294967295) { + $self->{cpqDaLogDrvPercentRebuild} = 100; + } + return $self; +} + +sub check { + my $self = shift; + $self->blacklist('dald', $self->{name}); + $self->add_info(sprintf "logical drive %s is %s (%s)", + $self->{name}, $self->{cpqDaLogDrvStatus}, + $self->{cpqDaLogDrvFaultTol}); + if ($self->{cpqDaLogDrvCondition} ne "ok") { + if ($self->{cpqDaLogDrvStatus} =~ + /rebuild|recovering|recovery|expanding|queued/) { + $self->add_message(WARNING, + sprintf "logical drive %s is %s", + $self->{name}, $self->{cpqDaLogDrvStatus}); + } else { + $self->add_message(CRITICAL, + sprintf "logical drive %s is %s", + $self->{name}, $self->{cpqDaLogDrvStatus}); + } + } +} + +sub dump { + my $self = shift; + printf "[LOGICAL_DRIVE]\n"; + foreach (qw(cpqDaLogDrvCntlrIndex cpqDaLogDrvIndex cpqDaLogDrvSize + cpqDaLogDrvFaultTol cpqDaLogDrvStatus cpqDaLogDrvCondition + cpqDaLogDrvPercentRebuild cpqDaLogDrvPhyDrvIDs)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "\n"; +} + + +package HP::Proliant::Component::DiskSubsystem::Da::PhysicalDrive; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Da); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + runtime => $params{runtime}, + name => $params{name}, + cpqDaPhyDrvCntlrIndex => $params{cpqDaPhyDrvCntlrIndex}, + cpqDaPhyDrvIndex => $params{cpqDaPhyDrvIndex}, + cpqDaPhyDrvBay => $params{cpqDaPhyDrvBay}, + cpqDaPhyDrvBusNumber => $params{cpqDaPhyDrvBusNumber}, + cpqDaPhyDrvSize => $params{cpqDaPhyDrvSize}, + cpqDaPhyDrvStatus => $params{cpqDaPhyDrvStatus}, + cpqDaPhyDrvCondition => $params{cpqDaPhyDrvCondition}, + blacklisted => 0, + }; + bless $self, $class; + $self->{name} = $params{name} || + $self->{cpqDaPhyDrvCntlrIndex}.':'.$self->{cpqDaPhyDrvIndex}; ##vorerst + $self->{controllerindex} = $self->{cpqDaPhyDrvCntlrIndex}; + return $self; +} + +sub check { + my $self = shift; + $self->blacklist('dapd', $self->{name}); + $self->add_info( + sprintf "physical drive %s is %s", + $self->{name}, $self->{cpqDaPhyDrvCondition}); + if ($self->{cpqDaPhyDrvCondition} ne 'ok') { + $self->add_message(CRITICAL, + sprintf "physical drive %s is %s", + $self->{name}, $self->{cpqDaPhyDrvCondition}); + } +} + +sub dump { + my $self = shift; + printf "[PHYSICAL_DRIVE]\n"; + foreach (qw(cpqDaPhyDrvCntlrIndex cpqDaPhyDrvIndex cpqDaPhyDrvBay + cpqDaPhyDrvBusNumber cpqDaPhyDrvSize cpqDaPhyDrvStatus + cpqDaPhyDrvCondition)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "\n"; +} + + +package HP::Proliant::Component::DiskSubsystem::Da::SpareDrive; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Da); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub dump { + my $self = shift; + printf "[SPARE_DRIVE]\n"; + foreach (qw(cpqDaPhyDrvCntlrIndex cpqDaPhyDrvIndex cpqDaPhyDrvBay + cpqDaPhyDrvBusNumber cpqDaPhyDrvSize cpqDaPhyDrvStatus + cpqDaPhyDrvCondition)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "\n"; +} + + +1; diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Da/CLI.pm b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Da/CLI.pm new file mode 100755 index 0000000..75d3181 --- /dev/null +++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Da/CLI.pm @@ -0,0 +1,239 @@ +package HP::Proliant::Component::DiskSubsystem::Da::CLI; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Da); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + controllers => [], + accelerators => [], + enclosures => [], + physical_drives => [], + logical_drives => [], + spare_drives => [], + blacklisted => 0, + }; + bless $self, $class; + return $self; +} + +sub init { + my $self = shift; + my $hpacucli = $self->{rawdata}; + my $slot = 0; + my $type = "unkn"; + my @lines = (); + my $thistype = 0; + my $tmpcntl = {}; + my $tmpaccel = {}; + my $tmpld = {}; + my $tmppd = {}; + my $tmpencl = {}; + my $cntlindex = 0; + my $enclosureindex = 0; + my $ldriveindex = 0; + my $pdriveindex = 0; + my $incontroller = 0; + foreach (split(/\n/, $hpacucli)) { + next unless /^status/; + next if /^status\s*$/; + s/^status\s*//; + if (/(MSA[\s\w]+)\s+in\s+(\w+)/) { + $incontroller = 1; + $slot = $2; + $cntlindex++; + $tmpcntl->{$slot}->{cpqDaCntlrIndex} = $cntlindex; + $tmpcntl->{$slot}->{cpqDaCntlrModel} = $1; + $tmpcntl->{$slot}->{cpqDaCntlrSlot} = $slot; + } elsif (/([\s\w]+) in Slot\s+(\d+)/) { + $incontroller = 1; + $slot = $2; + $cntlindex++; + $tmpcntl->{$slot}->{cpqDaCntlrIndex} = $cntlindex; + $tmpcntl->{$slot}->{cpqDaCntlrModel} = $1; + $tmpcntl->{$slot}->{cpqDaCntlrSlot} = $slot; + } elsif (/Controller Status: (\w+)/) { + $tmpcntl->{$slot}->{cpqDaCntlrBoardCondition} = lc $1; + $tmpcntl->{$slot}->{cpqDaCntlrCondition} = lc $1; + } elsif (/Cache Status: ([\w\s]+?)\s*$/) { + # Cache Status: OK + # Cache Status: Not Configured + # Cache Status: Temporarily Disabled + $tmpaccel->{$slot}->{cpqDaAccelCntlrIndex} = $cntlindex; + $tmpaccel->{$slot}->{cpqDaAccelSlot} = $slot; + #condition: other,ok,degraded,failed + #status: other,invalid,enabled,tmpDisabled,permDisabled + $tmpaccel->{$slot}->{cpqDaAccelCondition} = lc $1; + if ($tmpaccel->{$slot}->{cpqDaAccelCondition} eq 'ok') { + $tmpaccel->{$slot}->{cpqDaAccelStatus} = 'enabled'; + } elsif ($tmpaccel->{$slot}->{cpqDaAccelCondition} eq 'not configured') { + $tmpaccel->{$slot}->{cpqDaAccelCondition} = 'ok'; + $tmpaccel->{$slot}->{cpqDaAccelStatus} = 'enabled'; + } elsif ($tmpaccel->{$slot}->{cpqDaAccelCondition} eq 'temporarily disabled') { + $tmpaccel->{$slot}->{cpqDaAccelCondition} = 'ok'; + $tmpaccel->{$slot}->{cpqDaAccelStatus} = 'tmpDisabled'; + } elsif ($tmpaccel->{$slot}->{cpqDaAccelCondition} eq 'permanently disabled') { + $tmpaccel->{$slot}->{cpqDaAccelCondition} = 'ok'; + $tmpaccel->{$slot}->{cpqDaAccelStatus} = 'permDisabled'; + } else { + $tmpaccel->{$slot}->{cpqDaAccelStatus} = 'enabled'; + } + } elsif (/Battery.* Status: (\w+)/) { + # sowas gibts auch Battery/Capacitor Status: OK + $tmpaccel->{$slot}->{cpqDaAccelBattery} = lc $1; + } elsif (/^\s*$/) { + } + } + $slot = 0; + $cntlindex = 0; + $enclosureindex = 0; + $ldriveindex = 0; + $pdriveindex = 0; + foreach (split(/\n/, $hpacucli)) { + next unless /^config/; + next if /^config\s*$/; + s/^config\s*//; + if (/(MSA[\s\w]+)\s+in\s+(\w+)/) { + $slot = $2; + $cntlindex++; + $pdriveindex = 1; + } elsif (/([\s\w]+) in Slot\s+(\d+)/) { + #if ($slot ne $2 || ! $slot) { + $cntlindex++; + # 2012-12-15 das passt nicht zur oberen schleife + # ich habe keine ahnung, was der hintergrund fuer dieses if ist + #} + $slot = $2; + $pdriveindex = 1; + } elsif (/([\s\w]+) at Port ([\w]+), Box (\d+), (.*)/) { + $enclosureindex++; + $tmpencl->{$slot}->{$enclosureindex}->{cpqDaEnclCntlrIndex} = $cntlindex; + $tmpencl->{$slot}->{$enclosureindex}->{cpqDaEnclIndex} = $enclosureindex; + $tmpencl->{$slot}->{$enclosureindex}->{cpqDaEnclPort} = $2; + $tmpencl->{$slot}->{$enclosureindex}->{cpqDaEnclBox} = $3; + $tmpencl->{$slot}->{$enclosureindex}->{cpqDaEnclCondition} = $4; + $tmpencl->{$slot}->{$enclosureindex}->{cpqDaEnclStatus} = + $tmpencl->{$slot}->{$enclosureindex}->{cpqDaEnclCondition}; + $tmpencl->{$slot}->{$enclosureindex}->{cpqDaLogDrvPhyDrvIDs} = 'unknown'; + } elsif (/logicaldrive\s+(.+?)\s+\((.*)\)/) { + # logicaldrive 1 (683.5 GB, RAID 5, OK) + # logicaldrive 1 (683.5 GB, RAID 5, OK) + # logicaldrive 2 (442 MB, RAID 1+0, OK) + $ldriveindex = $1; + $tmpld->{$slot}->{$ldriveindex}->{cpqDaLogDrvCntlrIndex} = $cntlindex; + $tmpld->{$slot}->{$ldriveindex}->{cpqDaLogDrvIndex} = $ldriveindex; + ($tmpld->{$slot}->{$ldriveindex}->{cpqDaLogDrvSize}, + $tmpld->{$slot}->{$ldriveindex}->{cpqDaLogDrvFaultTol}, + $tmpld->{$slot}->{$ldriveindex}->{cpqDaLogDrvCondition}) = + map { lc $_ } split(/,\s*/, $2); + $tmpld->{$slot}->{$ldriveindex}->{cpqDaLogDrvStatus} = + $tmpld->{$slot}->{$ldriveindex}->{cpqDaLogDrvCondition}; + $tmpld->{$slot}->{$ldriveindex}->{cpqDaLogDrvPhyDrvIDs} = 'unknown'; + } elsif (/physicaldrive\s+(.+?)\s+\((.*)\)/) { + # physicaldrive 2:0 (port 2:id 0 , Parallel SCSI, 36.4 GB, OK) + # physicaldrive 2I:1:6 (port 2I:box 1:bay 6, SAS, 146 GB, OK) + # physicaldrive 1:1 (box 1:bay 1, Parallel SCSI, 146 GB, OK) + my $name = $1; + my($location, $type, $size, $status) = split(/,/, $2); + $status =~ s/^\s+//g; + $status =~ s/\s+$//g; + $status = lc $status; + my %location = (); + foreach (split(/:/, $location)) { + $location{$1} = $2 if /(\w+)\s+(\w+)/; + } + $location{box} ||= 0; + $location{id} ||= $pdriveindex; + $location{bay} ||= $location{id}; + $location{port} ||= $location{bay}; + $tmppd->{$slot}->{$name}->{name} = lc $name; + $tmppd->{$slot}->{$name}->{cpqDaPhyDrvCntlrIndex} = $cntlindex; + $tmppd->{$slot}->{$name}->{cpqDaPhyDrvIndex} = $location{id}; + $tmppd->{$slot}->{$name}->{cpqDaPhyDrvBay} = $location{bay}; + $tmppd->{$slot}->{$name}->{cpqDaPhyDrvBusNumber} = $location{port}; + $tmppd->{$slot}->{$name}->{cpqDaPhyDrvSize} = $size; + $tmppd->{$slot}->{$name}->{cpqDaPhyDrvStatus} = $status; + $tmppd->{$slot}->{$name}->{cpqDaPhyDrvCondition} = $status; + $tmppd->{$slot}->{$name}->{ldriveindex} = $ldriveindex || -1; + foreach (keys %{$tmppd->{$slot}->{$name}}) { + $tmppd->{$slot}->{$name}->{$_} =~ s/^\s+//g; + $tmppd->{$slot}->{$name}->{$_} =~ s/\s+$//g; + $tmppd->{$slot}->{$name}->{$_} = lc $tmppd->{$slot}->{$name}->{$_}; + } + $pdriveindex++; + } + } + + foreach my $slot (keys %{$tmpcntl}) { + if (exists $tmpcntl->{$slot}->{cpqDaCntlrModel} && + ! $self->identified($tmpcntl->{$slot}->{cpqDaCntlrModel})) { + delete $tmpcntl->{$slot}; + delete $tmpaccel->{$slot}; + delete $tmpencl->{$slot}; + delete $tmpld->{$slot}; + delete $tmppd->{$slot}; + } + } + +#printf "%s\n", Data::Dumper::Dumper($tmpcntl); +#printf "%s\n", Data::Dumper::Dumper($tmpaccel); +#printf "%s\n", Data::Dumper::Dumper($tmpld); +#printf "%s\n", Data::Dumper::Dumper($tmppd); + foreach my $slot (sort { + $tmpcntl->{$a}->{cpqDaCntlrIndex} <=> $tmpcntl->{$b}->{cpqDaCntlrIndex} + }keys %{$tmpcntl}) { + $tmpcntl->{$slot}->{runtime} = $self->{runtime}; + push(@{$self->{controllers}}, + HP::Proliant::Component::DiskSubsystem::Da::Controller->new( + %{$tmpcntl->{$slot}})); + } + foreach my $slot (sort { + $tmpaccel->{$a}->{cpqDaAccelCntlrIndex} <=> $tmpaccel->{$b}->{cpqDaAccelCntlrIndex} + } keys %{$tmpaccel}) { + $tmpaccel->{$slot}->{runtime} = $self->{runtime}; + push(@{$self->{accelerators}}, + HP::Proliant::Component::DiskSubsystem::Da::Accelerator->new( + %{$tmpaccel->{$slot}})); + } + foreach my $slot (keys %{$tmpencl}) { + foreach my $enclosureindex (keys %{$tmpencl->{$slot}}) { + $tmpencl->{$slot}->{$enclosureindex}->{runtime} = $self->{runtime}; + push(@{$self->{enclosures}}, + HP::Proliant::Component::DiskSubsystem::Da::Enclosure->new( + %{$tmpencl->{$slot}->{$enclosureindex}})); + } + } + foreach my $slot (keys %{$tmpld}) { + foreach my $ldriveindex (keys %{$tmpld->{$slot}}) { + $tmpld->{$slot}->{$ldriveindex}->{runtime} = $self->{runtime}; + push(@{$self->{logical_drives}}, + HP::Proliant::Component::DiskSubsystem::Da::LogicalDrive->new( + %{$tmpld->{$slot}->{$ldriveindex}})); + } + foreach my $pdriveindex (sort { + (split ':', $a, 2)[0] cmp (split ':', $b, 2)[0] || + (split ':', $a, 2)[1] cmp (split ':', $b, 2)[1] || + (split ':', $a, 2)[2] <=> (split ':', $b, 2)[2] + } keys %{$tmppd->{$slot}}) { + $tmppd->{$slot}->{$pdriveindex}->{runtime} = $self->{runtime}; + push(@{$self->{physical_drives}}, + HP::Proliant::Component::DiskSubsystem::Da::PhysicalDrive->new( + %{$tmppd->{$slot}->{$pdriveindex}})); + } + } +} + +sub identified { + my $self = shift; + my $info = shift; + return 1 if $info =~ /Parallel SCSI/; + return 1 if $info =~ /Smart Array/; # Trond: works fine on E200i, P400, E400 + return 1 if $info =~ /MSA500/; + #return 1 if $info =~ /Smart Array (5|6)/; + #return 1 if $info =~ /Smart Array P400i/; # snmp sagt Da, trotz SAS in cli + #return 1 if $info =~ /Smart Array P410i/; # dto + return 0; +} diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Da/SNMP.pm b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Da/SNMP.pm new file mode 100755 index 0000000..629fe29 --- /dev/null +++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Da/SNMP.pm @@ -0,0 +1,232 @@ +package HP::Proliant::Component::DiskSubsystem::Da::SNMP; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Da + HP::Proliant::Component::SNMP); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + controllers => [], + accelerators => [], + enclosures => [], + physical_drives => [], + logical_drives => [], + spare_drives => [], + blacklisted => 0, + }; + bless $self, $class; + return $self; +} + +sub init { + my $self = shift; + my $snmpwalk = $self->{rawdata}; + + # CPQIDA-MIB + my $oids = { + cpqDaCntlrEntry => "1.3.6.1.4.1.232.3.2.2.1.1", + cpqDaCntlrIndex => "1.3.6.1.4.1.232.3.2.2.1.1.1", + cpqDaCntlrModel => "1.3.6.1.4.1.232.3.2.2.1.1.2", + cpqDaCntlrSlot => "1.3.6.1.4.1.232.3.2.2.1.1.5", + cpqDaCntlrCondition => "1.3.6.1.4.1.232.3.2.2.1.1.6", + cpqDaCntlrBoardCondition => "1.3.6.1.4.1.232.3.2.2.1.1.12", + cpqDaCntlrModelValue => { + 1 => 'other', + 2 => 'ida', + 3 => 'idaExpansion', + 4 => 'ida-2', + 5 => 'smart', + 6 => 'smart-2e', + 7 => 'smart-2p', + 8 => 'smart-2sl', + 9 => 'smart-3100es', + 10 => 'smart-3200', + 11 => 'smart-2dh', + 12 => 'smart-221', + 13 => 'sa-4250es', + 14 => 'sa-4200', + 15 => 'sa-integrated', + 16 => 'sa-431', + 17 => 'sa-5300', + 18 => 'raidLc2', + 19 => 'sa-5i', + 20 => 'sa-532', + 21 => 'sa-5312', + 22 => 'sa-641', + 23 => 'sa-642', + 24 => 'sa-6400', + 25 => 'sa-6400em', + 26 => 'sa-6i', + }, + cpqDaCntlrConditionValue => { + 1 => "other", + 2 => "ok", + 3 => "degraded", + 4 => "failed", + }, + cpqDaCntlrBoardConditionValue => { + 1 => "other", + 2 => "ok", + 3 => "degraded", + 4 => "failed", + }, + }; + + # INDEX { cpqDaCntlrIndex } + foreach ($self->get_entries($oids, 'cpqDaCntlrEntry')) { + push(@{$self->{controllers}}, + HP::Proliant::Component::DiskSubsystem::Da::Controller->new(%{$_})); + } + + $oids = { + cpqDaAccelEntry => "1.3.6.1.4.1.232.3.2.2.2.1", + cpqDaAccelCntlrIndex => "1.3.6.1.4.1.232.3.2.2.2.1.1", + cpqDaAccelStatus => "1.3.6.1.4.1.232.3.2.2.2.1.2", + cpqDaAccelErrCode => "1.3.6.1.4.1.232.3.2.2.2.1.5", + cpqDaAccelBattery => "1.3.6.1.4.1.232.3.2.2.2.1.6", + cpqDaAccelCondition => "1.3.6.1.4.1.232.3.2.2.2.1.9", + cpqDaAccelBatteryValue => { + 1 => 'other', + 2 => 'ok', + 3 => 'recharging', + 4 => 'failed', + 5 => 'degraded', + 6 => 'notPresent', + }, + cpqDaAccelConditionValue => { + 1 => "other", + 2 => "ok", + 3 => "degraded", + 4 => "failed", + }, + cpqDaAccelStatusValue => { + 1 => "other", + 2 => "invalid", + 3 => "enabled", + 4 => "tmpDisabled", + 5 => "permDisabled", + }, + cpqDaAccelErrCodeValue => { + 1 => 'other', + 2 => 'invalid', + 3 => 'badConfig', + 4 => 'lowBattery', + 5 => 'disableCmd', + 6 => 'noResources', + 7 => 'notConnected', + 8 => 'badMirrorData', + 9 => 'readErr', + 10 => 'writeErr', + 11 => 'configCmd', + 12 => 'expandInProgress', + 13 => 'snapshotInProgress', + 14 => 'redundantLowBattery', + 15 => 'redundantSizeMismatch', + 16 => 'redundantCacheFailure', + 17 => 'excessiveEccErrors', + 18 => 'adgEnablerMissing', + 19 => 'postEccErrors', + 20 => 'batteryHotRemoved', + 21 => 'capacitorChargeLow', + 22 => 'notEnoughBatteries', + 23 => 'cacheModuleNotSupported', + 24 => 'batteryNotSupported', + 25 => 'noCapacitorAttached', + 26 => 'capBasedBackupFailed', + 27 => 'capBasedRestoreFailed', + 28 => 'capBasedModuleHWFailure', + 29 => 'capacitorFailedToCharge', + 30 => 'capacitorBasedHWMemBeingErased', + 31 => 'incompatibleCacheModule', + 32 => 'fbcmChargerCircuitFailure', + }, + }; + + # INDEX { cpqDaAccelCntlrIndex } + foreach ($self->get_entries($oids, 'cpqDaAccelEntry')) { + push(@{$self->{accelerators}}, + HP::Proliant::Component::DiskSubsystem::Da::Accelerator->new(%{$_})); + } + + $oids = { + cpqDaLogDrvEntry => "1.3.6.1.4.1.232.3.2.3.1.1", + cpqDaLogDrvCntlrIndex => "1.3.6.1.4.1.232.3.2.3.1.1.1", + cpqDaLogDrvIndex => "1.3.6.1.4.1.232.3.2.3.1.1.2", + cpqDaLogDrvFaultTol => "1.3.6.1.4.1.232.3.2.3.1.1.3", + cpqDaLogDrvStatus => "1.3.6.1.4.1.232.3.2.3.1.1.4", + cpqDaLogDrvSize => "1.3.6.1.4.1.232.3.2.3.1.1.9", + cpqDaLogDrvPhyDrvIDs => "1.3.6.1.4.1.232.3.2.3.1.1.10", + cpqDaLogDrvCondition => "1.3.6.1.4.1.232.3.2.3.1.1.11", + cpqDaLogDrvPercentRebuild => "1.3.6.1.4.1.232.3.2.3.1.1.12", + cpqDaLogDrvFaultTolValue => { + 1 => "other", + 2 => "none", + 3 => "mirroring", + 4 => "dataGuard", + 5 => "distribDataGuard", + 7 => "advancedDataGuard", + }, + cpqDaLogDrvConditionValue => { + 1 => "other", + 2 => "ok", + 3 => "degraded", + 4 => "failed", + }, + cpqDaLogDrvStatusValue => { + 1 => "other", + 2 => "ok", + 3 => "failed", + 4 => "unconfigured", + 5 => "recovering", + 6 => "readyForRebuild", + 7 => "rebuilding", + 8 => "wrongDrive", + 9 => "badConnect", + 10 => "overheating", + 11 => "shutdown", + 12 => "expanding", + 13 => "notAvailable", + 14 => "queuedForExpansion", + }, + }; + + # INDEX { cpqDaLogDrvCntlrIndex, cpqDaLogDrvIndex } + foreach ($self->get_entries($oids, 'cpqDaLogDrvEntry')) { + $_->{cpqDaLogDrvPhyDrvIDs} ||= 'empty'; + push(@{$self->{logical_drives}}, + HP::Proliant::Component::DiskSubsystem::Da::LogicalDrive->new(%{$_})); + } + + $oids = { + cpqDaPhyDrvEntry => "1.3.6.1.4.1.232.3.2.5.1.1", + cpqDaPhyDrvCntlrIndex => "1.3.6.1.4.1.232.3.2.5.1.1.1", + cpqDaPhyDrvIndex => "1.3.6.1.4.1.232.3.2.5.1.1.2", + cpqDaPhyDrvBay => "1.3.6.1.4.1.232.3.2.5.1.1.5", + cpqDaPhyDrvStatus => "1.3.6.1.4.1.232.3.2.5.1.1.6", + cpqDaPhyDrvSize => "1.3.6.1.4.1.232.3.2.5.1.1.9", + cpqDaPhyDrvCondition => "1.3.6.1.4.1.232.3.2.5.1.1.37", + cpqDaPhyDrvBusNumber => "1.3.6.1.4.1.232.3.2.5.1.1.50", + cpqDaPhyDrvConditionValue => { + 1 => "other", + 2 => "ok", + 3 => "degraded", + 4 => "failed", + }, + cpqDaPhyDrvStatusValue => { + 1 => "other", + 2 => "ok", + 3 => "failed", + 4 => "predictiveFailure", + }, + }; + + # INDEX { cpqDaPhyDrvCntlrIndex, cpqDaPhyDrvIndex } + foreach ($self->get_entries($oids, 'cpqDaPhyDrvEntry')) { + push(@{$self->{physical_drives}}, + HP::Proliant::Component::DiskSubsystem::Da::PhysicalDrive->new(%{$_})); + } + +} diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Fca.pm b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Fca.pm new file mode 100755 index 0000000..2014697 --- /dev/null +++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Fca.pm @@ -0,0 +1,433 @@ +package HP::Proliant::Component::DiskSubsystem::Fca; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + runtime => $params{runtime}, + rawdata => $params{rawdata}, + method => $params{method}, + host_controllers => [], + controllers => [], + accelerators => [], + enclosures => [], + physical_drives => [], + logical_drives => [], + spare_drives => [], + global_status => undef, + blacklisted => 0, + }; + bless $self, $class; + if ($self->{method} eq 'snmp') { + bless $self, 'HP::Proliant::Component::DiskSubsystem::Fca::SNMP'; + } else { + bless $self, 'HP::Proliant::Component::DiskSubsystem::Fca::CLI'; + } + $self->init(); + $self->assemble(); + return $self; +} + +sub assemble { + my $self = shift; + $self->trace(3, sprintf "%s controllers und platten zusammenfuehren", + ref($self)); + $self->trace(3, sprintf "has %d host controllers", + scalar(@{$self->{host_controllers}})); + $self->trace(3, sprintf "has %d controllers", + scalar(@{$self->{controllers}})); + $self->trace(3, sprintf "has %d physical_drives", + scalar(@{$self->{physical_drives}})); + $self->trace(3, sprintf "has %d logical_drives", + scalar(@{$self->{logical_drives}})); + $self->trace(3, sprintf "has %d spare_drives", + scalar(@{$self->{spare_drives}})); +} + +sub check { + my $self = shift; + foreach (@{$self->{host_controllers}}) { + $_->check(); + } + foreach (@{$self->{controllers}}) { + $_->check(); + } + foreach (@{$self->{accelerators}}) { + $_->check(); + } + foreach (@{$self->{logical_drives}}) { + $_->check(); + } + foreach (@{$self->{physical_drives}}) { + $_->check(); + } + # wozu eigentlich? + #if (! $self->has_controllers()) { + #$self->{global_status}->check(); + #} +} + +sub dump { + my $self = shift; + foreach (@{$self->{host_controllers}}) { + $_->dump(); + } + foreach (@{$self->{controllers}}) { + $_->dump(); + } + foreach (@{$self->{accelerators}}) { + $_->dump(); + } + foreach (@{$self->{logical_drives}}) { + $_->dump(); + } + foreach (@{$self->{physical_drives}}) { + $_->dump(); + } + #$self->{global_status}->dump(); +} + + +package HP::Proliant::Component::DiskSubsystem::Fca::GlobalStatus; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Fca); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + runtime => $params{runtime}, + cpqFcaMibCondition => $params{cpqFcaMibCondition}, + }; + bless $self, $class; + return $self; +} + +sub check { + my $self = shift; + if ($self->{cpqFcaMibCondition} eq 'other') { + $self->add_message(OK, + sprintf 'fcal overall condition is other, update your drivers, please'); + } elsif ($self->{cpqFcaMibCondition} ne 'ok') { + $self->add_message(CRITICAL, + sprintf 'fcal overall condition is %s', $self->{cpqFcaMibCondition}); + } + $self->{info} = + sprintf 'fcal overall condition is %s', $self->{cpqFcaMibCondition}; +} + +sub dump { + my $self = shift; + printf "[FCAL]\n"; + foreach (qw(cpqFcaMibCondition)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "\n"; +} + + +package HP::Proliant::Component::DiskSubsystem::Fca::HostController; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Fca); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + runtime => $params{runtime}, + blacklisted => 0, + info => undef, + extendedinfo => undef, + }; + map { $self->{$_} = $params{$_} } grep /cpqFcaHostCntlr/, keys %params; + $self->{name} = $params{name} || $self->{cpqFcaHostCntlrIndex}; + $self->{controllerindex} = $self->{cpqFcaHostCntlrIndex}; + bless $self, $class; + return $self; +} + +sub check { + my $self = shift; + $self->blacklist('fcahc', $self->{name}); + my $info = sprintf 'fcal host controller %s in slot %s is %s', + $self->{name}, $self->{cpqFcaHostCntlrSlot}, $self->{cpqFcaHostCntlrCondition}; + if ($self->{cpqFcaHostCntlrCondition} eq 'other') { + #$info .= sprintf ' and needs attention (%s)', $self->{cpqFcaHostCntlrStatus}; + # let's assume other=ok + $self->add_message(OK, $info); + $self->add_info($info); + } elsif ($self->{cpqFcaHostCntlrCondition} ne 'ok') { + $self->add_message(CRITICAL, $info); + $self->add_info($info); + } else { + $self->add_info($info); + } + $self->blacklist('fcahco', $self->{name}); + $info = sprintf 'fcal host controller %s overall condition is %s', + $self->{name}, $self->{cpqFcaHostCntlrOverallCondition}; + if ($self->{cpqFcaHostCntlrOverallCondition} eq 'other') { + $self->add_message(OK, $info); + } elsif ($self->{cpqFcaHostCntlrOverallCondition} ne 'ok') { + $self->add_message(WARNING, $info); + } + $self->add_info($info); +} + +sub dump { + my $self = shift; + printf "[FCAL_HOST_CONTROLLER_%s]\n", $self->{name}; + foreach (qw(cpqFcaHostCntlrIndex cpqFcaHostCntlrSlot + cpqFcaHostCntlrModel cpqFcaHostCntlrStatus cpqFcaHostCntlrCondition + cpqFcaHostCntlrOverallCondition)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "\n"; +} + + +package HP::Proliant::Component::DiskSubsystem::Fca::Controller; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Fca); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + runtime => $params{runtime}, + blacklisted => 0, + info => undef, + extendedinfo => undef, + }; + map { $self->{$_} = $params{$_} } grep /cpqFcaCntlr/, keys %params; + $self->{name} = $params{name} || + $self->{cpqFcaCntlrBoxIndex}.':'.$self->{cpqFcaCntlrBoxIoSlot}; + $self->{controllerindex} = $self->{cpqFcaCntlrBoxIndex}; + bless $self, $class; + return $self; +} + +sub check { + my $self = shift; + $self->blacklist('fcaco', $self->{name}); + my $info = sprintf 'fcal controller %s in box %s/slot %s is %s', + $self->{name}, $self->{cpqFcaCntlrBoxIndex}, $self->{cpqFcaCntlrBoxIoSlot}, + $self->{cpqFcaCntlrCondition}; + if ($self->{cpqFcaCntlrCondition} eq 'other') { + if (1) { # was ist mit phys. drives? + $info .= ' needs attention'; + $info .= sprintf(' (%s)', $self->{cpqFcaCntlrStatus}) unless $self->{cpqFcaCntlrStatus} eq 'ok'; + $self->add_message(CRITICAL, $info); + $self->add_info($info); + } else { + $self->add_info($info); + $self->{blacklisted} = 1; + } + } elsif ($self->{cpqFcaCntlrCondition} ne 'ok') { + $info .= ' needs attention'; + $info .= sprintf(' (%s)', $self->{cpqFcaCntlrStatus}) unless $self->{cpqFcaCntlrStatus} eq 'ok'; + $self->add_message(CRITICAL, $info); + $self->add_info($info); + } else { + $self->add_info($info); + } +} + +sub dump { + my $self = shift; + printf "[FCAL_CONTROLLER_%s]\n", $self->{name}; + foreach (qw(cpqFcaCntlrBoxIndex cpqFcaCntlrBoxIoSlot cpqFcaCntlrModel + cpqFcaCntlrStatus cpqFcaCntlrCondition)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "\n"; +} + + +package HP::Proliant::Component::DiskSubsystem::Fca::Accelerator; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Fca); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + runtime => $params{runtime}, + blacklisted => 0, + info => undef, + extendedinfo => undef, + }; + map { $self->{$_} = $params{$_} } grep /cpqFcaAccel/, keys %params; + $self->{name} = $params{name} || + $self->{cpqFcaAccelBoxIndex}.':'.$self->{cpqFcaAccelBoxIoSlot}; + $self->{controllerindex} = $self->{cpqFcaAccelBoxIndex}; + bless $self, $class; + return $self; +} + +sub check { + my $self = shift; + # !!! cpqFcaAccelStatus + $self->blacklist('fcaac', $self->{name}); + my $info = sprintf 'fcal accelerator %s in box %s/slot %s is ', + $self->{name}, $self->{cpqFcaAccelBoxIndex}, $self->{cpqFcaAccelBoxIoSlot}; + if ($self->{cpqFcaAccelStatus} eq 'invalid') { + $info .= 'not installed'; + $self->add_info($info); + } elsif ($self->{cpqFcaAccelStatus} eq 'tmpDisabled') { + $info .= 'temp disabled'; + $self->add_info($info); + } elsif ($self->{cpqFcaAccelCondition} eq 'other') { + $info .= sprintf '%s and needs attention (%s)', + $self->{cpqFcaAccelCondition}, $self->{cpqFcaAccelErrCode}; + $self->add_message(CRITICAL, $info); + $self->add_info($info); + } elsif ($self->{cpqFcaAccelCondition} ne 'ok') { + $info .= sprintf '%s and needs attention (%s)', + $self->{cpqFcaAccelCondition}, $self->{cpqFcaAccelErrCode}; + $self->add_message(CRITICAL, $info); + $self->add_info($info); + } else { + $info .= sprintf '%s', $self->{cpqFcaAccelCondition}; + $self->add_info($info); + } +} + +sub dump { + my $self = shift; + printf "[FCAL_ACCELERATOR_%s]\n", $self->{name}; + foreach (qw(cpqFcaAccelBoxIndex cpqFcaAccelBoxIoSlot cpqFcaAccelStatus + cpqFcaAccelErrCode cpqFcaAccelBatteryStatus cpqFcaAccelCondition)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "\n"; +} + + +package HP::Proliant::Component::DiskSubsystem::Fca::LogicalDrive; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Fca); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + runtime => $params{runtime}, + blacklisted => 0, + info => undef, + extendedinfo => undef, + }; + map { $self->{$_} = $params{$_} } grep /cpqFcaLogDrv/, keys %params; + bless $self, $class; + $self->{name} = $params{name} || + $self->{cpqFcaLogDrvBoxIndex}.':'. + $self->{cpqFcaLogDrvIndex}; + $self->{controllerindex} = $self->{cpqFcaLogDrvBoxIndex}; + return $self; +} + +sub check { + my $self = shift; + $self->blacklist('fcald', $self->{name}); + my $info = sprintf 'logical drive %s (%s) is %s', + $self->{name}, $self->{cpqFcaLogDrvFaultTol}, $self->{cpqFcaLogDrvCondition}; + if ($self->{cpqFcaLogDrvCondition} ne "ok") { + $info .= sprintf ' (%s)', $self->{cpqFcaLogDrvStatus}; + if ($self->{cpqFcaLogDrvStatus} =~ + /rebuild|recovering|expand/) { + $info .= sprintf ' (%s)', $self->{cpqFcaLogDrvStatus}; + $self->add_message(WARNING, $info); + } else { + $self->add_message(CRITICAL, $info); + } + } + $self->add_info($info); +} + +sub dump { + my $self = shift; + printf "[LOGICAL_DRIVE_%s]\n", $self->{name}; + foreach (qw(cpqFcaLogDrvBoxIndex cpqFcaLogDrvIndex cpqFcaLogDrvFaultTol + cpqFcaLogDrvStatus cpqFcaLogDrvPercentRebuild cpqFcaLogDrvSize + cpqFcaLogDrvPhyDrvIDs cpqFcaLogDrvCondition)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "\n"; +} + + +package HP::Proliant::Component::DiskSubsystem::Fca::PhysicalDrive; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Fca); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + runtime => $params{runtime}, + blacklisted => 0, + info => undef, + extendedinfo => undef, + }; + map { $self->{$_} = $params{$_} } grep /cpqFcaPhyDrv/, keys %params; + $self->{name} = $params{name} || + $self->{cpqFcaPhyDrvBoxIndex}.':'.$self->{cpqFcaPhyDrvIndex}; ####vorerst + $self->{controllerindex} = $self->{cpqScsiPhyDrvCntlrIndex}; + bless $self, $class; + return $self; +} + +sub check { + my $self = shift; + $self->blacklist('fcapd', $self->{name}); + my $info = sprintf "physical drive %s is %s", + $self->{name}, $self->{cpqFcaPhyDrvStatus}; + if ($self->{cpqFcaPhyDrvStatus} eq 'unconfigured') { + # not part of a logical drive + # condition will surely be other + } elsif ($self->{cpqFcaPhyDrvCondition} ne 'ok') { + $self->add_message(CRITICAL, $info); + } + $self->add_info($info); +} + +sub dump { + my $self = shift; + printf "[PHYSICAL_DRIVE_%s]\n", $self->{name}; + foreach (qw(cpqFcaPhyDrvBoxIndex cpqFcaPhyDrvIndex cpqFcaPhyDrvModel + cpqFcaPhyDrvBay cpqFcaPhyDrvStatus cpqFcaPhyDrvCondition + cpqFcaPhyDrvSize cpqFcaPhyDrvBusNumber)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "\n"; +} + + +package HP::Proliant::Component::DiskSubsystem::Fca::SpareDrive; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Fca); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub dump { + my $self = shift; + printf "[SPARE_DRIVE]\n"; +} + + +1; diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Fca/CLI.pm b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Fca/CLI.pm new file mode 100755 index 0000000..fd11dbc --- /dev/null +++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Fca/CLI.pm @@ -0,0 +1,34 @@ +package HP::Proliant::Component::DiskSubsystem::Fca::CLI; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Fca); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + controllers => [], + accelerators => [], + enclosures => [], + physical_drives => [], + logical_drives => [], + spare_drives => [], + blacklisted => 0, + }; + bless $self, $class; + return $self; +} + +sub init { + my $self = shift; + # ..... + $self->{global_status} = + HP::Proliant::Component::DiskSubsystem::Fca::GlobalStatus->new( + runtime => $self->{runtime}, + cpqFcaMibCondition => 'n/a', + ); + +} + +1; diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Fca/SNMP.pm b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Fca/SNMP.pm new file mode 100755 index 0000000..fc603e5 --- /dev/null +++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Fca/SNMP.pm @@ -0,0 +1,303 @@ +package HP::Proliant::Component::DiskSubsystem::Fca::SNMP; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Fca + HP::Proliant::Component::SNMP); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + controllers => [], + accelerators => [], + enclosures => [], + physical_drives => [], + logical_drives => [], + spare_drives => [], + blacklisted => 0, + }; + bless $self, $class; + return $self; +} + +sub init { + my $self = shift; + my $snmpwalk = $self->{rawdata}; + + # CPQFCA-MIB + my $oids = { + cpqFcaHostCntlrEntry => '1.3.6.1.4.1.232.16.2.7.1.1', + cpqFcaHostCntlrIndex => '1.3.6.1.4.1.232.16.2.7.1.1.1', + cpqFcaHostCntlrSlot => '1.3.6.1.4.1.232.16.2.7.1.1.2', + cpqFcaHostCntlrModel => '1.3.6.1.4.1.232.16.2.7.1.1.3', + cpqFcaHostCntlrStatus => '1.3.6.1.4.1.232.16.2.7.1.1.4', + cpqFcaHostCntlrCondition => '1.3.6.1.4.1.232.16.2.7.1.1.5', + cpqFcaHostCntlrOverallCondition => '1.3.6.1.4.1.232.16.2.7.1.1.8', + cpqFcaHostCntlrModelValue => { + 1 => "other", + # You may need to upgrade your driver software and\or instrument + # agent(s). You have a drive array controller in the system + # that the instrument agent does not recognize. (other according to CPQFCAL-MIB) + 2 => "fchc-p", + 3 => "fchc-e", + 4 => "fchc64", + 5 => "sa-sam", + 6 => "fca-2101", + 7 => "sw64-33", + 8 => "fca-221x", + 9 => "dpfcmc", + 10 => 'fca-2404', + 11 => 'fca-2214', + 12 => 'a7298a', + 13 => 'fca-2214dc', + 14 => 'a6826a', + 15 => 'fcmcG3', + 16 => 'fcmcG4', + 17 => 'ab46xa', + 18 => 'fc-generic', + 19 => 'fca-1143', + 20 => 'fca-1243', + 21 => 'fca-2143', + 22 => 'fca-2243', + 23 => 'fca-1050', + 24 => 'fca-lpe1105', + 25 => 'fca-qmh2462', + 26 => 'fca-1142sr', + 27 => 'fca-1242sr', + 28 => 'fca-2142sr', + 29 => 'fca-2242sr', + 30 => 'fcmc20pe', + 31 => 'fca-81q', + 32 => 'fca-82q', + 33 => 'fca-qmh2562', + 34 => 'fca-81e', + 35 => 'fca-82e', + 36 => 'fca-1205', + }, + cpqFcaHostCntlrStatusValue => { + 1 => "other", + 2 => "ok", + 3 => "failed", + 4 => "shutdown", + 5 => "loopDegraded", + 6 => "loopFailed", + 7 => "notConnected", + }, + cpqFcaHostCntlrConditionValue => { + 1 => "other", + 2 => "ok", + 3 => "degraded", + 4 => "failed", + }, + cpqFcaHostCntlrOverallConditionValue => { + 1 => "other", + 2 => "ok", + 3 => "degraded", + 4 => "failed", + }, # cntrl + alle associated storage boxes + }; + + # INDEX { cpqFcaHostCntlrIndex } + foreach ($self->get_entries($oids, 'cpqFcaHostCntlrEntry')) { + push(@{$self->{host_controllers}}, + HP::Proliant::Component::DiskSubsystem::Fca::HostController->new(%{$_})); + } + + $oids = { + cpqFcaCntlrEntry => '1.3.6.1.4.1.232.16.2.2.1.1', + cpqFcaCntlrBoxIndex => '1.3.6.1.4.1.232.16.2.2.1.1.1', + cpqFcaCntlrBoxIoSlot => '1.3.6.1.4.1.232.16.2.2.1.1.2', + cpqFcaCntlrModel => '1.3.6.1.4.1.232.16.2.2.1.1.3', + cpqFcaCntlrStatus => '1.3.6.1.4.1.232.16.2.2.1.1.5', + cpqFcaCntlrCondition => '1.3.6.1.4.1.232.16.2.2.1.1.6', + cpqFcaCntlrModelValue => { + 1 => "other", + 2 => "fibreArray", + 3 => "msa1000", + 4 => "smartArrayClusterStorage", + 5 => "hsg80", + 6 => "hsv110", + 7 => "msa500g2", + 8 => "msa20", + 8 => "msa1510i", + }, + cpqFcaCntlrStatusValue => { + 1 => "other", + 2 => "ok", + 3 => "failed", + 4 => "offline", + 5 => "redundantPathOffline", + 6 => "notConnected", + }, + cpqFcaCntlrConditionValue => { + 1 => "other", + 2 => "ok", + 3 => "degraded", + 4 => "failed", + }, + }; + + # INDEX { cpqFcaCntlrBoxIndex, cpqFcaCntlrBoxIoSlot } + foreach ($self->get_entries($oids, 'cpqFcaCntlrEntry')) { + push(@{$self->{controllers}}, + HP::Proliant::Component::DiskSubsystem::Fca::Controller->new(%{$_})); + } + + $oids = { + cpqFcaAccelEntry => '1.3.6.1.4.1.232.16.2.2.2.1', + cpqFcaAccelBoxIndex => '1.3.6.1.4.1.232.16.2.2.2.1.1', + cpqFcaAccelBoxIoSlot => '1.3.6.1.4.1.232.16.2.2.2.1.2', + cpqFcaAccelStatus => '1.3.6.1.4.1.232.16.2.2.2.1.3', + cpqFcaAccelErrCode => '1.3.6.1.4.1.232.16.2.2.2.1.5', + cpqFcaAccelBatteryStatus => '1.3.6.1.4.1.232.16.2.2.2.1.6', + cpqFcaAccelCondition => '1.3.6.1.4.1.232.16.2.2.2.1.9', + cpqFcaAccelStatusValue => { + 1 => "other", + 2 => "invalid", + 3 => "enabled", + 4 => "tmpDisabled", + 5 => "permDisabled", + }, + cpqFcaAccelErrCodeValue => { + 1 => 'other', + 2 => 'invalid', + 3 => 'badConfig', + 4 => 'lowBattery', + 5 => 'disableCmd', + 6 => 'noResources', + 7 => 'notConnected', + 8 => 'badMirrorData', + 9 => 'readErr', + 10 => 'writeErr', + 11 => 'configCmd', + 12 => 'expandInProgress', + 13 => 'snapshotInProgress', + 14 => 'redundantLowBattery', + 15 => 'redundantSizeMismatch', + 16 => 'redundantCacheFailure', + 17 => 'excessiveEccErrors', + 19 => 'postEccErrors', + }, + cpqFcaAccelBatteryStatusValue => { + 1 => 'other', + 2 => 'ok', + 3 => 'recharging', + 4 => 'failed', + 5 => 'degraded', + 6 => 'notPresent', + }, + cpqFcaAccelConditionValue => { + 1 => "other", + 2 => "ok", + 3 => "degraded", + 4 => "failed", + }, + }; + + # INDEX { cpqFcaAccelBoxIndex, cpqFcaAccelBoxIoSlot } + foreach ($self->get_entries($oids, 'cpqFcaAccelEntry')) { + push(@{$self->{accelerators}}, + HP::Proliant::Component::DiskSubsystem::Fca::Accelerator->new(%{$_})); + } + + $oids = { + cpqFcaLogDrvEntry => '1.3.6.1.4.1.232.16.2.3.1.1', + cpqFcaLogDrvBoxIndex => '1.3.6.1.4.1.232.16.2.3.1.1.1', + cpqFcaLogDrvIndex => '1.3.6.1.4.1.232.16.2.3.1.1.2', + cpqFcaLogDrvFaultTol => '1.3.6.1.4.1.232.16.2.3.1.1.3', + cpqFcaLogDrvStatus => '1.3.6.1.4.1.232.16.2.3.1.1.4', + cpqFcaLogDrvPercentRebuild => '1.3.6.1.4.1.232.16.2.3.1.1.6', + cpqFcaLogDrvSize => '1.3.6.1.4.1.232.16.2.3.1.1.9', + cpqFcaLogDrvPhyDrvIDs => '1.3.6.1.4.1.232.16.2.3.1.1.10', + cpqFcaLogDrvCondition => '1.3.6.1.4.1.232.16.2.3.1.1.11', + cpqFcaLogDrvFaultTolValue => { + 1 => 'other', + 2 => 'none', + 3 => 'mirroring', + 4 => 'dataGuard', + 5 => 'distribDataGuard', + 7 => 'advancedDataGuard', + }, + cpqFcaLogDrvStatusValue => { + 1 => 'other', + 2 => 'ok', + 3 => 'failed', + 4 => 'unconfigured', + 5 => 'recovering', + 6 => 'readyForRebuild', + 7 => 'rebuilding', + 8 => 'wrongDrive', + 9 => 'badConnect', + 10 => 'overheating', + 11 => 'shutdown', + 12 => 'expanding', + 13 => 'notAvailable', + 14 => 'queuedForExpansion', + 15 => 'hardError', + }, + cpqFcaLogDrvConditionValue => { + 1 => 'other', + 2 => 'ok', + 3 => 'degraded', + 4 => 'failed', + }, + }; + + # INDEX { cpqFcaLogDrvBoxIndex, cpqFcaLogDrvIndex } + foreach ($self->get_entries($oids, 'cpqFcaLogDrvEntry')) { + push(@{$self->{logical_drives}}, + HP::Proliant::Component::DiskSubsystem::Fca::LogicalDrive->new(%{$_})); + } + + $oids = { + cpqFcaPhyDrvEntry => '1.3.6.1.4.1.232.16.2.5.1.1', + cpqFcaPhyDrvBoxIndex => '1.3.6.1.4.1.232.16.2.5.1.1.1', + cpqFcaPhyDrvIndex => '1.3.6.1.4.1.232.16.2.5.1.1.2', + cpqFcaPhyDrvModel => '1.3.6.1.4.1.232.16.2.5.1.1.3', + cpqFcaPhyDrvBay => '1.3.6.1.4.1.232.16.2.5.1.1.5', + cpqFcaPhyDrvStatus => '1.3.6.1.4.1.232.16.2.5.1.1.6', + cpqFcaPhyDrvCondition => '1.3.6.1.4.1.232.16.2.5.1.1.31', + cpqFcaPhyDrvSize => '1.3.6.1.4.1.232.16.2.5.1.1.38', + cpqFcaPhyDrvBusNumber => '1.3.6.1.4.1.232.16.2.5.1.1.42', + cpqFcaPhyDrvStatusValue => { + 1 => 'other', + 2 => 'unconfigured', + 3 => 'ok', + 4 => 'threshExceeded', + 5 => 'predictiveFailure', + 6 => 'failed', + }, + cpqFcaPhyDrvConditionValue => { + 1 => 'other', + 2 => 'ok', + 3 => 'degraded', + 4 => 'failed', + }, + }; + + # INDEX { cpqFcaPhyDrvBoxIndex, cpqFcaPhyDrvIndex } + foreach ($self->get_entries($oids, 'cpqFcaPhyDrvEntry')) { + push(@{$self->{physical_drives}}, + HP::Proliant::Component::DiskSubsystem::Fca::PhysicalDrive->new(%{$_})); + } + + $oids = { + cpqFcaMibRevMajor => '1.3.6.1.4.1.232.16.1.1.0', + cpqFcaMibRevMinor => '1.3.6.1.4.1.232.16.1.2.0', + cpqFcaMibCondition => '1.3.6.1.4.1.232.16.1.3.0', + cpqFcaMibConditionValue => { + 1 => 'other', + 2 => 'ok', + 3 => 'degraded', + 4 => 'failed', + }, + }; + $self->{global_status} = + HP::Proliant::Component::DiskSubsystem::Fca::GlobalStatus->new( + runtime => $self->{runtime}, + cpqFcaMibCondition => + SNMP::Utils::get_object_value($snmpwalk, + $oids->{cpqFcaMibCondition}, $oids->{cpqFcaMibConditionValue}) + ); +} diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Ide.pm b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Ide.pm new file mode 100755 index 0000000..fdd3230 --- /dev/null +++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Ide.pm @@ -0,0 +1,256 @@ +package HP::Proliant::Component::DiskSubsystem::Ide; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + runtime => $params{runtime}, + rawdata => $params{rawdata}, + method => $params{method}, + controllers => [], + enclosures => [], + physical_drives => [], + logical_drives => [], + spare_drives => [], + condition => undef, + blacklisted => 0, + }; + bless $self, $class; + if ($self->{method} eq 'snmp') { + bless $self, 'HP::Proliant::Component::DiskSubsystem::Ide::SNMP'; + } else { + bless $self, 'HP::Proliant::Component::DiskSubsystem::Ide::CLI'; + } + $self->init(); + $self->assemble(); + return $self; +} + +sub check { + my $self = shift; + foreach (@{$self->{controllers}}) { + $_->check(); + } +} + +sub dump { + my $self = shift; + foreach (@{$self->{controllers}}) { + $_->dump(); + } +} + +package HP::Proliant::Component::DiskSubsystem::Ide::Controller; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Ide); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + runtime => $params{runtime}, + cpqIdeControllerIndex => $params{cpqIdeControllerIndex}, + cpqIdeControllerOverallCondition => $params{cpqIdeControllerOverallCondition}, + cpqIdeControllerModel => $params{cpqIdeControllerModel}, + cpqIdeControllerSlot => $params{cpqIdeControllerSlot}, # -1 ist sysboard? + blacklisted => 0, + }; + $self->{name} = $params{name} || $self->{cpqIdeControllerIndex}; + $self->{controllerindex} = $self->{cpqIdeControllerIndex}; + bless $self, $class; + return $self; +} + +sub check { + my $self = shift; + $self->blacklist('ideco', $self->{name}); + if ($self->{cpqIdeControllerOverallCondition} eq 'other') { + if (scalar(@{$self->{physical_drives}})) { + $self->add_message(CRITICAL, + sprintf 'ide controller %s in slot %s needs attention', + $self->{cpqIdeControllerIndex}, $self->{cpqIdeControllerSlot}); + $self->add_info(sprintf 'ide controller %s in slot %s needs attention', + $self->{cpqIdeControllerIndex}, $self->{cpqIdeControllerSlot}); + } else { + $self->add_info(sprintf 'ide controller %s in slot %s is ok and unused', + $self->{cpqIdeControllerIndex}, $self->{cpqIdeControllerSlot}); + $self->{blacklisted} = 1; + } + } elsif ($self->{cpqIdeControllerOverallCondition} ne 'ok') { + $self->add_message(CRITICAL, + sprintf 'ide controller %s in slot %s needs attention', + $self->{cpqIdeControllerIndex}, $self->{cpqIdeControllerSlot}); + $self->add_info(sprintf 'ide controller %s in slot %s needs attention', + $self->{cpqIdeControllerIndex}, $self->{cpqIdeControllerSlot}); + } else { + $self->add_info(sprintf 'ide controller %s in slot %s is ok', + $self->{cpqIdeControllerIndex}, $self->{cpqIdeControllerSlot}); + } + foreach (@{$self->{logical_drives}}) { + $_->check(); + } + foreach (@{$self->{physical_drives}}) { + $_->check(); + } + foreach (@{$self->{spare_drives}}) { + $_->check(); + } +} + +sub dump { + my $self = shift; + printf "[IDE_CONTROLLER_%s]\n", $self->{name}; + foreach (qw(cpqIdeControllerIndex cpqIdeControllerSlot + cpqIdeControllerModel cpqIdeControllerOverallCondition)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "\n"; + foreach (@{$self->{logical_drives}}) { + $_->dump(); + } + foreach (@{$self->{physical_drives}}) { + $_->dump(); + } + foreach (@{$self->{spare_drives}}) { + $_->dump(); + } +} + + +package HP::Proliant::Component::DiskSubsystem::Ide::LogicalDrive; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Ide); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + runtime => $params{runtime}, + cpqIdeLogicalDriveControllerIndex => $params{cpqIdeLogicalDriveControllerIndex}, + cpqIdeLogicalDriveIndex => $params{cpqIdeLogicalDriveIndex}, + cpqIdeLogicalDriveRaidLevel => $params{cpqIdeLogicalDriveRaidLevel}, + cpqIdeLogicalDriveCapacity => $params{cpqIdeLogicalDriveCapacity}, + cpqIdeLogicalDriveStatus => $params{cpqIdeLogicalDriveStatus}, + cpqIdeLogicalDriveCondition => $params{cpqIdeLogicalDriveCondition}, + cpqIdeLogicalDriveDiskIds => $params{cpqIdeLogicalDriveDiskIds}, + cpqIdeLogicalDriveSpareIds => $params{cpqIdeLogicalDriveSpareIds}, + cpqIdeLogicalDriveRebuildingDisk => $params{cpqIdeLogicalDriveRebuildingDisk}, + blacklisted => 0, + }; + bless $self, $class; + $self->{name} = $params{name} || + $self->{cpqIdeLogicalDriveControllerIndex}.':'. + $self->{cpqIdeLogicalDriveIndex}; + $self->{controllerindex} = $self->{cpqIdeLogicalDriveControllerIndex}; + return $self; +} + +sub check { + my $self = shift; + $self->blacklist('ideld', $self->{name}); + if ($self->{cpqIdeLogicalDriveCondition} ne "ok") { + if ($self->{cpqIdeLogicalDriveStatus} =~ + /rebuild/) { + $self->add_message(WARNING, + sprintf "logical drive %s is %s", + $self->{name}, $self->{cpqIdeLogicalDriveStatus}); + } else { + $self->add_message(CRITICAL, + sprintf "logical drive %s is %s", + $self->{name}, $self->{cpqIdeLogicalDriveStatus}); + } + } + $self->add_info( + sprintf "logical drive %s is %s", $self->{name}, + $self->{cpqIdeLogicalDriveStatus}); +} + +sub dump { + my $self = shift; + printf "[LOGICAL_DRIVE]\n"; + foreach (qw(cpqIdeLogicalDriveControllerIndex cpqIdeLogicalDriveIndex + cpqIdeLogicalDriveRaidLevel cpqIdeLogicalDriveCapacity + cpqIdeLogicalDriveDiskIds cpqIdeLogicalDriveSpareIds + cpqIdeLogicalDriveRebuildingDisk cpqIdeLogicalDriveStatus + cpqIdeLogicalDriveCondition)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "\n"; +} + + +package HP::Proliant::Component::DiskSubsystem::Ide::PhysicalDrive; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Ide); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + runtime => $params{runtime}, + cpqIdeAtaDiskControllerIndex => $params{cpqIdeAtaDiskControllerIndex}, + cpqIdeAtaDiskIndex => $params{cpqIdeAtaDiskIndex}, + cpqIdeAtaDiskModel => $params{cpqIdeAtaDiskModel}, + cpqIdeAtaDiskStatus => $params{cpqIdeAtaDiskStatus}, + cpqIdeAtaDiskCondition => $params{cpqIdeAtaDiskCondition}, + cpqIdeAtaDiskCapacity => $params{cpqIdeAtaDiskCapacity}, + cpqIdeAtaDiskLogicalDriveMember => $params{cpqIdeAtaDiskLogicalDriveMember}, + cpqIdeAtaDiskIsSpare => $params{cpqIdeAtaDiskIsSpare}, + blacklisted => 0, + }; + $self->{name} = $params{name} || + $self->{cpqIdeAtaDiskControllerIndex}.':'. + $self->{cpqIdeAtaDiskIndex}; ####vorerst + $self->{controllerindex} = $self->{cpqIdeAtaDiskControllerIndex}; + bless $self, $class; + return $self; +} + +sub check { + my $self = shift; + $self->blacklist('idepd', $self->{name}); + if ($self->{cpqIdeAtaDiskCondition} ne 'ok') { + $self->add_message(CRITICAL, + sprintf "physical drive %s is %s", + $self->{name}, $self->{cpqIdeAtaDiskCondition}); + } + $self->add_info( + sprintf "physical drive %s is %s", + $self->{name}, $self->{cpqIdeAtaDiskCondition}); +} + +sub dump { + my $self = shift; + printf "[PHYSICAL_DRIVE]\n"; + foreach (qw(cpqIdeAtaDiskControllerIndex cpqIdeAtaDiskIndex + cpqIdeAtaDiskModel cpqIdeAtaDiskCapacity cpqIdeAtaDiskLogicalDriveMember + cpqIdeAtaDiskStatus cpqIdeAtaDiskCondition)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "\n"; +} + + +package HP::Proliant::Component::DiskSubsystem::Ide::SpareDrive; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Ide); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub dump { + my $self = shift; + printf "[SPARE_DRIVE]\n"; +} + + +1; diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Ide/CLI.pm b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Ide/CLI.pm new file mode 100755 index 0000000..babc616 --- /dev/null +++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Ide/CLI.pm @@ -0,0 +1,27 @@ +package HP::Proliant::Component::DiskSubsystem::Ide::CLI; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Ide); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + controllers => [], + accelerators => [], + enclosures => [], + physical_drives => [], + logical_drives => [], + spare_drives => [], + blacklisted => 0, + }; + bless $self, $class; + return $self; +} + +sub init { + my $self = shift; +} + +1; diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Ide/SNMP.pm b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Ide/SNMP.pm new file mode 100755 index 0000000..86f9543 --- /dev/null +++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Ide/SNMP.pm @@ -0,0 +1,115 @@ +package HP::Proliant::Component::DiskSubsystem::Ide::SNMP; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Ide + HP::Proliant::Component::SNMP); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + controllers => [], + accelerators => [], + enclosures => [], + physical_drives => [], + logical_drives => [], + spare_drives => [], + blacklisted => 0, + }; + bless $self, $class; + return $self; +} + +sub init { + my $self = shift; + my $snmpwalk = $self->{rawdata}; + + # CPQIDE-MIB + my $oids = { + cpqIdeControllerEntry => '1.3.6.1.4.1.232.14.2.3.1.1', + cpqIdeControllerIndex => '1.3.6.1.4.1.232.14.2.3.1.1.1', + cpqIdeControllerOverallCondition => '1.3.6.1.4.1.232.14.2.3.1.1.2', + cpqIdeControllerModel => '1.3.6.1.4.1.232.14.2.3.1.1.3', + cpqIdeControllerSlot => '1.3.6.1.4.1.232.14.2.3.1.1.5', + cpqIdeControllerOverallConditionValue => { + 1 => "other", + 2 => "ok", + 3 => "degraded", + 4 => "failed", + }, + }; + + # INDEX { cpqIdeControllerIndex } + foreach ($self->get_entries($oids, 'cpqIdeControllerEntry')) { + push(@{$self->{controllers}}, + HP::Proliant::Component::DiskSubsystem::Ide::Controller->new(%{$_})); + } + + $oids = { + cpqIdeLogicalDriveEntry => '1.3.6.1.4.1.232.14.2.6.1.1', + cpqIdeLogicalDriveControllerIndex => '1.3.6.1.4.1.232.14.2.6.1.1.1', + cpqIdeLogicalDriveIndex => '1.3.6.1.4.1.232.14.2.6.1.1.2', + cpqIdeLogicalDriveRaidLevel => '1.3.6.1.4.1.232.14.2.6.1.1.3', + cpqIdeLogicalDriveCapacity => '1.3.6.1.4.1.232.14.2.6.1.1.4', + cpqIdeLogicalDriveStatus => '1.3.6.1.4.1.232.14.2.6.1.1.5', + cpqIdeLogicalDriveCondition => '1.3.6.1.4.1.232.14.2.6.1.1.6', + cpqIdeLogicalDriveDiskIds => '1.3.6.1.4.1.232.14.2.6.1.1.7', + cpqIdeLogicalDriveSpareIds => '1.3.6.1.4.1.232.14.2.6.1.1.9', + cpqIdeLogicalDriveRebuildingDisk => '1.3.6.1.4.1.232.14.2.6.1.1.10', + cpqIdeLogicalDriveRaidLevelValue => { + 1 => "other", + 2 => "raid0", + 3 => "raid1", + 4 => "raid0plus1", + }, + cpqIdeLogicalDriveStatusValue => { + 1 => "other", + 2 => "ok", + 3 => "degraded", + 4 => "rebuilding", + 5 => "failed", + }, + cpqIdeLogicalDriveConditionValue => { + 1 => "other", + 2 => "ok", + 3 => "degraded", + 4 => "failed", + }, + }; + # INDEX { cpqIdeLogicalDriveControllerIndex, cpqIdeLogicalDriveIndex } + foreach ($self->get_entries($oids, 'cpqIdeLogicalDriveEntry')) { + push(@{$self->{logical_drives}}, + HP::Proliant::Component::DiskSubsystem::Ide::LogicalDrive->new(%{$_})); + } + + $oids = { + cpqIdeAtaDiskEntry => '1.3.6.1.4.1.232.14.2.4.1.1', + cpqIdeAtaDiskControllerIndex => '1.3.6.1.4.1.232.14.2.4.1.1.1', + cpqIdeAtaDiskIndex => '1.3.6.1.4.1.232.14.2.4.1.1.2', + cpqIdeAtaDiskModel => '1.3.6.1.4.1.232.14.2.4.1.1.3', + cpqIdeAtaDiskStatus => '1.3.6.1.4.1.232.14.2.4.1.1.6', + cpqIdeAtaDiskCondition => '1.3.6.1.4.1.232.14.2.4.1.1.7', + cpqIdeAtaDiskCapacity => '1.3.6.1.4.1.232.14.2.4.1.1.8', + cpqIdeAtaDiskLogicalDriveMember => '1.3.6.1.4.1.232.14.2.4.1.1.13', + cpqIdeAtaDiskIsSpare => '1.3.6.1.4.1.232.14.2.4.1.1.14', + cpqIdeAtaDiskStatusValue => { + 1 => "other", + 2 => "ok", + 3 => "smartError", + 4 => "failed", + }, + cpqIdeAtaDiskConditionValue => { + 1 => "other", + 2 => "ok", + 3 => "degraded", + 4 => "failed", + }, + }; + # INDEX { cpqIdeAtaDiskControllerIndex, cpqIdeAtaDiskIndex } + foreach ($self->get_entries($oids, 'cpqIdeAtaDiskEntry')) { + push(@{$self->{physical_drives}}, + HP::Proliant::Component::DiskSubsystem::Ide::PhysicalDrive->new(%{$_})); + } + +} diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Sas.pm b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Sas.pm new file mode 100755 index 0000000..bb417d4 --- /dev/null +++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Sas.pm @@ -0,0 +1,251 @@ +package HP::Proliant::Component::DiskSubsystem::Sas; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + runtime => $params{runtime}, + rawdata => $params{rawdata}, + method => $params{method}, + controllers => [], + enclosures => [], + physical_drives => [], + logical_drives => [], + spare_drives => [], + condition => undef, + blacklisted => 0, + }; + bless $self, $class; + if ($self->{method} eq 'snmp') { + bless $self, 'HP::Proliant::Component::DiskSubsystem::Sas::SNMP'; + } else { + bless $self, 'HP::Proliant::Component::DiskSubsystem::Sas::CLI'; + } + $self->init(); + $self->assemble(); + return $self; +} + +sub check { + my $self = shift; + foreach (@{$self->{controllers}}) { + $_->check(); + } +} + +sub dump { + my $self = shift; + foreach (@{$self->{controllers}}) { + $_->dump(); + } +} + +package HP::Proliant::Component::DiskSubsystem::Sas::Controller; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Sas); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + runtime => $params{runtime}, + cpqSasHbaIndex => $params{cpqSasHbaIndex}, + cpqSasHbaLocation => $params{cpqSasHbaLocation}, + cpqSasHbaSlot => $params{cpqSasHbaSlot}, + cpqSasHbaStatus => $params{cpqSasHbaStatus}, + cpqSasHbaCondition => $params{cpqSasHbaCondition}, + blacklisted => 0, + }; + $self->{name} = $params{name} || $self->{cpqSasHbaSlot}; + $self->{controllerindex} = $self->{cpqSasHbaIndex}; + bless $self, $class; + return $self; +} + +sub check { + my $self = shift; + $self->blacklist('saco', $self->{cpqSasHbaSlot}); + if ($self->{cpqSasHbaCondition} eq 'other') { + if (scalar(@{$self->{physical_drives}})) { + $self->add_message(CRITICAL, + sprintf 'sas controller in slot %s needs attention', + $self->{cpqSasHbaSlot}); + $self->add_info(sprintf 'sas controller in slot %s needs attention', + $self->{cpqSasHbaSlot}); + } else { + $self->add_info(sprintf 'sas controller in slot %s is ok and unused', + $self->{cpqSasHbaSlot}); + $self->{blacklisted} = 1; + } + } elsif ($self->{cpqSasHbaCondition} ne 'ok') { + $self->add_message(CRITICAL, + sprintf 'sas controller in slot %s needs attention', + $self->{cpqSasHbaSlot}); + $self->add_info(sprintf 'sas controller in slot %s needs attention', + $self->{cpqSasHbaSlot}); + } else { + $self->add_info(sprintf 'sas controller in slot %s is ok', + $self->{cpqSasHbaSlot}); + } + foreach (@{$self->{logical_drives}}) { + $_->check(); + } + foreach (@{$self->{physical_drives}}) { + $_->check(); + } + foreach (@{$self->{spare_drives}}) { + $_->check(); + } +} + +sub dump { + my $self = shift; + printf "[SAS_HBA%s]\n", $self->{name}; + foreach (qw(cpqSasHbaSlot cpqSasHbaIndex cpqSasHbaCondition + cpqSasHbaStatus cpqSasHbaLocation)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "\n"; + foreach (@{$self->{logical_drives}}) { + $_->dump(); + } + foreach (@{$self->{physical_drives}}) { + $_->dump(); + } + foreach (@{$self->{spare_drives}}) { + $_->dump(); + } +} + + +package HP::Proliant::Component::DiskSubsystem::Sas::LogicalDrive; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Sas); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + runtime => $params{runtime}, + cpqSasLogDrvHbaIndex => $params{cpqSasLogDrvHbaIndex}, + cpqSasLogDrvIndex => $params{cpqSasLogDrvIndex}, + cpqSasLogDrvStatus => $params{cpqSasLogDrvStatus}, + cpqSasLogDrvCondition => $params{cpqSasLogDrvCondition}, + cpqSasLogDrvRebuildingPercent => $params{cpqSasLogDrvRebuildingPercent}, + cpqSasLogDrvRaidLevel => $params{cpqSasLogDrvRaidLevel}, + blacklisted => 0, + }; + bless $self, $class; + $self->{name} = $params{name} || + $self->{cpqSasLogDrvHbaIndex}.':'.$self->{cpqSasLogDrvIndex}; ####vorerst + $self->{controllerindex} = $self->{cpqSasLogDrvHbaIndex}; + if (! $self->{cpqSasLogDrvRebuildingPercent} || + $self->{cpqSasLogDrvRebuildingPercent} == 4294967295) { + $self->{cpqSasLogDrvRebuildingPercent} = 100; + } + return $self; +} + +sub check { + my $self = shift; + $self->blacklist('sald', $self->{name}); + if ($self->{cpqSasLogDrvCondition} ne "ok") { + if ($self->{cpqSasLogDrvStatus} =~ + /rebuild|recovering|expanding|queued/) { + $self->add_message(WARNING, + sprintf "logical drive %s is %s", + $self->{name}, $self->{cpqSasLogDrvStatus}); + } else { + $self->add_message(CRITICAL, + sprintf "logical drive %s is %s", + $self->{name}, $self->{cpqSasLogDrvStatus}); + } + } + $self->add_info( + sprintf "logical drive %s is %s (%s)", $self->{name}, + $self->{cpqSasLogDrvStatus}, $self->{cpqSasLogDrvRaidLevel}); +} + +sub dump { + my $self = shift; + printf "[LOGICAL_DRIVE]\n"; + foreach (qw(cpqSasLogDrvHbaIndex cpqSasLogDrvIndex cpqSasLogDrvRaidLevel + cpqSasLogDrvStatus cpqSasLogDrvCondition + cpqSasLogDrvRebuildingPercent)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "\n"; +} + + +package HP::Proliant::Component::DiskSubsystem::Sas::PhysicalDrive; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Sas); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + runtime => $params{runtime}, + cpqSasPhyDrvHbaIndex => $params{cpqSasPhyDrvHbaIndex}, + cpqSasPhyDrvIndex => $params{cpqSasPhyDrvIndex}, + cpqSasPhyDrvLocationString => $params{cpqSasPhyDrvLocationString}, + cpqSasPhyDrvStatus => $params{cpqSasPhyDrvStatus}, + cpqSasPhyDrvSize => $params{cpqSasPhyDrvSize}, + cpqSasPhyDrvCondition => $params{cpqSasPhyDrvCondition}, + blacklisted => 0, + }; + $self->{name} = $params{name} || + $self->{cpqSasPhyDrvHbaIndex}.':'.$self->{cpqSasPhyDrvIndex}; ####vorerst + $self->{controllerindex} = $self->{cpqSasPhyDrvHbaIndex}; + bless $self, $class; + return $self; +} + +sub check { + my $self = shift; + $self->blacklist('sapd', $self->{name}); + if ($self->{cpqSasPhyDrvCondition} ne 'ok') { + $self->add_message(CRITICAL, + sprintf "physical drive %s is %s", + $self->{name}, $self->{cpqSasPhyDrvCondition}); + } + $self->add_info( + sprintf "physical drive %s is %s", + $self->{name}, $self->{cpqSasPhyDrvCondition}); +} + +sub dump { + my $self = shift; + printf "[PHYSICAL_DRIVE]\n"; + foreach (qw(cpqSasPhyDrvHbaIndex cpqSasPhyDrvIndex cpqSasPhyDrvLocationString + cpqSasPhyDrvSize cpqSasPhyDrvStatus cpqSasPhyDrvCondition)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "\n"; +} + + +package HP::Proliant::Component::DiskSubsystem::Sas::SpareDrive; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Sas); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub dump { + my $self = shift; + printf "[SPARE_DRIVE]\n"; +} + + +1; diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Sas/CLI.pm b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Sas/CLI.pm new file mode 100755 index 0000000..1a250d3 --- /dev/null +++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Sas/CLI.pm @@ -0,0 +1,27 @@ +package HP::Proliant::Component::DiskSubsystem::Sas::CLI; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Sas); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + controllers => [], + accelerators => [], + enclosures => [], + physical_drives => [], + logical_drives => [], + spare_drives => [], + blacklisted => 0, + }; + bless $self, $class; + return $self; +} + +sub init { + my $self = shift; +} + +1; diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Sas/SNMP.pm b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Sas/SNMP.pm new file mode 100755 index 0000000..cb493fd --- /dev/null +++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Sas/SNMP.pm @@ -0,0 +1,126 @@ +package HP::Proliant::Component::DiskSubsystem::Sas::SNMP; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Sas + HP::Proliant::Component::SNMP); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + controllers => [], + accelerators => [], + enclosures => [], + physical_drives => [], + logical_drives => [], + spare_drives => [], + blacklisted => 0, + }; + bless $self, $class; + return $self; +} + +sub init { + my $self = shift; + my $snmpwalk = $self->{rawdata}; + + # CPQSCSI-MIB + my $oids = { + cpqSasHbaEntry => "1.3.6.1.4.1.232.5.5.1.1.1", + cpqSasHbaIndex => "1.3.6.1.4.1.232.5.5.1.1.1.1", + cpqSasHbaLocation => "1.3.6.1.4.1.232.5.5.1.1.1.2", + cpqSasHbaSlot => "1.3.6.1.4.1.232.5.5.1.1.1.6", + cpqSasHbaStatus => "1.3.6.1.4.1.232.5.5.1.1.1.4", + cpqSasHbaStatusValue => { + 1 => "other", + 2 => "ok", + 3 => "failed", + }, + cpqSasHbaCondition => "1.3.6.1.4.1.232.5.5.1.1.1.5", + cpqSasHbaConditionValue => { + 1 => "other", + 2 => "ok", + 3 => "degraded", + 4 => "failed", + }, + }; + + # INDEX { cpqSasHbaIndex } + foreach ($self->get_entries($oids, 'cpqSasHbaEntry')) { + push(@{$self->{controllers}}, + HP::Proliant::Component::DiskSubsystem::Sas::Controller->new(%{$_})); + } + + $oids = { + cpqSasLogDrvEntry => "1.3.6.1.4.1.232.5.5.3.1.1", + cpqSasLogDrvHbaIndex => "1.3.6.1.4.1.232.5.5.3.1.1.1", + cpqSasLogDrvIndex => "1.3.6.1.4.1.232.5.5.3.1.1.2", + cpqSasLogDrvStatus => "1.3.6.1.4.1.232.5.5.3.1.1.4", + cpqSasLogDrvCondition => "1.3.6.1.4.1.232.5.5.3.1.1.5", + cpqSasLogDrvRebuildingPercent => "1.3.6.1.4.1.232.5.5.3.1.1.12", + cpqSasLogDrvRaidLevel => "1.3.6.1.4.1.232.5.5.3.1.1.3", + cpqSasLogDrvRaidLevelValue => { + 1 => "other", + 2 => "raid0", + 3 => "raid1", + 4 => "raid0plus1", + 5 => "raid5", + 6 => "raid15", + 7 => "volume", + }, + cpqSasLogDrvConditionValue => { + 1 => "other", + 2 => "ok", + 3 => "degraded", + 4 => "failed", + }, + cpqSasLogDrvStatusValue => { + 1 => "other", + 2 => "ok", + 3 => "degraded", + 4 => "rebuilding", + 5 => "failed", + 6 => "offline", + } + }; + # INDEX { cpqSasLogDrvCntlrIndex, cpqSasLogDrvIndex } + foreach ($self->get_entries($oids, 'cpqSasLogDrvEntry')) { + push(@{$self->{logical_drives}}, + HP::Proliant::Component::DiskSubsystem::Sas::LogicalDrive->new(%{$_})); + } + + $oids = { + cpqSasPhyDrvEntry => "1.3.6.1.4.1.232.5.5.2.1.1", + cpqSasPhyDrvHbaIndex => "1.3.6.1.4.1.232.5.5.2.1.1.1", + cpqSasPhyDrvIndex => "1.3.6.1.4.1.232.5.5.2.1.1.2", + cpqSasPhyDrvLocationString => "1.3.6.1.4.1.232.5.5.2.1.1.3", + cpqSasPhyDrvStatus => "1.3.6.1.4.1.232.5.5.2.1.1.5", + cpqSasPhyDrvSize => "1.3.6.1.4.1.232.5.5.2.1.1.8", + cpqSasPhyDrvCondition => "1.3.6.1.4.1.232.5.5.2.1.1.6", + cpqSasPhyDrvConditionValue => { + 1 => "other", + 2 => "ok", + 3 => "degraded", + 4 => "failed", + }, + cpqSasPhyDrvStatusValue => { + 1 => "other", + 2 => "ok", + 3 => "predictiveFailure", + 4 => "offline", + 5 => "failed", + 6 => "missingWasOk", + 7 => "missingWasPredictiveFailure", + 8 => "missingWasOffline", + 9 => "missingWasFailed", + }, + }; + + # INDEX { cpqPhyLogDrvCntlrIndex, cpqSasPhyDrvIndex } + foreach ($self->get_entries($oids, 'cpqSasPhyDrvEntry')) { + push(@{$self->{physical_drives}}, + HP::Proliant::Component::DiskSubsystem::Sas::PhysicalDrive->new(%{$_})); + } + +} diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Scsi.pm b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Scsi.pm new file mode 100755 index 0000000..cf38238 --- /dev/null +++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Scsi.pm @@ -0,0 +1,227 @@ +package HP::Proliant::Component::DiskSubsystem::Scsi; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + runtime => $params{runtime}, + rawdata => $params{rawdata}, + method => $params{method}, + controllers => [], + enclosures => [], + physical_drives => [], + logical_drives => [], + spare_drives => [], + condition => undef, + blacklisted => 0, + }; + bless $self, $class; + if ($self->{method} eq 'snmp') { + bless $self, 'HP::Proliant::Component::DiskSubsystem::Scsi::SNMP'; + } else { + bless $self, 'HP::Proliant::Component::DiskSubsystem::Scsi::CLI'; + } + $self->init(); + $self->assemble(); + return $self; +} + +sub check { + my $self = shift; + foreach (@{$self->{controllers}}) { + $_->check(); + } +} + +sub dump { + my $self = shift; + foreach (@{$self->{controllers}}) { + $_->dump(); + } +} + +package HP::Proliant::Component::DiskSubsystem::Scsi::Controller; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Scsi); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + runtime => $params{runtime}, + blacklisted => 0, + info => undef, + extendedinfo => undef, + }; + map { $self->{$_} = $params{$_} } grep /cpqScsiCntlr/, keys %params; + $self->{name} = $params{name} || $params{cpqScsiCntlrIndex}.':'.$params{cpqScsiCntlrBusIndex}; + $self->{controllerindex} = $self->{cpqScsiCntlrIndex}; + bless $self, $class; + return $self; +} + +sub check { + my $self = shift; + $self->blacklist('scco', $self->{name}); + my $info = sprintf 'scsi controller %s in slot %s is %s', + $self->{name}, $self->{cpqScsiCntlrSlot}, $self->{cpqScsiCntlrCondition}; + if ($self->{cpqScsiCntlrCondition} eq 'other') { + if (scalar(@{$self->{physical_drives}})) { + $info .= ' and needs attention'; + $self->add_message(CRITICAL, $info); + $self->add_info($info); + } else { + $info .= ' and unused'; + $self->add_info($info); + $self->{blacklisted} = 1; + } + } elsif ($self->{cpqScsiCntlrCondition} ne 'ok') { + $info .= ' and needs attention'; + $self->add_message(CRITICAL, $info); + $self->add_info($info); + } else { + $self->add_info($info); + } + foreach (@{$self->{logical_drives}}) { + $_->check(); + } + foreach (@{$self->{physical_drives}}) { + $_->check(); + } + foreach (@{$self->{spare_drives}}) { + $_->check(); + } +} + +sub dump { + my $self = shift; + printf "[SCSI_CONTROLLER_%s]\n", $self->{name}; + foreach (qw(cpqScsiCntlrIndex cpqScsiCntlrBusIndex cpqScsiCntlrSlot + cpqScsiCntlrStatus cpqScsiCntlrCondition cpqScsiCntlrHwLocation)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "\n"; + foreach (@{$self->{logical_drives}}) { + $_->dump(); + } + foreach (@{$self->{physical_drives}}) { + $_->dump(); + } + foreach (@{$self->{spare_drives}}) { + $_->dump(); + } +} + + +package HP::Proliant::Component::DiskSubsystem::Scsi::LogicalDrive; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Scsi); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + runtime => $params{runtime}, + blacklisted => 0, + info => undef, + extendedinfo => undef, + }; + map { $self->{$_} = $params{$_} } grep /cpqScsiLogDrv/, keys %params; + $self->{name} = $params{name} || $params{cpqScsiLogDrvCntlrIndex}.':'.$params{cpqScsiLogDrvBusIndex}.':'.$params{cpqScsiLogDrvIndex}; + bless $self, $class; + $self->{controllerindex} = $self->{cpqScsiLogDrvCntlrIndex}; + return $self; +} + +sub check { + my $self = shift; + $self->blacklist('scld', $self->{name}); + my $info = sprintf 'logical drive %s is %s', $self->{name}, $self->{cpqScsiLogDrvStatus}; + if ($self->{cpqScsiLogDrvCondition} ne "ok") { + if ($self->{cpqScsiLogDrvStatus} =~ + /rebuild|recovering/) { + $self->add_message(WARNING, $info); + } else { + $self->add_message(CRITICAL, $info); + } + } + $self->add_info($info); +} + +sub dump { + my $self = shift; + printf "[LOGICAL_DRIVE_%s]\n", $self->{name}; + foreach (qw(cpqScsiLogDrvCntlrIndex cpqScsiLogDrvBusIndex cpqScsiLogDrvIndex + cpqScsiLogDrvFaultTol cpqScsiLogDrvStatus cpqScsiLogDrvSize + cpqScsiLogDrvPhyDrvIDs cpqScsiLogDrvCondition)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "\n"; +} + + +package HP::Proliant::Component::DiskSubsystem::Scsi::PhysicalDrive; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Scsi); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + runtime => $params{runtime}, + blacklisted => 0, + info => undef, + extendedinfo => undef, + }; + map { $self->{$_} = $params{$_} } grep /cpqScsiPhyDrv/, keys %params; + $self->{name} = $params{name} || + $self->{cpqScsiPhyDrvCntlrIndex}.':'.$self->{cpqScsiPhyDrvBusIndex}.':'.$self->{cpqScsiPhyDrvIndex}; + $self->{controllerindex} = $self->{cpqScsiPhyDrvCntlrIndex}; + bless $self, $class; + return $self; +} + +sub check { + my $self = shift; + $self->blacklist('scpd', $self->{name}); + my $info = sprintf 'physical drive %s is %s', $self->{name}, $self->{cpqScsiPhyDrvCondition}; + if ($self->{cpqScsiPhyDrvCondition} ne 'ok') { + $self->add_message(CRITICAL, $info); + } + $self->add_info($info); +} + +sub dump { + my $self = shift; + printf "[PHYSICAL_DRIVE_%s]\n", $self->{name}; + foreach (qw(cpqScsiPhyDrvCntlrIndex cpqScsiPhyDrvBusIndex cpqScsiPhyDrvIndex + cpqScsiPhyDrvStatus cpqScsiPhyDrvSize cpqScsiPhyDrvCondition)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "\n"; +} + + +package HP::Proliant::Component::DiskSubsystem::Scsi::SpareDrive; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Scsi); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub dump { + my $self = shift; + printf "[SPARE_DRIVE]\n"; +} + + +1; diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Scsi/CLI.pm b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Scsi/CLI.pm new file mode 100755 index 0000000..69b3926 --- /dev/null +++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Scsi/CLI.pm @@ -0,0 +1,27 @@ +package HP::Proliant::Component::DiskSubsystem::Scsi::CLI; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Scsi); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + controllers => [], + accelerators => [], + enclosures => [], + physical_drives => [], + logical_drives => [], + spare_drives => [], + blacklisted => 0, + }; + bless $self, $class; + return $self; +} + +sub init { + my $self = shift; +} + +1; diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Scsi/SNMP.pm b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Scsi/SNMP.pm new file mode 100755 index 0000000..71a0f66 --- /dev/null +++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Scsi/SNMP.pm @@ -0,0 +1,134 @@ +package HP::Proliant::Component::DiskSubsystem::Scsi::SNMP; +our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Scsi + HP::Proliant::Component::SNMP); + +use strict; +use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; + +sub new { + my $class = shift; + my %params = @_; + my $self = { + controllers => [], + accelerators => [], + enclosures => [], + physical_drives => [], + logical_drives => [], + spare_drives => [], + blacklisted => 0, + }; + bless $self, $class; + return $self; +} + +sub init { + my $self = shift; + my $snmpwalk = $self->{rawdata}; + + # CPQSCSI-MIB + my $oids = { + cpqScsiCntlrEntry => '1.3.6.1.4.1.232.5.2.2.1.1', + cpqScsiCntlrIndex => '1.3.6.1.4.1.232.5.2.2.1.1.1', + cpqScsiCntlrBusIndex => '1.3.6.1.4.1.232.5.2.2.1.1.2', + cpqScsiCntlrSlot => '1.3.6.1.4.1.232.5.2.2.1.1.6', + cpqScsiCntlrStatus => '1.3.6.1.4.1.232.5.2.2.1.1.7', + cpqScsiCntlrCondition => '1.3.6.1.4.1.232.5.2.2.1.1.12', + cpqScsiCntlrHwLocation => '1.3.6.1.4.1.232.5.2.2.1.1.16', + cpqScsiCntlrStatusValue => { + 1 => "other", + 2 => "ok", + 3 => "failed", + }, + cpqScsiCntlrConditionValue => { + 1 => "other", + 2 => "ok", + 3 => "degraded", + 4 => "failed", + } + }; + + # INDEX { cpqScsiCntlrIndex, cpqScsiCntlrBusIndex } + foreach ($self->get_entries($oids, 'cpqScsiCntlrEntry')) { + push(@{$self->{controllers}}, + HP::Proliant::Component::DiskSubsystem::Scsi::Controller->new(%{$_})); + } + + $oids = { + cpqScsiLogDrvEntry => '1.3.6.1.4.1.232.5.2.3.1.1', + cpqScsiLogDrvCntlrIndex => '1.3.6.1.4.1.232.5.2.3.1.1.1', + cpqScsiLogDrvBusIndex => '1.3.6.1.4.1.232.5.2.3.1.1.2', + cpqScsiLogDrvIndex => '1.3.6.1.4.1.232.5.2.3.1.1.3', + cpqScsiLogDrvFaultTol => '1.3.6.1.4.1.232.5.2.3.1.1.4', + cpqScsiLogDrvStatus => '1.3.6.1.4.1.232.5.2.3.1.1.5', + cpqScsiLogDrvSize => '1.3.6.1.4.1.232.5.2.3.1.1.6', + cpqScsiLogDrvPhyDrvIDs => '1.3.6.1.4.1.232.5.2.3.1.1.7', + cpqScsiLogDrvCondition => '1.3.6.1.4.1.232.5.2.3.1.1.8', + cpqScsiLogDrvStatusValue => { + 1 => "other", + 2 => "ok", + 3 => "failed", + 4 => "unconfigured", + 5 => "recovering", + 6 => "readyForRebuild", + 7 => "rebuilding", + 8 => "wrongDrive", + 9 => "badConnect", + }, + cpqScsiLogDrvConditionValue => { + 1 => "other", + 2 => "ok", + 3 => "degraded", + 4 => "failed", + }, + cpqScsiLogDrvFaultTolValue => { + 1 => "other", + 2 => "none", + 3 => "mirroring", + 4 => "dataGuard", + 5 => "distribDataGuard", + }, + + }; + # INDEX { cpqScsiLogDrvCntlrIndex, cpqScsiLogDrvBusIndex, cpqScsiLogDrvIndex } + foreach ($self->get_entries($oids, 'cpqScsiLogDrvEntry')) { + push(@{$self->{logical_drives}}, + HP::Proliant::Component::DiskSubsystem::Scsi::LogicalDrive->new(%{$_})); + } + + $oids = { + cpqScsiPhyDrvEntry => '1.3.6.1.4.1.232.5.2.4.1.1', + cpqScsiPhyDrvCntlrIndex => '1.3.6.1.4.1.232.5.2.4.1.1.1', + cpqScsiPhyDrvBusIndex => '1.3.6.1.4.1.232.5.2.4.1.1.2', + cpqScsiPhyDrvIndex => '1.3.6.1.4.1.232.5.2.4.1.1.3', + cpqScsiPhyDrvStatus => '1.3.6.1.4.1.232.5.2.4.1.1.9', + cpqScsiPhyDrvSize => '1.3.6.1.4.1.232.5.2.4.1.1.7', + cpqScsiPhyDrvCondition => '1.3.6.1.4.1.232.5.2.4.1.1.26', + cpqScsiPhyDrvConditionValue => { + 1 => "other", + 2 => "ok", + 3 => "degraded", + 4 => "failed", + }, + cpqScsiPhyDrvStatusValue => { + 1 => "other", + 2 => "ok", + 3 => "failed", + 4 => "notConfigured", + 5 => "badCable", + 6 => "missingWasOk", + 7 => "missingWasFailed", + 8 => "predictiveFailure", + 9 => "missingWasPredictiveFailure", + 10 => "offline", + 11 => "missingWasOffline", + 12 => "hardError", + }, + }; + + # INDEX { cpqScsiPhyDrvCntlrIndex, cpqScsiPhyDrvBusIndex, cpqScsiPhyDrvIndex } + foreach ($self->get_entries($oids, 'cpqScsiPhyDrvEntry')) { + push(@{$self->{physical_drives}}, + HP::Proliant::Component::DiskSubsystem::Scsi::PhysicalDrive->new(%{$_})); + } + +} |