From 1e2387474a449452b78520b9ad96a8b4b5e99722 Mon Sep 17 00:00:00 2001 From: Harald Pfeiffer Date: Wed, 17 Apr 2019 19:07:19 +0200 Subject: initial commit of source fetch --- .../Component/CommonEnclosureSubsystem.pm | 176 +++++++++++++++ .../CommonEnclosureSubsystem/FanSubsystem.pm | 139 ++++++++++++ .../CommonEnclosureSubsystem/FuseSubsystem.pm | 121 +++++++++++ .../CommonEnclosureSubsystem/ManagerSubsystem.pm | 154 +++++++++++++ .../CommonEnclosureSubsystem/TempSubsystem.pm | 177 +++++++++++++++ .../BladeSystem/Component/NetConnectorSubsystem.pm | 134 ++++++++++++ .../Component/PowerEnclosureSubsystem.pm | 136 ++++++++++++ .../BladeSystem/Component/PowerSupplySubsystem.pm | 238 +++++++++++++++++++++ .../BladeSystem/Component/ServerBladeSubsystem.pm | 158 ++++++++++++++ 9 files changed, 1433 insertions(+) create mode 100755 nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/CommonEnclosureSubsystem.pm create mode 100755 nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/CommonEnclosureSubsystem/FanSubsystem.pm create mode 100755 nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/CommonEnclosureSubsystem/FuseSubsystem.pm create mode 100755 nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/CommonEnclosureSubsystem/ManagerSubsystem.pm create mode 100755 nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/CommonEnclosureSubsystem/TempSubsystem.pm create mode 100755 nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/NetConnectorSubsystem.pm create mode 100755 nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/PowerEnclosureSubsystem.pm create mode 100755 nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/PowerSupplySubsystem.pm create mode 100755 nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/ServerBladeSubsystem.pm (limited to 'nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component') diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/CommonEnclosureSubsystem.pm b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/CommonEnclosureSubsystem.pm new file mode 100755 index 0000000..37cec73 --- /dev/null +++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/CommonEnclosureSubsystem.pm @@ -0,0 +1,176 @@ +package HP::BladeSystem::Component::CommonEnclosureSubsystem; +our @ISA = qw(HP::BladeSystem::Component); + +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}, + common_enclosures => [], + common_enclosure_temp_subsys => undef, + common_enclosure_fan_subsys => undef, + common_enclosure_fuse_subsys => undef, + common_enclosure_manager_subsys => undef, + common_enclosure_frus => [], + blacklisted => 0, + info => undef, + extendedinfo => undef, + }; + bless $self, $class; + $self->init(); + return $self; +} + +sub init { + my $self = shift; + # jeweils ein block fuer + # enclosures, temps, fans, fuses + # loop ueber oids und entspr. new + my $oids = { + cpqRackCommonEnclosureEntry => '1.3.6.1.4.1.232.22.2.3.1.1.1', + cpqRackCommonEnclosureRack => '1.3.6.1.4.1.232.22.2.3.1.1.1.1', + cpqRackCommonEnclosureIndex => '1.3.6.1.4.1.232.22.2.3.1.1.1.2', + cpqRackCommonEnclosureModel => '1.3.6.1.4.1.232.22.2.3.1.1.1.3', + cpqRackCommonEnclosureSparePartNumber => '1.3.6.1.4.1.232.22.2.3.1.1.1.6', + cpqRackCommonEnclosureSerialNum => '1.3.6.1.4.1.232.22.2.3.1.1.1.7', + cpqRackCommonEnclosureFWRev => '1.3.6.1.4.1.232.22.2.3.1.1.1.8', + cpqRackCommonEnclosureName => '1.3.6.1.4.1.232.22.2.3.1.1.1.9', + cpqRackCommonEnclosureCondition => '1.3.6.1.4.1.232.22.2.3.1.1.1.16', + cpqRackCommonEnclosureHasServerBlades => '1.3.6.1.4.1.232.22.2.3.1.1.1.17', + cpqRackCommonEnclosureHasPowerBlades => '1.3.6.1.4.1.232.22.2.3.1.1.1.18', + cpqRackCommonEnclosureHasNetConnectors => '1.3.6.1.4.1.232.22.2.3.1.1.1.19', + cpqRackCommonEnclosureHasTempSensors => '1.3.6.1.4.1.232.22.2.3.1.1.1.20', + cpqRackCommonEnclosureHasFans => '1.3.6.1.4.1.232.22.2.3.1.1.1.21', + cpqRackCommonEnclosureHasFuses => '1.3.6.1.4.1.232.22.2.3.1.1.1.22', + cpqRackCommonEnclosureConditionValue => { + 1 => 'other', + 2 => 'ok', + 3 => 'degraded', + 4 => 'failed', + }, + cpqRackCommonEnclosureHasServerBladesValue => { + 1 => 'false', + 2 => 'true', + }, + }; + $oids->{cpqRackCommonEnclosureHasPowerBladesValue} = + $oids->{cpqRackCommonEnclosureHasServerBladesValue}; + $oids->{cpqRackCommonEnclosureHasNetConnectorsValue} = + $oids->{cpqRackCommonEnclosureHasServerBladesValue}; + $oids->{cpqRackCommonEnclosureHasTempSensorsValue} = + $oids->{cpqRackCommonEnclosureHasServerBladesValue}; + $oids->{cpqRackCommonEnclosureHasFansValue} = + $oids->{cpqRackCommonEnclosureHasServerBladesValue}; + $oids->{cpqRackCommonEnclosureHasServerBladesValue} = + $oids->{cpqRackCommonEnclosureHasServerBladesValue}; + # INDEX { cpqRackCommonEnclosureRack cpqRackCommonEnclosureIndex } + foreach ($self->get_entries($oids, 'cpqRackCommonEnclosureEntry')) { + push(@{$self->{common_enclosures}}, + HP::BladeSystem::Component::CommonEnclosureSubsystem::CommonEnclosure->new(%{$_})); + } + + $self->{common_enclosure_fan_subsys} = HP::BladeSystem::Component::CommonEnclosureSubsystem::FanSubsystem->new( + rawdata => $self->{rawdata}, + method => $self->{method}, + runtime => $self->{runtime}, + ); + $self->{common_enclosure_temp_subsys} = HP::BladeSystem::Component::CommonEnclosureSubsystem::TempSubsystem->new( + rawdata => $self->{rawdata}, + method => $self->{method}, + runtime => $self->{runtime}, + ); + $self->{common_enclosure_fuse_subsys} = HP::BladeSystem::Component::CommonEnclosureSubsystem::FuseSubsystem->new( + rawdata => $self->{rawdata}, + method => $self->{method}, + runtime => $self->{runtime}, + ); + $self->{common_enclosure_manager_subsys} = HP::BladeSystem::Component::CommonEnclosureSubsystem::ManagerSubsystem->new( + rawdata => $self->{rawdata}, + method => $self->{method}, + runtime => $self->{runtime}, + ); +} + +sub check { + my $self = shift; + foreach (@{$self->{common_enclosures}}) { + $_->check(); + } + $self->{common_enclosure_fan_subsys}->check(); + $self->{common_enclosure_temp_subsys}->check(); + $self->{common_enclosure_fuse_subsys}->check(); + $self->{common_enclosure_manager_subsys}->check(); +} + +sub dump { + my $self = shift; + foreach (@{$self->{common_enclosures}}) { + $_->dump(); + } + $self->{common_enclosure_fan_subsys}->dump(); + $self->{common_enclosure_temp_subsys}->dump(); + $self->{common_enclosure_fuse_subsys}->dump(); + $self->{common_enclosure_manager_subsys}->dump(); +} + + +package HP::BladeSystem::Component::CommonEnclosureSubsystem::CommonEnclosure; +our @ISA = qw(HP::BladeSystem::Component::CommonEnclosureSubsystem); + +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}, + blacklisted => 0, + info => undef, + extendedinfo => undef, + }; + map { $self->{$_} = $params{$_} } grep /cpqRackCommonEnclosure/, keys %params; + $self->{name} = $self->{cpqRackCommonEnclosureRack}.':'.$self->{cpqRackCommonEnclosureIndex}; + $self->{serfw} = sprintf "Ser: %s, FW: %s", $self->{cpqRackCommonEnclosureSerialNum}, + $self->{cpqRackCommonEnclosureFWRev}; + bless $self, $class; + return $self; +} + + +sub check { + my $self = shift; + $self->blacklist('ce', $self->{cpqRackCommonEnclosureName}); + my $info = sprintf 'common enclosure %s condition is %s (%s)', + $self->{cpqRackCommonEnclosureName}, $self->{cpqRackCommonEnclosureCondition}, $self->{serfw}; + $self->add_info($info); + if ($self->{cpqRackCommonEnclosureCondition} eq 'failed') { + $info .= sprintf " (SparePartNum %s)", $self->{cpqRackCommonEnclosureSparePartNumber}; + $self->add_message(CRITICAL, $info); + } elsif ($self->{cpqRackCommonEnclosureCondition} eq 'degraded') { + $info .= sprintf " (SparePartNum %s)", $self->{cpqRackCommonEnclosureSparePartNumber}; + $self->add_message(WARNING, $info); + } +} + +sub dump { + my $self = shift; + printf "[COMMON_ENCLOSURE_%s]\n", $self->{cpqRackCommonEnclosureName}; + foreach (qw(cpqRackCommonEnclosureRack cpqRackCommonEnclosureIndex cpqRackCommonEnclosureModel + cpqRackCommonEnclosureSerialNum cpqRackCommonEnclosureFWRev cpqRackCommonEnclosureFWRev + cpqRackCommonEnclosureName + cpqRackCommonEnclosureCondition cpqRackCommonEnclosureHasServerBlades + cpqRackCommonEnclosureHasPowerBlades cpqRackCommonEnclosureHasNetConnectors + cpqRackCommonEnclosureHasTempSensors cpqRackCommonEnclosureHasFans cpqRackCommonEnclosureHasFuses)) { + 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/BladeSystem/Component/CommonEnclosureSubsystem/FanSubsystem.pm b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/CommonEnclosureSubsystem/FanSubsystem.pm new file mode 100755 index 0000000..c28b921 --- /dev/null +++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/CommonEnclosureSubsystem/FanSubsystem.pm @@ -0,0 +1,139 @@ +package HP::BladeSystem::Component::CommonEnclosureSubsystem::FanSubsystem; +our @ISA = qw(HP::BladeSystem::Component::CommonEnclosureSubsystem); + +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}, + blacklisted => 0, + fans => [], + info => undef, + extendedinfo => undef, + }; + bless $self, $class; + $self->init(); + return $self; +} + +sub init { + my $self = shift; + my $oids = { + cpqRackCommonEnclosureFanEntry => '1.3.6.1.4.1.232.22.2.3.1.3.1', + cpqRackCommonEnclosureFanRack => '1.3.6.1.4.1.232.22.2.3.1.3.1.1', + cpqRackCommonEnclosureFanChassis => '1.3.6.1.4.1.232.22.2.3.1.3.1.2', + cpqRackCommonEnclosureFanIndex => '1.3.6.1.4.1.232.22.2.3.1.3.1.3', + cpqRackCommonEnclosureFanEnclosureName => '1.3.6.1.4.1.232.22.2.3.1.3.1.4', + cpqRackCommonEnclosureFanLocation => '1.3.6.1.4.1.232.22.2.3.1.3.1.5', + cpqRackCommonEnclosureFanPartNumber => '1.3.6.1.4.1.232.22.2.3.1.3.1.6', + cpqRackCommonEnclosureFanSparePartNumber => '1.3.6.1.4.1.232.22.2.3.1.3.1.7', + cpqRackCommonEnclosureFanPresent => '1.3.6.1.4.1.232.22.2.3.1.3.1.8', + cpqRackCommonEnclosureFanRedundant => '1.3.6.1.4.1.232.22.2.3.1.3.1.9', + cpqRackCommonEnclosureFanRedundantGroupId => '1.3.6.1.4.1.232.22.2.3.1.3.1.10', + cpqRackCommonEnclosureFanCondition => '1.3.6.1.4.1.232.22.2.3.1.3.1.11', + cpqRackCommonEnclosureFanEnclosureSerialNum => '1.3.6.1.4.1.232.22.2.3.1.3.1.12', + cpqRackCommonEnclosureFanPresentValue => { + 1 => 'other', + 2 => 'absent', + 3 => 'present', + }, + cpqRackCommonEnclosureFanRedundantValue => { + 0 => 'other', # meiner phantasie entsprungen, da sich hp nicht aeussert + 1 => 'other', + 2 => 'notRedundant', + 3 => 'redundant', + }, + cpqRackCommonEnclosureFanConditionValue => { + 1 => 'other', + 2 => 'ok', + 3 => 'degraded', + 4 => 'failed', + } + }; + # INDEX { cpqRackCommonEnclosureFanRack, cpqRackCommonEnclosureFanChassis, cpqRackCommonEnclosureFanIndex } + foreach ($self->get_entries($oids, 'cpqRackCommonEnclosureFanEntry')) { + push(@{$self->{fans}}, + HP::BladeSystem::Component::CommonEnclosureSubsystem::FanSubsystem::Fan->new(%{$_})); + } + +} + +sub check { + my $self = shift; + foreach (@{$self->{fans}}) { + $_->check() if $_->{cpqRackCommonEnclosureFanPresent} eq 'present' || + $self->{runtime}->{options}->{verbose} >= 3; # absent nur bei -vvv + } +} + +sub dump { + my $self = shift; + foreach (@{$self->{fans}}) { + $_->dump() if $_->{cpqRackCommonEnclosureFanPresent} eq 'present' || + $self->{runtime}->{options}->{verbose} >= 3; # absent nur bei -vvv + } +} + + +package HP::BladeSystem::Component::CommonEnclosureSubsystem::FanSubsystem::Fan; + +our @ISA = qw(HP::BladeSystem::Component::CommonEnclosureSubsystem::FanSubsystem); + +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}, + blacklisted => 0, + info => undef, + extendedinfo => undef, + }; + map { $self->{$_} = $params{$_} } grep /cpqRackCommonEnclosureFan/, keys %params; + $self->{name} = $self->{cpqRackCommonEnclosureFanRack}.':'.$self->{cpqRackCommonEnclosureFanChassis}.':'.$self->{cpqRackCommonEnclosureFanIndex}; + bless $self, $class; + return $self; +} + +sub check { + my $self = shift; + $self->blacklist('f', $self->{name}); + $self->add_info(sprintf 'fan %s is %s, location is %s, redundance is %s, condition is %s', + $self->{name}, $self->{cpqRackCommonEnclosureFanPresent}, + $self->{cpqRackCommonEnclosureFanLocation}, + $self->{cpqRackCommonEnclosureFanRedundant}, + $self->{cpqRackCommonEnclosureFanCondition}); + if ($self->{cpqRackCommonEnclosureFanCondition} eq 'degraded') { + $self->{info} .= sprintf ", (SparePartNum: %s)", $self->{cpqRackCommonEnclosureFanSparePartNumber}; + $self->add_message(WARNING, $self->{info}); + } elsif ($self->{cpqRackCommonEnclosureFanCondition} eq 'failed') { + $self->{info} .= sprintf ", (SparePartNum: %s)", $self->{cpqRackCommonEnclosureFanSparePartNumber}; + $self->add_message(CRITICAL, $self->{info}); + } +} + +sub dump { + my $self = shift; + printf "[FAN_%s]\n", $self->{name}; + foreach (qw(cpqRackCommonEnclosureFanRack cpqRackCommonEnclosureFanChassis + cpqRackCommonEnclosureFanIndex cpqRackCommonEnclosureFanEnclosureName + cpqRackCommonEnclosureFanLocation cpqRackCommonEnclosureFanPartNumber + cpqRackCommonEnclosureFanSparePartNumber cpqRackCommonEnclosureFanPresent + cpqRackCommonEnclosureFanRedundant cpqRackCommonEnclosureFanRedundantGroupId + cpqRackCommonEnclosureFanCondition cpqRackCommonEnclosureFanEnclosureSerialNum)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "info: %s\n", $self->{info}; + printf "\n"; +} + +1; diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/CommonEnclosureSubsystem/FuseSubsystem.pm b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/CommonEnclosureSubsystem/FuseSubsystem.pm new file mode 100755 index 0000000..bc67e3b --- /dev/null +++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/CommonEnclosureSubsystem/FuseSubsystem.pm @@ -0,0 +1,121 @@ +package HP::BladeSystem::Component::CommonEnclosureSubsystem::FuseSubsystem; +our @ISA = qw(HP::BladeSystem::Component::CommonEnclosureSubsystem); + +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}, + blacklisted => 0, + fuses => [], + info => undef, + extendedinfo => undef, + }; + bless $self, $class; + $self->init(); + return $self; +} + +sub init { + my $self = shift; + my $oids = { + cpqRackCommonEnclosureFuseEntry => '1.3.6.1.4.1.232.22.2.3.1.4.1', + cpqRackCommonEnclosureFuseRack => '1.3.6.1.4.1.232.22.2.3.1.4.1.1', + cpqRackCommonEnclosureFuseChassis => '1.3.6.1.4.1.232.22.2.3.1.4.1.2', + cpqRackCommonEnclosureFuseIndex => '1.3.6.1.4.1.232.22.2.3.1.4.1.3', + cpqRackCommonEnclosureFuseEnclosureName => '1.3.6.1.4.1.232.22.2.3.1.4.1.4', + cpqRackCommonEnclosureFuseLocation => '1.3.6.1.4.1.232.22.2.3.1.4.1.5', + cpqRackCommonEnclosureFusePresent => '1.3.6.1.4.1.232.22.2.3.1.4.1.8', + cpqRackCommonEnclosureFuseCondition => '1.3.6.1.4.1.232.22.2.3.1.4.1.11', + cpqRackCommonEnclosureFusePresentValue => { + 1 => 'other', + 2 => 'absent', + 3 => 'present', + }, + cpqRackCommonEnclosureFuseConditionValue => { + 1 => 'other', + 2 => 'ok', + 4 => 'failed', + } + }; + # INDEX { cpqRackCommonEnclosureFuseRack, cpqRackCommonEnclosureFuseChassis, cpqRackCommonEnclosureFuseIndex } + foreach ($self->get_entries($oids, 'cpqRackCommonEnclosureFuseEntry')) { + push(@{$self->{fuses}}, + HP::BladeSystem::Component::CommonEnclosureSubsystem::FuseSubsystem::Fuse->new(%{$_})); + } + +} + +sub check { + my $self = shift; + foreach (@{$self->{fuses}}) { + $_->check() if $_->{cpqRackCommonEnclosureFusePresent} eq 'present' || + $self->{runtime}->{options}->{verbose} >= 3; # absent nur bei -vvv + } +} + +sub dump { + my $self = shift; + foreach (@{$self->{fuses}}) { + $_->dump() if $_->{cpqRackCommonEnclosureFusePresent} eq 'present' || + $self->{runtime}->{options}->{verbose} >= 3; # absent nur bei -vvv + } +} + + +package HP::BladeSystem::Component::CommonEnclosureSubsystem::FuseSubsystem::Fuse; + +our @ISA = qw(HP::BladeSystem::Component::CommonEnclosureSubsystem::FuseSubsystem); + +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}, + blacklisted => 0, + info => undef, + extendedinfo => undef, + }; + map { $self->{$_} = $params{$_} } grep /cpqRackCommonEnclosureFuse/, keys %params; + $self->{name} = $self->{cpqRackCommonEnclosureFuseRack}.':'.$self->{cpqRackCommonEnclosureFuseChassis}.':'.$self->{cpqRackCommonEnclosureFuseIndex}; + bless $self, $class; + return $self; +} + +sub check { + my $self = shift; + $self->blacklist('fu', $self->{name}); + $self->add_info(sprintf 'fuse %s is %s, location is %s, condition is %s', + $self->{name}, $self->{cpqRackCommonEnclosureFusePresent}, + $self->{cpqRackCommonEnclosureFuseLocation}, $self->{cpqRackCommonEnclosureFuseCondition}); + if ($self->{cpqRackCommonEnclosureFuseCondition} eq 'failed') { + $self->add_message(CRITICAL, $self->{info}); + } elsif ($self->{cpqRackCommonEnclosureFuseCondition} ne 'ok') { + $self->add_message(WARNING, $self->{info}); + } +} + +sub dump { + my $self = shift; + printf "[FUSE_%s]\n", $self->{name}; + foreach (qw(cpqRackCommonEnclosureFuseRack cpqRackCommonEnclosureFuseChassis + cpqRackCommonEnclosureFuseIndex cpqRackCommonEnclosureFuseEnclosureName + cpqRackCommonEnclosureFuseLocation cpqRackCommonEnclosureFusePresent + cpqRackCommonEnclosureFuseCondition)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "info: %s\n", $self->{info}; + printf "\n"; +} + +1; diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/CommonEnclosureSubsystem/ManagerSubsystem.pm b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/CommonEnclosureSubsystem/ManagerSubsystem.pm new file mode 100755 index 0000000..1c2e15b --- /dev/null +++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/CommonEnclosureSubsystem/ManagerSubsystem.pm @@ -0,0 +1,154 @@ +package HP::BladeSystem::Component::CommonEnclosureSubsystem::ManagerSubsystem; +our @ISA = qw(HP::BladeSystem::Component::CommonEnclosureSubsystem); + +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}, + blacklisted => 0, + managers => [], + info => undef, + extendedinfo => undef, + }; + bless $self, $class; + $self->init(); + return $self; +} + +sub init { + my $self = shift; + my $oids = { + cpqRackCommonEnclosureManagerEntry => '1.3.6.1.4.1.232.22.2.3.1.6.1', + cpqRackCommonEnclosureManagerRack => '1.3.6.1.4.1.232.22.2.3.1.6.1.1', + cpqRackCommonEnclosureManagerChassis => '1.3.6.1.4.1.232.22.2.3.1.6.1.2', + cpqRackCommonEnclosureManagerIndex => '1.3.6.1.4.1.232.22.2.3.1.6.1.3', + cpqRackCommonEnclosureManagerEnclosureName => '1.3.6.1.4.1.232.22.2.3.1.6.1.4', + cpqRackCommonEnclosureManagerLocation => '1.3.6.1.4.1.232.22.2.3.1.6.1.5', + cpqRackCommonEnclosureManagerPartNumber => '1.3.6.1.4.1.232.22.2.3.1.6.1.6', + cpqRackCommonEnclosureManagerSparePartNumber => '1.3.6.1.4.1.232.22.2.3.1.6.1.7', + cpqRackCommonEnclosureManagerSerialNum => '1.3.6.1.4.1.232.22.2.3.1.6.1.8', + cpqRackCommonEnclosureManagerRole => '1.3.6.1.4.1.232.22.2.3.1.6.1.9', + cpqRackCommonEnclosureManagerPresent => '1.3.6.1.4.1.232.22.2.3.1.6.1.10', + cpqRackCommonEnclosureManagerRedundant => '1.3.6.1.4.1.232.22.2.3.1.6.1.11', + cpqRackCommonEnclosureManagerCondition => '1.3.6.1.4.1.232.22.2.3.1.6.1.12', + cpqRackCommonEnclosureManagerFWRev => '1.3.6.1.4.1.232.22.2.3.1.6.1.15', + cpqRackCommonEnclosureManagerRoleValue => { + 1 => 'standby', + 2 => 'active', + }, + cpqRackCommonEnclosureManagerPresentValue => { + 1 => 'other', + 2 => 'absent', # mit vorsicht zu geniessen! + 3 => 'present', + }, + cpqRackCommonEnclosureManagerRedundantValue => { + 0 => 'other', # meiner phantasie entsprungen, da sich hp nicht aeussert + 1 => 'other', + 2 => 'notRedundant', + 3 => 'redundant', + }, + cpqRackCommonEnclosureManagerConditionValue => { + 1 => 'other', + 2 => 'ok', + 3 => 'degraded', + 4 => 'failed', + } + }; + # INDEX { cpqRackCommonEnclosureManagerRack, cpqRackCommonEnclosureManagerChassis, cpqRackCommonEnclosureManagerIndex } + foreach ($self->get_entries($oids, 'cpqRackCommonEnclosureManagerEntry')) { + push(@{$self->{managers}}, + HP::BladeSystem::Component::CommonEnclosureSubsystem::ManagerSubsystem::Manager->new(%{$_})); + } +} + +sub check { + my $self = shift; + foreach (@{$self->{managers}}) { + $_->check() if $_->{cpqRackCommonEnclosureManagerPresent} eq 'present' || + $self->{runtime}->{options}->{verbose} >= 3; # absent nur bei -vvv + } +} + +sub dump { + my $self = shift; + foreach (@{$self->{managers}}) { + $_->dump() if $_->{cpqRackCommonEnclosureManagerPresent} eq 'present' || + $self->{runtime}->{options}->{verbose} >= 3; # absent nur bei -vvv + } +} + + +package HP::BladeSystem::Component::CommonEnclosureSubsystem::ManagerSubsystem::Manager; + +our @ISA = qw(HP::BladeSystem::Component::CommonEnclosureSubsystem::ManagerSubsystem); + +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}, + blacklisted => 0, + info => undef, + extendedinfo => undef, + }; + map { $self->{$_} = $params{$_} } grep /cpqRackCommonEnclosureManager/, keys %params; + $self->{name} = $self->{cpqRackCommonEnclosureManagerRack}. + ':'.$self->{cpqRackCommonEnclosureManagerChassis}. + ':'.$self->{cpqRackCommonEnclosureManagerIndex}; + if ($self->{cpqRackCommonEnclosureManagerPresent} eq "absent" && + defined $self->{cpqRackCommonEnclosureManagerEnclosureName}) { + $self->{cpqRackCommonEnclosureManagerPresent} = "present"; + } + bless $self, $class; + return $self; +} + +sub check { + my $self = shift; + $self->blacklist('em', $self->{name}); + my $info = sprintf 'manager %s is %s, location is %s, redundance is %s, condition is %s, role is %s', + $self->{name}, $self->{cpqRackCommonEnclosureManagerPresent}, + $self->{cpqRackCommonEnclosureManagerLocation}, + $self->{cpqRackCommonEnclosureManagerRedundant}, + $self->{cpqRackCommonEnclosureManagerCondition}, + $self->{cpqRackCommonEnclosureManagerRole}; + $self->add_info($info) if $self->{cpqRackCommonEnclosureManagerPresent} eq 'present' || + $self->{runtime}->{options}->{verbose} >= 3; # absent managers nur bei -vvv + if ($self->{cpqRackCommonEnclosureManagerCondition} eq 'degraded') { + $self->{info} .= sprintf ' (SparePartNum: %s)', + $self->{cpqRackCommonEnclosureManagerSparePartNumber}; + $self->add_message(WARNING, $self->{info}); + } elsif ($self->{cpqRackCommonEnclosureManagerCondition} eq 'failed') { + $self->{info} .= sprintf ' (SparePartNum: %s)', + $self->{cpqRackCommonEnclosureManagerSparePartNumber}; + $self->add_message(CRITICAL, $self->{info}); + } +} + +sub dump { + my $self = shift; + printf "[ENCLOSURE_MANAGER_%s]\n", $self->{name}; + foreach (qw(cpqRackCommonEnclosureManagerRack cpqRackCommonEnclosureManagerChassis + cpqRackCommonEnclosureManagerIndex cpqRackCommonEnclosureManagerEnclosureName + cpqRackCommonEnclosureManagerLocation cpqRackCommonEnclosureManagerPartNumber + cpqRackCommonEnclosureManagerSparePartNumber cpqRackCommonEnclosureManagerPresent + cpqRackCommonEnclosureManagerRedundant + cpqRackCommonEnclosureManagerCondition cpqRackCommonEnclosureManagerFWRev)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "info: %s\n", $self->{info}; + printf "\n"; +} + +1; diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/CommonEnclosureSubsystem/TempSubsystem.pm b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/CommonEnclosureSubsystem/TempSubsystem.pm new file mode 100755 index 0000000..3e004f1 --- /dev/null +++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/CommonEnclosureSubsystem/TempSubsystem.pm @@ -0,0 +1,177 @@ +package HP::BladeSystem::Component::CommonEnclosureSubsystem::TempSubsystem; +our @ISA = qw(HP::BladeSystem::Component::CommonEnclosureSubsystem); + +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}, + condition => $params{condition}, + status => $params{status}, + temperatures => [], + blacklisted => 0, + info => undef, + extendedinfo => undef, + }; + bless $self, $class; + if ($params{runtime}->{options}->{customthresholds}) { + if (-f $params{runtime}->{options}->{customthresholds}) { + open CT, $params{runtime}->{options}->{customthresholds}; + $params{runtime}->{options}->{customthresholds} = ; + close CT; + } + foreach my $ct_items + (split(/\//, $params{runtime}->{options}->{customthresholds})) { + if ($ct_items =~ /^(\d+):(\d+)$/) { + my $temp = $2; + $params{runtime}->{options}->{thresholds}->{$1} = $temp; + } else { + die sprintf "invalid threshold %s", $ct_items; + } + } + } + $self->init(); + return $self; +} + +sub init { + my $self = shift; + my %params = @_; + my $snmpwalk = $self->{rawdata}; + my $oids = { + cpqRackCommonEnclosureTempEntry => '1.3.6.1.4.1.232.22.2.3.1.2.1', + cpqRackCommonEnclosureTempRack => '1.3.6.1.4.1.232.22.2.3.1.2.1.1', + cpqRackCommonEnclosureTempChassis => '1.3.6.1.4.1.232.22.2.3.1.2.1.2', + cpqRackCommonEnclosureTempSensorIndex => '1.3.6.1.4.1.232.22.2.3.1.2.1.3', + cpqRackCommonEnclosureTempSensorEnclosureName => '1.3.6.1.4.1.232.22.2.3.1.2.1.4', + cpqRackCommonEnclosureTempLocation => '1.3.6.1.4.1.232.22.2.3.1.2.1.5', + cpqRackCommonEnclosureTempCurrent => '1.3.6.1.4.1.232.22.2.3.1.2.1.6', + cpqRackCommonEnclosureTempThreshold => '1.3.6.1.4.1.232.22.2.3.1.2.1.7', + cpqRackCommonEnclosureTempCondition => '1.3.6.1.4.1.232.22.2.3.1.2.1.8', + cpqRackCommonEnclosureTempType => '1.3.6.1.4.1.232.22.2.3.1.2.1.9', + cpqRackCommonEnclosureTempConditionValue => { + 1 => 'other', + 2 => 'ok', + 3 => 'degraded', + 4 => 'failed', + }, + cpqRackCommonEnclosureTempTypeValue => { + 1 => 'other', + 5 => 'blowout', + 9 => 'caution', + 15 => 'critical', + }, + }; + # INDEX { cpqRackCommonEnclosureTempRack cpqRackCommonEnclosureTempChassis + # cpqRackCommonEnclosureTempSensorIndex } + foreach ($self->get_entries($oids, 'cpqRackCommonEnclosureTempEntry')) { + push(@{$self->{temperatures}}, + HP::BladeSystem::Component::CommonEnclosureSubsystem::TempSubsystem::Temp->new(%{$_})) if (($_->{cpqRackCommonEnclosureTempCurrent} != -1 && $_->{cpqRackCommonEnclosureTempThreshold} != -1) && ($_->{cpqRackCommonEnclosureTempThreshold} != 0)); + } + +} + + +sub check { + my $self = shift; + my $errorfound = 0; + if (scalar (@{$self->{temperatures}}) == 0) { + #$self->overall_check(); + } else { + foreach (@{$self->{temperatures}}) { + $_->check(); + } + } +} + +sub dump { + my $self = shift; + foreach (@{$self->{temperatures}}) { + $_->dump(); + } +} + + +package HP::BladeSystem::Component::CommonEnclosureSubsystem::TempSubsystem::Temp; +our @ISA = qw(HP::BladeSystem::Component::CommonEnclosureSubsystem::TempSubsystem); + +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}, + blacklisted => 0, + info => undef, + extendedinfo => undef, + }; + map { $self->{$_} = $params{$_} } grep /cpqRackCommonEnclosureTemp/, keys %params; + $self->{name} = $params{cpqRackCommonEnclosureTempRack}.':'. + $params{cpqRackCommonEnclosureTempChassis}.':'. + $params{cpqRackCommonEnclosureTempSensorIndex}; + bless $self, $class; + return $self; +} + +sub check { + my $self = shift; + $self->blacklist('t', $self->{name}); + if ($self->{cpqRackCommonEnclosureTempCurrent} > $self->{cpqRackCommonEnclosureTempThreshold}) { + $self->add_info(sprintf "%s temperature too high (%d%s)", + $self->{cpqRackCommonEnclosureTempLocation}, + $self->{cpqRackCommonEnclosureTempCurrent}, + $self->{runtime}->{options}->{celsius} ? "C" : "F"); + $self->add_message(CRITICAL, $self->{info}); + } else { + $self->add_info(sprintf "%s temperature is %d%s (%d max)", + $self->{cpqRackCommonEnclosureTempLocation}, + $self->{cpqRackCommonEnclosureTempCurrent}, + $self->{runtime}->{options}->{celsius} ? "C" : "F", + $self->{cpqRackCommonEnclosureTempThreshold}); + } + if ($self->{runtime}->{options}->{perfdata} == 2) { + $self->{runtime}->{plugin}->add_perfdata( + label => sprintf('temp_%s', $self->{name}), + value => $self->{cpqRackCommonEnclosureTempCurrent}, + warning => $self->{cpqRackCommonEnclosureTempThreshold}, + critical => $self->{cpqRackCommonEnclosureTempThreshold} + ); + } elsif ($self->{runtime}->{options}->{perfdata} == 1) { + $self->{runtime}->{plugin}->add_perfdata( + label => sprintf('temp_%s_%s', $self->{name}, + $self->{cpqRackCommonEnclosureTempLocation}), + value => $self->{cpqRackCommonEnclosureTempCurrent}, + warning => $self->{cpqRackCommonEnclosureTempThreshold}, + critical => $self->{cpqRackCommonEnclosureTempThreshold} + ); + } + $self->add_extendedinfo(sprintf "temp_%s=%d", + $self->{name}, $self->{cpqRackCommonEnclosureTempCurrent}); + +} + + +sub dump { + my $self = shift; + printf "[TEMP_%s]\n", $self->{name}; + foreach (qw(cpqRackCommonEnclosureTempRack cpqRackCommonEnclosureTempChassis + cpqRackCommonEnclosureTempSensorIndex cpqRackCommonEnclosureTempSensorEnclosureName + cpqRackCommonEnclosureTempLocation + cpqRackCommonEnclosureTempCurrent cpqRackCommonEnclosureTempThreshold + cpqRackCommonEnclosureTempCondition cpqRackCommonEnclosureTempType)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "info: %s\n\n", $self->{info}; +} + +1; + diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/NetConnectorSubsystem.pm b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/NetConnectorSubsystem.pm new file mode 100755 index 0000000..9fbd4d0 --- /dev/null +++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/NetConnectorSubsystem.pm @@ -0,0 +1,134 @@ +package HP::BladeSystem::Component::NetConnectorSubsystem; +our @ISA = qw(HP::BladeSystem::Component); + +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}, + net_connectors => [], + blacklisted => 0, + info => undef, + extendedinfo => undef, + }; + bless $self, $class; + $self->init(); + return $self; +} + +sub init { + my $self = shift; + my $oids = { + cpqRackNetConnectorEntry => '1.3.6.1.4.1.232.22.2.6.1.1.1', + cpqRackNetConnectorRack => '1.3.6.1.4.1.232.22.2.6.1.1.1.1', + cpqRackNetConnectorChassis => '1.3.6.1.4.1.232.22.2.6.1.1.1.2', + cpqRackNetConnectorIndex => '1.3.6.1.4.1.232.22.2.6.1.1.1.3', + cpqRackNetConnectorEnclosureName => '1.3.6.1.4.1.232.22.2.6.1.1.1.4', + cpqRackNetConnectorName => '1.3.6.1.4.1.232.22.2.6.1.1.1.5', + cpqRackNetConnectorModel => '1.3.6.1.4.1.232.22.2.6.1.1.1.6', + cpqRackNetConnectorSerialNum => '1.3.6.1.4.1.232.22.2.6.1.1.1.7', + cpqRackNetConnectorPartNumber => '1.3.6.1.4.1.232.22.2.6.1.1.1.8', + cpqRackNetConnectorSparePartNumber => '1.3.6.1.4.1.232.22.2.6.1.1.1.9', + cpqRackNetConnectorFWRev => '1.3.6.1.4.1.232.22.2.6.1.1.1.10', + cpqRackNetConnectorType => '1.3.6.1.4.1.232.22.2.6.1.1.1.11', + cpqRackNetConnectorLocation => '1.3.6.1.4.1.232.22.2.6.1.1.1.12', + cpqRackNetConnectorPresent => '1.3.6.1.4.1.232.22.2.6.1.1.1.13', + cpqRackNetConnectorHasFuses => '1.3.6.1.4.1.232.22.2.6.1.1.1.14', + cpqRackNetConnectorEnclosureSerialNum => '1.3.6.1.4.1.232.22.2.6.1.1.1.15', + cpqRackNetConnectorTypeValue => { + 0 => 'other', # undefined + 1 => 'other', + 2 => 'active', + 3 => 'passive', + }, + cpqRackNetConnectorPresentValue => { + 1 => 'other', + 2 => 'absent', + 3 => 'present', + }, + cpqRackNetConnectorHasFusesValue => { + -1 => 'false', # wird geliefert, also vermute ich false + 1 => 'false', + 2 => 'true', + }, + }; + + + # INDEX { cpqRackNetConnectorRack, cpqRackNetConnectorChassis, cpqRackNetConnectorIndex } + # dreckada dreck, dreckada + foreach ($self->get_entries($oids, 'cpqRackNetConnectorEntry')) { + push(@{$self->{net_connectors}}, + HP::BladeSystem::Component::NetConnectorSubsystem::NetConnector->new(%{$_})); + } +} + +sub check { + my $self = shift; + foreach (@{$self->{net_connectors}}) { + $_->check() if $_->{cpqRackNetConnectorPresent} eq 'present' || + $self->{runtime}->{options}->{verbose} >= 3; # absent nur bei -vvv + } +} + +sub dump { + my $self = shift; + foreach (@{$self->{net_connectors}}) { + $_->dump() if $_->{cpqRackNetConnectorPresent} eq 'present' || + $self->{runtime}->{options}->{verbose} >= 3; # absent nur bei -vvv + } +} + + +package HP::BladeSystem::Component::NetConnectorSubsystem::NetConnector; +our @ISA = qw(HP::BladeSystem::Component::NetConnectorSubsystem); + +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}, + blacklisted => 0, + info => undef, + extendedinfo => undef, + }; + map { $self->{$_} = $params{$_} } grep /cpqRackNetConnector/, keys %params; + $self->{name} = $params{cpqRackNetConnectorRack}. + ':'.$params{cpqRackNetConnectorChassis}. + ':'.$params{cpqRackNetConnectorIndex}; + $self->{serfw} = sprintf "Ser: %s, FW: %s", $self->{cpqRackNetConnectorSerialNum}, $self->{cpqRackNetConnectorFWRev}; + bless $self, $class; + return $self; +} + +sub check { + my $self = shift; + $self->blacklist('nc', $self->{name}); + my $info = sprintf 'net connector %s is %s, model is %s (%s)', + $self->{name}.($self->{cpqRackNetConnectorName} ? ' \''.$self->{cpqRackNetConnectorName}.'\'' : ''), + $self->{cpqRackNetConnectorPresent}, $self->{cpqRackNetConnectorModel}, $self->{serfw}; + $self->add_info($info); + # hat weder status noch condition, vielleicht spaeter mal + $info .= sprintf " (SparePartNum %s)", $self->{cpqRackNetConnectorSparePartNumber}; +} + +sub dump { + my $self = shift; + printf "[NET_CONNECTOR_%s]\n", $self->{cpqRackNetConnectorName}; + foreach (qw(cpqRackNetConnectorRack cpqRackNetConnectorChassis cpqRackNetConnectorIndex cpqRackNetConnectorEnclosureName cpqRackNetConnectorName cpqRackNetConnectorModel cpqRackNetConnectorSerialNum cpqRackNetConnectorPartNumber cpqRackNetConnectorSparePartNumber cpqRackNetConnectorFWRev cpqRackNetConnectorType cpqRackNetConnectorLocation cpqRackNetConnectorPresent cpqRackNetConnectorHasFuses cpqRackNetConnectorEnclosureSerialNum)) { + 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/BladeSystem/Component/PowerEnclosureSubsystem.pm b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/PowerEnclosureSubsystem.pm new file mode 100755 index 0000000..82445d3 --- /dev/null +++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/PowerEnclosureSubsystem.pm @@ -0,0 +1,136 @@ +package HP::BladeSystem::Component::PowerEnclosureSubsystem; +our @ISA = qw(HP::BladeSystem::Component); + +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}, + power_enclosures => [], + blacklisted => 0, + info => undef, + extendedinfo => undef, + }; + bless $self, $class; + $self->init(); + return $self; +} + +sub init { + my $self = shift; + +# cpqRackPowerEnclosureTable + my $oids = { + cpqRackPowerEnclosureEntry => '1.3.6.1.4.1.232.22.2.3.3.1.1', + cpqRackPowerEnclosureRack => '1.3.6.1.4.1.232.22.2.3.3.1.1.1', + cpqRackPowerEnclosureIndex => '1.3.6.1.4.1.232.22.2.3.3.1.1.2', + cpqRackPowerEnclosureName => '1.3.6.1.4.1.232.22.2.3.3.1.1.3', + cpqRackPowerEnclosureMgmgtBoardSerialNum => '1.3.6.1.4.1.232.22.2.3.3.1.1.4', + cpqRackPowerEnclosureRedundant => '1.3.6.1.4.1.232.22.2.3.3.1.1.5', + cpqRackPowerEnclosureLoadBalanced => '1.3.6.1.4.1.232.22.2.3.3.1.1.6', + cpqRackPowerEnclosureInputPwrType => '1.3.6.1.4.1.232.22.2.3.3.1.1.7', + cpqRackPowerEnclosurePwrFeedMax => '1.3.6.1.4.1.232.22.2.3.3.1.1.8', + cpqRackPowerEnclosureCondition => '1.3.6.1.4.1.232.22.2.3.3.1.1.9', + cpqRackPowerEnclosureRedundantValue => { + 1 => 'other', + 2 => 'notRedundant', + 3 => 'redundant', + }, + cpqRackPowerEnclosureLoadBalancedValue => { + 0 => 'aechz', + 1 => 'other', + 2 => 'notLoadBalanced', + 3 => 'loadBalanced', + }, + cpqRackPowerEnclosureInputPwrTypeValue => { + 1 => 'other', + 2 => 'singlePhase', + 3 => 'threePhase', + 4 => 'directCurrent', + }, + cpqRackPowerEnclosureConditionValue => { + 1 => 'other', + 2 => 'ok', + 3 => 'degraded', + }, + }; + + + # INDEX { cpqRackPowerEnclosureRack, cpqRackPowerEnclosureIndex } + # dreckada dreck, dreckada + foreach ($self->get_entries($oids, 'cpqRackPowerEnclosureEntry')) { + push(@{$self->{power_enclosures}}, + HP::BladeSystem::Component::PowerEnclosureSubsystem::PowerEnclosure->new(%{$_})); + } +} + +sub check { + my $self = shift; + foreach (@{$self->{power_enclosures}}) { + $_->check(); + } +} + +sub dump { + my $self = shift; + foreach (@{$self->{power_enclosures}}) { + $_->dump(); + } +} + + +package HP::BladeSystem::Component::PowerEnclosureSubsystem::PowerEnclosure; +our @ISA = qw(HP::BladeSystem::Component::PowerEnclosureSubsystem); + +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}, + blacklisted => 0, + info => undef, + extendedinfo => undef, + }; + map { $self->{$_} = $params{$_} } grep /cpqRackPowerEnclosure/, keys %params; + $self->{name} = $self->{cpqRackPowerEnclosureRack}.':'.$self->{cpqRackPowerEnclosureIndex}; + bless $self, $class; + $self->init(); + return $self; +} + +sub check { + my $self = shift; + $self->blacklist('pe', $self->{name}); + my $info = sprintf 'power enclosure %s \'%s\' condition is %s', + $self->{name}, $self->{cpqRackPowerEnclosureName}, $self->{cpqRackPowerEnclosureCondition}; + $self->add_info($info); + if ($self->{cpqRackPowerEnclosureCondition} eq 'degraded') { + $self->add_message(WARNING, $info); + } +} + +sub dump { + my $self = shift; + printf "[POWER_ENCLOSURE_%s]\n", $self->{cpqRackPowerEnclosureName}; + foreach (qw(cpqRackPowerEnclosureRack cpqRackPowerEnclosureIndex + cpqRackPowerEnclosureName cpqRackPowerEnclosureMgmgtBoardSerialNum + cpqRackPowerEnclosureRedundant cpqRackPowerEnclosureLoadBalanced + cpqRackPowerEnclosureInputPwrType cpqRackPowerEnclosurePwrFeedMax + cpqRackPowerEnclosureCondition)) { + 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/BladeSystem/Component/PowerSupplySubsystem.pm b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/PowerSupplySubsystem.pm new file mode 100755 index 0000000..261ce19 --- /dev/null +++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/PowerSupplySubsystem.pm @@ -0,0 +1,238 @@ +package HP::BladeSystem::Component::PowerSupplySubsystem; +our @ISA = qw(HP::BladeSystem::Component); + +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}, + power_supplies => [], + blacklisted => 0, + info => undef, + extendedinfo => undef, + }; + bless $self, $class; + $self->init(); + return $self; +} + +sub init { + my $self = shift; + my $oids = { + cpqRackPowerSupplyEntry => '1.3.6.1.4.1.232.22.2.5.1.1.1', + cpqRackPowerSupplyRack => '1.3.6.1.4.1.232.22.2.5.1.1.1.1', + cpqRackPowerSupplyChassis => '1.3.6.1.4.1.232.22.2.5.1.1.1.2', + cpqRackPowerSupplyIndex => '1.3.6.1.4.1.232.22.2.5.1.1.1.3', + cpqRackPowerSupplyEnclosureName => '1.3.6.1.4.1.232.22.2.5.1.1.1.4', + cpqRackPowerSupplySerialNum => '1.3.6.1.4.1.232.22.2.5.1.1.1.5', + cpqRackPowerSupplySparePartNumber => '1.3.6.1.4.1.232.22.2.5.1.1.1.7', + cpqRackPowerSupplyFWRev => '1.3.6.1.4.1.232.22.2.5.1.1.1.8', + cpqRackPowerSupplyMaxPwrOutput => '1.3.6.1.4.1.232.22.2.5.1.1.1.9', + cpqRackPowerSupplyCurPwrOutput => '1.3.6.1.4.1.232.22.2.5.1.1.1.10', + cpqRackPowerSupplyIntakeTemp => '1.3.6.1.4.1.232.22.2.5.1.1.1.12', + cpqRackPowerSupplyExhaustTemp => '1.3.6.1.4.1.232.22.2.5.1.1.1.13', + cpqRackPowerSupplyStatus => '1.3.6.1.4.1.232.22.2.5.1.1.1.14', + cpqRackPowerSupplySupplyInputLineStatus => '1.3.6.1.4.1.232.22.2.5.1.1.1.15', + cpqRackPowerSupplyPresent => '1.3.6.1.4.1.232.22.2.5.1.1.1.16', + cpqRackPowerSupplyCondition => '1.3.6.1.4.1.232.22.2.5.1.1.1.17', + cpqRackPowerSupplySupplyInputLineStatusValue => { + 1 => 'noError', + 2 => 'lineOverVoltage', + 3 => 'lineUnderVoltage', + 4 => 'lineHit', + 5 => 'brownOut', + 6 => 'linePowerLoss', + }, + cpqRackPowerSupplyStatusValue => { + 1 => 'noError', + 2 => 'generalFailure', + 3 => 'bistFailure', + 4 => 'fanFailure', + 5 => 'tempFailure', + 6 => 'interlockOpen', + 7 => 'epromFailed', + 8 => 'vrefFailed', + 9 => 'dacFailed', + 10 => 'ramTestFailed', + 11 => 'voltageChannelFailed', + 12 => 'orringdiodeFailed', + 13 => 'brownOut', + 14 => 'giveupOnStartup', + 15 => 'nvramInvalid', + 16 => 'calibrationTableInvalid', + }, + cpqRackPowerSupplyPresentValue => { + 1 => 'other', + 2 => 'absent', + 3 => 'present', + }, + cpqRackPowerSupplyConditionValue => { + 1 => 'other', + 2 => 'ok', + 3 => 'degraded', + 4 => 'failed', + }, + }; + + + # INDEX { cpqRackPowerSupplyRack, cpqRackPowerSupplyChassis, cpqRackPowerSupplyIndex } + foreach ($self->get_entries($oids, 'cpqRackPowerSupplyEntry')) { + push(@{$self->{power_supplies}}, + HP::BladeSystem::Component::PowerSupplySubsystem::PowerSupply->new(%{$_})); + } +} + +sub check { + my $self = shift; + my $total_current_watt = 0; + my $total_max_watt = 0; + my $total_in_temp = 0; + my $total_out_temp = 0; + my $num_ps = 0; + foreach (@{$self->{power_supplies}}) { + $_->check() if $_->{cpqRackPowerSupplyPresent} eq 'present' || + $self->{runtime}->{options}->{verbose} >= 3; # absent nur bei -vvv + if ($_->{cpqRackPowerSupplyPresent} eq 'present') { + $total_max_watt += $_->{cpqRackPowerSupplyMaxPwrOutput}; + $total_current_watt += $_->{cpqRackPowerSupplyCurPwrOutput}; + $total_in_temp += $_->{cpqRackPowerSupplyIntakeTemp} + if $_->{cpqRackPowerSupplyIntakeTemp} != -1; + $total_out_temp += $_->{cpqRackPowerSupplyExhaustTemp} + if $_->{cpqRackPowerSupplyExhaustTemp} != -1; + $num_ps++; + } + } + $self->{runtime}->{plugin}->add_perfdata( + label => 'watt_total', + value => $total_current_watt, + warning => $total_max_watt, + critical => $total_max_watt, + ); + #$self->{runtime}->{plugin}->add_perfdata( + # label => 'watt_total_pct', + # value => ($total_current_watt == 0 ? 0 : + # sprintf("%.2f", + # ($total_current_watt / $total_max_watt * 100))), + # warning => 100, + # critical => 100, + # uom => '%', + #); + if ($total_in_temp) { + $self->{runtime}->{plugin}->add_perfdata( + label => 'in_temp', + value => $total_in_temp / $num_ps, + ); + } + if ($total_out_temp) { + $self->{runtime}->{plugin}->add_perfdata( + label => 'out_temp', + value => $total_out_temp / $num_ps, + ); + } +} + +sub dump { + my $self = shift; + foreach (@{$self->{power_supplies}}) { + $_->dump() if $_->{cpqRackPowerSupplyPresent} eq 'present' || + $self->{runtime}->{options}->{verbose} >= 3; # absent nur bei -vvv + } +} + + +package HP::BladeSystem::Component::PowerSupplySubsystem::PowerSupply; +our @ISA = qw(HP::BladeSystem::Component::PowerSupplySubsystem); + +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}, + blacklisted => 0, + info => undef, + extendedinfo => undef, + }; + map { $self->{$_} = $params{$_} } grep /cpqRackPowerSupply/, keys %params; + $self->{name} = $params{cpqRackPowerSupplyRack}. + ':'.$params{cpqRackPowerSupplyChassis}. + ':'.$params{cpqRackPowerSupplyIndex}; + $self->{serfw} = sprintf "Ser: %s, FW: %s", $self->{cpqRackPowerSupplySerialNum}, $self->{cpqRackPowerSupplyFWRev}; + bless $self, $class; + return $self; +} + +sub check { + my $self = shift; + $self->blacklist('ps', $self->{name}); + my $info = sprintf 'power supply %s is %s, condition is %s (%s)', + $self->{name}, $self->{cpqRackPowerSupplyPresent}, + $self->{cpqRackPowerSupplyCondition}, $self->{serfw}; + $self->add_info($info); + if ($self->{cpqRackPowerSupplyPresent} eq 'present') { + if ($self->{cpqRackPowerSupplyCondition} eq 'degraded') { + $info .= sprintf " (SparePartNum %s)", $self->{cpqRackPowerSupplySparePartNumber}; + $self->add_message(WARNING, $info); + $self->add_info(sprintf 'power supply %s status is %s, inp.line status is %s', + $self->{name}, $self->{cpqRackPowerSupplyStatus}, + $self->{cpqRackPowerSupplySupplyInputLineStatus}); + } elsif ($self->{cpqRackPowerSupplyCondition} eq 'failed') { + $info .= sprintf " (SparePartNum %s)", $self->{cpqRackPowerSupplySparePartNumber}; + $self->add_message(CRITICAL, $info); + $self->add_info(sprintf 'power supply %s status is %s, inp.line status is %s', + $self->{name}, $self->{cpqRackPowerSupplyStatus}, + $self->{cpqRackPowerSupplySupplyInputLineStatus}); + } + if ($self->{runtime}->{options}->{perfdata} != 2) { + $self->{runtime}->{plugin}->add_perfdata( + label => sprintf('watt_%s', $self->{name}), + value => $self->{cpqRackPowerSupplyCurPwrOutput}, + warning => $self->{cpqRackPowerSupplyMaxPwrOutput}, + critical => $self->{cpqRackPowerSupplyMaxPwrOutput} + ); + #$self->{runtime}->{plugin}->add_perfdata( + # label => sprintf('watt_pct_%s', $self->{name}), + # value => ($self->{cpqRackPowerSupplyCurPwrOutput} == 0 ? 0 : + # sprintf ("%.2f", + # ($self->{cpqRackPowerSupplyCurPwrOutput} / + # $self->{cpqRackPowerSupplyMaxPwrOutput} * 100))), + # warning => 100, + # critical => 100, + # uom => '%', + #); + if ($self->{cpqRackPowerSupplyIntakeTemp} != -1) { + $self->{runtime}->{plugin}->add_perfdata( + label => sprintf('in_temp_%s', $self->{name}), + value => $self->{cpqRackPowerSupplyIntakeTemp}, + ); + } + if ($self->{cpqRackPowerSupplyExhaustTemp} != -1) { + $self->{runtime}->{plugin}->add_perfdata( + label => sprintf('out_temp_%s', $self->{name}), + value => $self->{cpqRackPowerSupplyExhaustTemp}, + ); + } + } + } +} + +sub dump { + my $self = shift; + printf "[POWER_SUPPLY%s]\n", $self->{name}; + foreach (qw(cpqRackPowerSupplyRack cpqRackPowerSupplyChassis cpqRackPowerSupplyIndex cpqRackPowerSupplyEnclosureName cpqRackPowerSupplySerialNum cpqRackPowerSupplySparePartNumber cpqRackPowerSupplyFWRev cpqRackPowerSupplyMaxPwrOutput cpqRackPowerSupplyCurPwrOutput cpqRackPowerSupplyIntakeTemp cpqRackPowerSupplyExhaustTemp cpqRackPowerSupplyStatus cpqRackPowerSupplySupplyInputLineStatus cpqRackPowerSupplyPresent cpqRackPowerSupplyCondition)) { + 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/BladeSystem/Component/ServerBladeSubsystem.pm b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/ServerBladeSubsystem.pm new file mode 100755 index 0000000..2b41f7c --- /dev/null +++ b/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/ServerBladeSubsystem.pm @@ -0,0 +1,158 @@ +package HP::BladeSystem::Component::ServerBladeSubsystem; +our @ISA = qw(HP::BladeSystem::Component); + +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}, + server_blades => [], + blacklisted => 0, + info => undef, + extendedinfo => undef, + }; + bless $self, $class; + $self->init(); + return $self; +} + +sub init { + my $self = shift; + my $oids = { + cpqRackServerBladeEntry => '1.3.6.1.4.1.232.22.2.4.1.1.1', + cpqRackServerBladeRack => '1.3.6.1.4.1.232.22.2.4.1.1.1.1', + cpqRackServerBladeChassis => '1.3.6.1.4.1.232.22.2.4.1.1.1.2', + cpqRackServerBladeIndex => '1.3.6.1.4.1.232.22.2.4.1.1.1.3', + cpqRackServerBladeName => '1.3.6.1.4.1.232.22.2.4.1.1.1.4', + cpqRackServerBladeEnclosureName => '1.3.6.1.4.1.232.22.2.4.1.1.1.5', + cpqRackServerBladePartNumber => '1.3.6.1.4.1.232.22.2.4.1.1.1.6', + cpqRackServerBladeSparePartNumber => '1.3.6.1.4.1.232.22.2.4.1.1.1.7', + cpqRackServerBladePosition => '1.3.6.1.4.1.232.22.2.4.1.1.1.8', + cpqRackServerBladeHeight => '1.3.6.1.4.1.232.22.2.4.1.1.1.9', + cpqRackServerBladeWidth => '1.3.6.1.4.1.232.22.2.4.1.1.1.10', + cpqRackServerBladeDepth => '1.3.6.1.4.1.232.22.2.4.1.1.1.11', + cpqRackServerBladePresent => '1.3.6.1.4.1.232.22.2.4.1.1.1.12', + cpqRackServerBladeHasFuses => '1.3.6.1.4.1.232.22.2.4.1.1.1.13', + cpqRackServerBladeEnclosureSerialNum => '1.3.6.1.4.1.232.22.2.4.1.1.1.14', + cpqRackServerBladeSlotsUsed => '1.3.6.1.4.1.232.22.2.4.1.1.1.15', + cpqRackServerBladeStatus => '1.3.6.1.4.1.232.22.2.4.1.1.1.21', + cpqRackServerBladeDiagnosticString => '1.3.6.1.4.1.232.22.2.4.1.1.1.24', + cpqRackServerBladePowered => '1.3.6.1.4.1.232.22.2.4.1.1.1.25', + cpqRackServerBladePOSTStatus => '1.3.6.1.4.1.232.22.2.4.1.1.1.35', + cpqRackServerBladePresentValue => { + 1 => 'other', + 2 => 'absent', + 3 => 'present', + }, + cpqRackServerBladeStatusValue => { + 1 => 'other', + 2 => 'ok', + 3 => 'degraded', + 4 => 'failed', + }, + cpqRackServerBladePoweredValue => { + 0 => 'aechz', + 1 => 'other', + 2 => 'on', + 3 => 'off', + 4 => 'powerStagedOff', + 5 => 'reboot', + }, + cpqRackServerBladePOSTStatusValue => { + 1 => 'other', + 2 => 'started', + 3 => 'completed', + 4 => 'failed', + }, + }; + + + # INDEX { cpqRackServerBladeRack, cpqRackServerBladeChassis, cpqRackServerBladeIndex } + # dreckada dreck, dreckada + foreach ($self->get_entries($oids, 'cpqRackServerBladeEntry')) { + push(@{$self->{server_blades}}, + HP::BladeSystem::Component::ServerBladeSubsystem::ServerBlade->new(%{$_})); + } +} + +sub check { + my $self = shift; + foreach (@{$self->{server_blades}}) { + $_->check() if $_->{cpqRackServerBladePresent} eq 'present' || + $self->{runtime}->{options}->{verbose} >= 3; # absent blades nur bei -vvv + } +} + +sub dump { + my $self = shift; + foreach (@{$self->{server_blades}}) { + $_->dump() if $_->{cpqRackServerBladePresent} eq 'present' || + $self->{runtime}->{options}->{verbose} >= 3; # absent blades nur bei -vvv + } +} + + +package HP::BladeSystem::Component::ServerBladeSubsystem::ServerBlade; +our @ISA = qw(HP::BladeSystem::Component::ServerBladeSubsystem); + +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}, + blacklisted => 0, + info => undef, + extendedinfo => undef, + }; + map { $self->{$_} = $params{$_} } grep /cpqRackServerBlade/, keys %params; + $self->{cpqRackServerBladeDiagnosticString} ||= ''; + $self->{name} = $self->{cpqRackServerBladeRack}. + ':'.$self->{cpqRackServerBladeChassis}. + ':'.$self->{cpqRackServerBladeIndex}; + bless $self, $class; + $self->init(); +#printf "%s\n", Data::Dumper::Dumper(\%params); + return $self; +} + +sub check { + my $self = shift; + $self->blacklist('sb', $self->{name}); + my $info = sprintf 'server blade %s \'%s\' is %s, status is %s, powered is %s', + $self->{name}, $self->{cpqRackServerBladeName}, $self->{cpqRackServerBladePresent}, + $self->{cpqRackServerBladeStatus}, $self->{cpqRackServerBladePowered}; + $self->add_info($info); + if ($self->{cpqRackServerBladePowered} eq 'on') { + if ($self->{cpqRackServerBladeStatus} eq 'degraded') { + $self->add_message(WARNING, sprintf 'server blade %s diag is \'%s\', post status is %s', + $self->{cpqRackServerBladeName}, $self->{cpqRackServerBladeDiagnosticString}, + $self->{cpqRackServerBladePOSTStatus}); + } elsif ($self->{cpqRackServerBladeStatus} eq 'failed') { + $self->add_message(CRITICAL, sprintf 'server blade %s diag is \'%s\', post status is %s', + $self->{cpqRackServerBladeName}, $self->{cpqRackServerBladeDiagnosticString}, + $self->{cpqRackServerBladePOSTStatus}); + } + } +} + +sub dump { + my $self = shift; + printf "[SERVER_BLADE_%s]\n", $self->{cpqRackServerBladeName}; + foreach (qw(cpqRackServerBladeRack cpqRackServerBladeChassis cpqRackServerBladeIndex cpqRackServerBladeName cpqRackServerBladeEnclosureName cpqRackServerBladePartNumber cpqRackServerBladeSparePartNumber cpqRackServerBladePosition cpqRackServerBladeHeight cpqRackServerBladeWidth cpqRackServerBladeDepth cpqRackServerBladePresent cpqRackServerBladeHasFuses cpqRackServerBladeEnclosureSerialNum cpqRackServerBladeSlotsUsed cpqRackServerBladeStatus cpqRackServerBladeDiagnosticString cpqRackServerBladePowered cpqRackServerBladePOSTStatus)) { + printf "%s: %s\n", $_, $self->{$_}; + } + printf "\n"; +} + + +1; -- cgit v1.2.3