1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
package HP::Proliant::Component::AsrSubsystem::SNMP;
our _æ_ ISA = qw(HP::Proliant::Component::AsrSubsystem
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 = {
runtime => $params{runtime},
rawdata => $params{rawdata},
blacklisted => 0,
info => undef,
extendedinfo => undef,
};
bless $self, $class;
$self->overall_init(%params);
return $self;
}
sub overall_init {
my $self = shift;
my %params = _æ_ _;
my $snmpwalk = $params{rawdata};
my $cpqHeAsrStatus = "1.3.6.1.4.1.232.6.2.5.1.0";
my $cpqHeAsrStatusValue = {
1 => "other",
2 => "notAvailable",
3 => "disabled",
4 => "enabled",
};
my $cpqHeAsrCondition = "1.3.6.1.4.1.232.6.2.5.17.0";
my $cpqHeAsrConditionValue = {
1 => "other",
2 => "ok",
3 => "degraded",
4 => "failed",
};
$self->{asrcondition} = SNMP::Utils::get_object_value(
$snmpwalk, $cpqHeAsrCondition,
$cpqHeAsrConditionValue);
$self->{asrstatus} = SNMP::Utils::get_object_value(
$snmpwalk, $cpqHeAsrStatus,
$cpqHeAsrStatusValue);
$self->{asrcondition} |= lc $self->{asrcondition};
$self->{asrstatus} |= lc $self->{asrstatus};
}
sub overall_check {
my $self = shift;
my $result = 0;
$self->blacklist('asr', '');
if ($self->{asrstatus} and $self->{asrstatus} eq "enabled") {
my $info = sprintf 'ASR overall condition is %s', $self->{asrcondition};
if ($self->{asrcondition} eq "degraded") {
$self->add_message(WARNING, $info);
} elsif ($self->{asrcondition} eq "failed") {
$self->add_message(CRITICAL, $info);
}
$self->add_info($info);
} else {
$self->add_info('This system does not have ASR.');
}
}
1;
|