git.lirion.de

Of git, get, and gud

summaryrefslogtreecommitdiffstats
path: root/nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/CommonEnclosureSubsystem/FuseSubsystem.pm
diff options
context:
space:
mode:
Diffstat (limited to 'nagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/CommonEnclosureSubsystem/FuseSubsystem.pm')
-rwxr-xr-xnagios-plugins-contrib-24.20190301~bpo9+1/check_hpasm/check_hpasm-4.8/plugins-scripts/HP/BladeSystem/Component/CommonEnclosureSubsystem/FuseSubsystem.pm121
1 files changed, 121 insertions, 0 deletions
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;