diff options
Diffstat (limited to 'nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Da')
2 files changed, 471 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/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(%{$_})); + } + +} |