Debian Codegraph @

check_hpasm/src/plugins-scripts/HP/Proliant/Component/DiskSubsystem/Da/SNMP.pm

raw
1 package HP::Proliant::Component::DiskSubsystem::Da::SNMP;
2 our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Da
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 # CPQIDA-MIB
29 my $oids = {
30 cpqDaCntlrEntry => "1.3.6.1.4.1.232.3.2.2.1.1",
31 cpqDaCntlrIndex => "1.3.6.1.4.1.232.3.2.2.1.1.1",
32 cpqDaCntlrModel => "1.3.6.1.4.1.232.3.2.2.1.1.2",
33 cpqDaCntlrSlot => "1.3.6.1.4.1.232.3.2.2.1.1.5",
34 cpqDaCntlrCondition => "1.3.6.1.4.1.232.3.2.2.1.1.6",
35 cpqDaCntlrBoardCondition => "1.3.6.1.4.1.232.3.2.2.1.1.12",
36 cpqDaCntlrModelValue => {
37 1 => 'other',
38 2 => 'ida',
39 3 => 'idaExpansion',
40 4 => 'ida-2',
41 5 => 'smart',
42 6 => 'smart-2e',
43 7 => 'smart-2p',
44 8 => 'smart-2sl',
45 9 => 'smart-3100es',
46 10 => 'smart-3200',
47 11 => 'smart-2dh',
48 12 => 'smart-221',
49 13 => 'sa-4250es',
50 14 => 'sa-4200',
51 15 => 'sa-integrated',
52 16 => 'sa-431',
53 17 => 'sa-5300',
54 18 => 'raidLc2',
55 19 => 'sa-5i',
56 20 => 'sa-532',
57 21 => 'sa-5312',
58 22 => 'sa-641',
59 23 => 'sa-642',
60 24 => 'sa-6400',
61 25 => 'sa-6400em',
62 26 => 'sa-6i',
63 },
64 cpqDaCntlrConditionValue => {
65 1 => "other",
66 2 => "ok",
67 3 => "degraded",
68 4 => "failed",
69 },
70 cpqDaCntlrBoardConditionValue => {
71 1 => "other",
72 2 => "ok",
73 3 => "degraded",
74 4 => "failed",
75 },
76 };
77
78 # INDEX { cpqDaCntlrIndex }
79 foreach ($self->get_entries($oids, 'cpqDaCntlrEntry')) {
80 push(@{$self->{controllers}},
81 HP::Proliant::Component::DiskSubsystem::Da::Controller->new(%{$_}));
82 }
83
84 $oids = {
85 cpqDaAccelEntry => "1.3.6.1.4.1.232.3.2.2.2.1",
86 cpqDaAccelCntlrIndex => "1.3.6.1.4.1.232.3.2.2.2.1.1",
87 cpqDaAccelStatus => "1.3.6.1.4.1.232.3.2.2.2.1.2",
88 cpqDaAccelErrCode => "1.3.6.1.4.1.232.3.2.2.2.1.5",
89 cpqDaAccelBattery => "1.3.6.1.4.1.232.3.2.2.2.1.6",
90 cpqDaAccelCondition => "1.3.6.1.4.1.232.3.2.2.2.1.9",
91 cpqDaAccelBatteryValue => {
92 1 => 'other',
93 2 => 'ok',
94 3 => 'recharging',
95 4 => 'failed',
96 5 => 'degraded',
97 6 => 'notPresent',
98 },
99 cpqDaAccelConditionValue => {
100 1 => "other",
101 2 => "ok",
102 3 => "degraded",
103 4 => "failed",
104 },
105 cpqDaAccelStatusValue => {
106 1 => "other",
107 2 => "invalid",
108 3 => "enabled",
109 4 => "tmpDisabled",
110 5 => "permDisabled",
111 },
112 cpqDaAccelErrCodeValue => {
113 1 => 'other',
114 2 => 'invalid',
115 3 => 'badConfig',
116 4 => 'lowBattery',
117 5 => 'disableCmd',
118 6 => 'noResources',
119 7 => 'notConnected',
120 8 => 'badMirrorData',
121 9 => 'readErr',
122 10 => 'writeErr',
123 11 => 'configCmd',
124 12 => 'expandInProgress',
125 13 => 'snapshotInProgress',
126 14 => 'redundantLowBattery',
127 15 => 'redundantSizeMismatch',
128 16 => 'redundantCacheFailure',
129 17 => 'excessiveEccErrors',
130 18 => 'adgEnablerMissing',
131 19 => 'postEccErrors',
132 20 => 'batteryHotRemoved',
133 21 => 'capacitorChargeLow',
134 22 => 'notEnoughBatteries',
135 23 => 'cacheModuleNotSupported',
136 24 => 'batteryNotSupported',
137 25 => 'noCapacitorAttached',
138 26 => 'capBasedBackupFailed',
139 27 => 'capBasedRestoreFailed',
140 28 => 'capBasedModuleHWFailure',
141 29 => 'capacitorFailedToCharge',
142 30 => 'capacitorBasedHWMemBeingErased',
143 31 => 'incompatibleCacheModule',
144 32 => 'fbcmChargerCircuitFailure',
145 },
146 };
147
148 # INDEX { cpqDaAccelCntlrIndex }
149 foreach ($self->get_entries($oids, 'cpqDaAccelEntry')) {
150 push(@{$self->{accelerators}},
151 HP::Proliant::Component::DiskSubsystem::Da::Accelerator->new(%{$_}));
152 }
153
154 $oids = {
155 cpqDaLogDrvEntry => "1.3.6.1.4.1.232.3.2.3.1.1",
156 cpqDaLogDrvCntlrIndex => "1.3.6.1.4.1.232.3.2.3.1.1.1",
157 cpqDaLogDrvIndex => "1.3.6.1.4.1.232.3.2.3.1.1.2",
158 cpqDaLogDrvFaultTol => "1.3.6.1.4.1.232.3.2.3.1.1.3",
159 cpqDaLogDrvStatus => "1.3.6.1.4.1.232.3.2.3.1.1.4",
160 cpqDaLogDrvSize => "1.3.6.1.4.1.232.3.2.3.1.1.9",
161 cpqDaLogDrvPhyDrvIDs => "1.3.6.1.4.1.232.3.2.3.1.1.10",
162 cpqDaLogDrvCondition => "1.3.6.1.4.1.232.3.2.3.1.1.11",
163 cpqDaLogDrvPercentRebuild => "1.3.6.1.4.1.232.3.2.3.1.1.12",
164 cpqDaLogDrvFaultTolValue => {
165 1 => "other",
166 2 => "none",
167 3 => "mirroring",
168 4 => "dataGuard",
169 5 => "distribDataGuard",
170 7 => "advancedDataGuard",
171 },
172 cpqDaLogDrvConditionValue => {
173 1 => "other",
174 2 => "ok",
175 3 => "degraded",
176 4 => "failed",
177 },
178 cpqDaLogDrvStatusValue => {
179 1 => "other",
180 2 => "ok",
181 3 => "failed",
182 4 => "unconfigured",
183 5 => "recovering",
184 6 => "readyForRebuild",
185 7 => "rebuilding",
186 8 => "wrongDrive",
187 9 => "badConnect",
188 10 => "overheating",
189 11 => "shutdown",
190 12 => "expanding",
191 13 => "notAvailable",
192 14 => "queuedForExpansion",
193 },
194 };
195
196 # INDEX { cpqDaLogDrvCntlrIndex, cpqDaLogDrvIndex }
197 foreach ($self->get_entries($oids, 'cpqDaLogDrvEntry')) {
198 $_->{cpqDaLogDrvPhyDrvIDs} ||= 'empty';
199 push(@{$self->{logical_drives}},
200 HP::Proliant::Component::DiskSubsystem::Da::LogicalDrive->new(%{$_}));
201 }
202
203 $oids = {
204 cpqDaPhyDrvEntry => "1.3.6.1.4.1.232.3.2.5.1.1",
205 cpqDaPhyDrvCntlrIndex => "1.3.6.1.4.1.232.3.2.5.1.1.1",
206 cpqDaPhyDrvIndex => "1.3.6.1.4.1.232.3.2.5.1.1.2",
207 cpqDaPhyDrvBay => "1.3.6.1.4.1.232.3.2.5.1.1.5",
208 cpqDaPhyDrvStatus => "1.3.6.1.4.1.232.3.2.5.1.1.6",
209 cpqDaPhyDrvSize => "1.3.6.1.4.1.232.3.2.5.1.1.9",
210 cpqDaPhyDrvCondition => "1.3.6.1.4.1.232.3.2.5.1.1.37",
211 cpqDaPhyDrvBusNumber => "1.3.6.1.4.1.232.3.2.5.1.1.50",
212 cpqDaPhyDrvConditionValue => {
213 1 => "other",
214 2 => "ok",
215 3 => "degraded",
216 4 => "failed",
217 },
218 cpqDaPhyDrvStatusValue => {
219 1 => "other",
220 2 => "ok",
221 3 => "failed",
222 4 => "predictiveFailure",
223 5 => "erasing",
224 6 => "eraseDone",
225 7 => "eraseQueued",
226 8 => "ssdWearOut",
227 9 => "notAuthenticated",
228 },
229 };
230
231 # INDEX { cpqDaPhyDrvCntlrIndex, cpqDaPhyDrvIndex }
232 foreach ($self->get_entries($oids, 'cpqDaPhyDrvEntry')) {
233 push(@{$self->{physical_drives}},
234 HP::Proliant::Component::DiskSubsystem::Da::PhysicalDrive->new(%{$_}));
235 }
236
237 }