Debian Codegraph @

check_hpasm/check_hpasm-4.9/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Sas/SNMP.pm

raw
1 package HP::Proliant::Component::DiskSubsystem::Sas::SNMP;
2 our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Sas
3 HP::Proliant::Component::SNMP);
4
5 use strict;
6 use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 };
7
8 sub new {
9 my $class = shift;
10 my %params = @_;
11 my $self = {
12 controllers => [],
13 accelerators => [],
14 enclosures => [],
15 physical_drives => [],
16 logical_drives => [],
17 spare_drives => [],
18 blacklisted => 0,
19 };
20 bless $self, $class;
21 return $self;
22 }
23
24 sub init {
25 my $self = shift;
26 my $snmpwalk = $self->{rawdata};
27
28 # CPQSCSI-MIB
29 my $oids = {
30 cpqSasHbaEntry => "1.3.6.1.4.1.232.5.5.1.1.1",
31 cpqSasHbaIndex => "1.3.6.1.4.1.232.5.5.1.1.1.1",
32 cpqSasHbaLocation => "1.3.6.1.4.1.232.5.5.1.1.1.2",
33 cpqSasHbaSlot => "1.3.6.1.4.1.232.5.5.1.1.1.6",
34 cpqSasHbaStatus => "1.3.6.1.4.1.232.5.5.1.1.1.4",
35 cpqSasHbaStatusValue => {
36 1 => "other",
37 2 => "ok",
38 3 => "failed",
39 },
40 cpqSasHbaCondition => "1.3.6.1.4.1.232.5.5.1.1.1.5",
41 cpqSasHbaConditionValue => {
42 1 => "other",
43 2 => "ok",
44 3 => "degraded",
45 4 => "failed",
46 },
47 };
48
49 # INDEX { cpqSasHbaIndex }
50 foreach ($self->get_entries($oids, 'cpqSasHbaEntry')) {
51 push(@{$self->{controllers}},
52 HP::Proliant::Component::DiskSubsystem::Sas::Controller->new(%{$_}));
53 }
54
55 $oids = {
56 cpqSasLogDrvEntry => "1.3.6.1.4.1.232.5.5.3.1.1",
57 cpqSasLogDrvHbaIndex => "1.3.6.1.4.1.232.5.5.3.1.1.1",
58 cpqSasLogDrvIndex => "1.3.6.1.4.1.232.5.5.3.1.1.2",
59 cpqSasLogDrvStatus => "1.3.6.1.4.1.232.5.5.3.1.1.4",
60 cpqSasLogDrvCondition => "1.3.6.1.4.1.232.5.5.3.1.1.5",
61 cpqSasLogDrvRebuildingPercent => "1.3.6.1.4.1.232.5.5.3.1.1.12",
62 cpqSasLogDrvRaidLevel => "1.3.6.1.4.1.232.5.5.3.1.1.3",
63 cpqSasLogDrvRaidLevelValue => {
64 1 => "other",
65 2 => "raid0",
66 3 => "raid1",
67 4 => "raid0plus1",
68 5 => "raid5",
69 6 => "raid15",
70 7 => "volume",
71 },
72 cpqSasLogDrvConditionValue => {
73 1 => "other",
74 2 => "ok",
75 3 => "degraded",
76 4 => "failed",
77 },
78 cpqSasLogDrvStatusValue => {
79 1 => "other",
80 2 => "ok",
81 3 => "degraded",
82 4 => "rebuilding",
83 5 => "failed",
84 6 => "offline",
85 }
86 };
87 # INDEX { cpqSasLogDrvCntlrIndex, cpqSasLogDrvIndex }
88 foreach ($self->get_entries($oids, 'cpqSasLogDrvEntry')) {
89 push(@{$self->{logical_drives}},
90 HP::Proliant::Component::DiskSubsystem::Sas::LogicalDrive->new(%{$_}));
91 }
92
93 $oids = {
94 cpqSasPhyDrvEntry => "1.3.6.1.4.1.232.5.5.2.1.1",
95 cpqSasPhyDrvHbaIndex => "1.3.6.1.4.1.232.5.5.2.1.1.1",
96 cpqSasPhyDrvIndex => "1.3.6.1.4.1.232.5.5.2.1.1.2",
97 cpqSasPhyDrvLocationString => "1.3.6.1.4.1.232.5.5.2.1.1.3",
98 cpqSasPhyDrvStatus => "1.3.6.1.4.1.232.5.5.2.1.1.5",
99 cpqSasPhyDrvSize => "1.3.6.1.4.1.232.5.5.2.1.1.8",
100 cpqSasPhyDrvCondition => "1.3.6.1.4.1.232.5.5.2.1.1.6",
101 cpqSasPhyDrvConditionValue => {
102 1 => "other",
103 2 => "ok",
104 3 => "degraded",
105 4 => "failed",
106 },
107 cpqSasPhyDrvStatusValue => {
108 1 => "other",
109 2 => "ok",
110 3 => "predictiveFailure",
111 4 => "offline",
112 5 => "failed",
113 6 => "missingWasOk",
114 7 => "missingWasPredictiveFailure",
115 8 => "missingWasOffline",
116 9 => "missingWasFailed",
117 },
118 };
119
120 # INDEX { cpqPhyLogDrvCntlrIndex, cpqSasPhyDrvIndex }
121 foreach ($self->get_entries($oids, 'cpqSasPhyDrvEntry')) {
122 push(@{$self->{physical_drives}},
123 HP::Proliant::Component::DiskSubsystem::Sas::PhysicalDrive->new(%{$_}));
124 }
125
126 }