Debian Codegraph @

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

raw
1 package HP::Proliant::Component::DiskSubsystem::Fca::SNMP;
2 our @ISA = qw(HP::Proliant::Component::DiskSubsystem::Fca
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 # CPQFCA-MIB
29 my $oids = {
30 cpqFcaHostCntlrEntry => '1.3.6.1.4.1.232.16.2.7.1.1',
31 cpqFcaHostCntlrIndex => '1.3.6.1.4.1.232.16.2.7.1.1.1',
32 cpqFcaHostCntlrSlot => '1.3.6.1.4.1.232.16.2.7.1.1.2',
33 cpqFcaHostCntlrModel => '1.3.6.1.4.1.232.16.2.7.1.1.3',
34 cpqFcaHostCntlrStatus => '1.3.6.1.4.1.232.16.2.7.1.1.4',
35 cpqFcaHostCntlrCondition => '1.3.6.1.4.1.232.16.2.7.1.1.5',
36 cpqFcaHostCntlrOverallCondition => '1.3.6.1.4.1.232.16.2.7.1.1.8',
37 cpqFcaHostCntlrModelValue => {
38 1 => "other",
39 # You may need to upgrade your driver software and\or instrument
40 # agent(s). You have a drive array controller in the system
41 # that the instrument agent does not recognize. (other according to CPQFCAL-MIB)
42 2 => "fchc-p",
43 3 => "fchc-e",
44 4 => "fchc64",
45 5 => "sa-sam",
46 6 => "fca-2101",
47 7 => "sw64-33",
48 8 => "fca-221x",
49 9 => "dpfcmc",
50 10 => 'fca-2404',
51 11 => 'fca-2214',
52 12 => 'a7298a',
53 13 => 'fca-2214dc',
54 14 => 'a6826a',
55 15 => 'fcmcG3',
56 16 => 'fcmcG4',
57 17 => 'ab46xa',
58 18 => 'fc-generic',
59 19 => 'fca-1143',
60 20 => 'fca-1243',
61 21 => 'fca-2143',
62 22 => 'fca-2243',
63 23 => 'fca-1050',
64 24 => 'fca-lpe1105',
65 25 => 'fca-qmh2462',
66 26 => 'fca-1142sr',
67 27 => 'fca-1242sr',
68 28 => 'fca-2142sr',
69 29 => 'fca-2242sr',
70 30 => 'fcmc20pe',
71 31 => 'fca-81q',
72 32 => 'fca-82q',
73 33 => 'fca-qmh2562',
74 34 => 'fca-81e',
75 35 => 'fca-82e',
76 36 => 'fca-1205',
77 },
78 cpqFcaHostCntlrStatusValue => {
79 1 => "other",
80 2 => "ok",
81 3 => "failed",
82 4 => "shutdown",
83 5 => "loopDegraded",
84 6 => "loopFailed",
85 7 => "notConnected",
86 },
87 cpqFcaHostCntlrConditionValue => {
88 1 => "other",
89 2 => "ok",
90 3 => "degraded",
91 4 => "failed",
92 },
93 cpqFcaHostCntlrOverallConditionValue => {
94 1 => "other",
95 2 => "ok",
96 3 => "degraded",
97 4 => "failed",
98 }, # cntrl + alle associated storage boxes
99 };
100
101 # INDEX { cpqFcaHostCntlrIndex }
102 foreach ($self->get_entries($oids, 'cpqFcaHostCntlrEntry')) {
103 push(@{$self->{host_controllers}},
104 HP::Proliant::Component::DiskSubsystem::Fca::HostController->new(%{$_}));
105 }
106
107 $oids = {
108 cpqFcaCntlrEntry => '1.3.6.1.4.1.232.16.2.2.1.1',
109 cpqFcaCntlrBoxIndex => '1.3.6.1.4.1.232.16.2.2.1.1.1',
110 cpqFcaCntlrBoxIoSlot => '1.3.6.1.4.1.232.16.2.2.1.1.2',
111 cpqFcaCntlrModel => '1.3.6.1.4.1.232.16.2.2.1.1.3',
112 cpqFcaCntlrStatus => '1.3.6.1.4.1.232.16.2.2.1.1.5',
113 cpqFcaCntlrCondition => '1.3.6.1.4.1.232.16.2.2.1.1.6',
114 cpqFcaCntlrModelValue => {
115 1 => "other",
116 2 => "fibreArray",
117 3 => "msa1000",
118 4 => "smartArrayClusterStorage",
119 5 => "hsg80",
120 6 => "hsv110",
121 7 => "msa500g2",
122 8 => "msa20",
123 8 => "msa1510i",
124 },
125 cpqFcaCntlrStatusValue => {
126 1 => "other",
127 2 => "ok",
128 3 => "failed",
129 4 => "offline",
130 5 => "redundantPathOffline",
131 6 => "notConnected",
132 },
133 cpqFcaCntlrConditionValue => {
134 1 => "other",
135 2 => "ok",
136 3 => "degraded",
137 4 => "failed",
138 },
139 };
140
141 # INDEX { cpqFcaCntlrBoxIndex, cpqFcaCntlrBoxIoSlot }
142 foreach ($self->get_entries($oids, 'cpqFcaCntlrEntry')) {
143 push(@{$self->{controllers}},
144 HP::Proliant::Component::DiskSubsystem::Fca::Controller->new(%{$_}));
145 }
146
147 $oids = {
148 cpqFcaAccelEntry => '1.3.6.1.4.1.232.16.2.2.2.1',
149 cpqFcaAccelBoxIndex => '1.3.6.1.4.1.232.16.2.2.2.1.1',
150 cpqFcaAccelBoxIoSlot => '1.3.6.1.4.1.232.16.2.2.2.1.2',
151 cpqFcaAccelStatus => '1.3.6.1.4.1.232.16.2.2.2.1.3',
152 cpqFcaAccelErrCode => '1.3.6.1.4.1.232.16.2.2.2.1.5',
153 cpqFcaAccelBatteryStatus => '1.3.6.1.4.1.232.16.2.2.2.1.6',
154 cpqFcaAccelCondition => '1.3.6.1.4.1.232.16.2.2.2.1.9',
155 cpqFcaAccelStatusValue => {
156 1 => "other",
157 2 => "invalid",
158 3 => "enabled",
159 4 => "tmpDisabled",
160 5 => "permDisabled",
161 },
162 cpqFcaAccelErrCodeValue => {
163 1 => 'other',
164 2 => 'invalid',
165 3 => 'badConfig',
166 4 => 'lowBattery',
167 5 => 'disableCmd',
168 6 => 'noResources',
169 7 => 'notConnected',
170 8 => 'badMirrorData',
171 9 => 'readErr',
172 10 => 'writeErr',
173 11 => 'configCmd',
174 12 => 'expandInProgress',
175 13 => 'snapshotInProgress',
176 14 => 'redundantLowBattery',
177 15 => 'redundantSizeMismatch',
178 16 => 'redundantCacheFailure',
179 17 => 'excessiveEccErrors',
180 19 => 'postEccErrors',
181 },
182 cpqFcaAccelBatteryStatusValue => {
183 1 => 'other',
184 2 => 'ok',
185 3 => 'recharging',
186 4 => 'failed',
187 5 => 'degraded',
188 6 => 'notPresent',
189 },
190 cpqFcaAccelConditionValue => {
191 1 => "other",
192 2 => "ok",
193 3 => "degraded",
194 4 => "failed",
195 },
196 };
197
198 # INDEX { cpqFcaAccelBoxIndex, cpqFcaAccelBoxIoSlot }
199 foreach ($self->get_entries($oids, 'cpqFcaAccelEntry')) {
200 push(@{$self->{accelerators}},
201 HP::Proliant::Component::DiskSubsystem::Fca::Accelerator->new(%{$_}));
202 }
203
204 $oids = {
205 cpqFcaLogDrvEntry => '1.3.6.1.4.1.232.16.2.3.1.1',
206 cpqFcaLogDrvBoxIndex => '1.3.6.1.4.1.232.16.2.3.1.1.1',
207 cpqFcaLogDrvIndex => '1.3.6.1.4.1.232.16.2.3.1.1.2',
208 cpqFcaLogDrvFaultTol => '1.3.6.1.4.1.232.16.2.3.1.1.3',
209 cpqFcaLogDrvStatus => '1.3.6.1.4.1.232.16.2.3.1.1.4',
210 cpqFcaLogDrvPercentRebuild => '1.3.6.1.4.1.232.16.2.3.1.1.6',
211 cpqFcaLogDrvSize => '1.3.6.1.4.1.232.16.2.3.1.1.9',
212 cpqFcaLogDrvPhyDrvIDs => '1.3.6.1.4.1.232.16.2.3.1.1.10',
213 cpqFcaLogDrvCondition => '1.3.6.1.4.1.232.16.2.3.1.1.11',
214 cpqFcaLogDrvFaultTolValue => {
215 1 => 'other',
216 2 => 'none',
217 3 => 'mirroring',
218 4 => 'dataGuard',
219 5 => 'distribDataGuard',
220 7 => 'advancedDataGuard',
221 },
222 cpqFcaLogDrvStatusValue => {
223 1 => 'other',
224 2 => 'ok',
225 3 => 'failed',
226 4 => 'unconfigured',
227 5 => 'recovering',
228 6 => 'readyForRebuild',
229 7 => 'rebuilding',
230 8 => 'wrongDrive',
231 9 => 'badConnect',
232 10 => 'overheating',
233 11 => 'shutdown',
234 12 => 'expanding',
235 13 => 'notAvailable',
236 14 => 'queuedForExpansion',
237 15 => 'hardError',
238 },
239 cpqFcaLogDrvConditionValue => {
240 1 => 'other',
241 2 => 'ok',
242 3 => 'degraded',
243 4 => 'failed',
244 },
245 };
246
247 # INDEX { cpqFcaLogDrvBoxIndex, cpqFcaLogDrvIndex }
248 foreach ($self->get_entries($oids, 'cpqFcaLogDrvEntry')) {
249 push(@{$self->{logical_drives}},
250 HP::Proliant::Component::DiskSubsystem::Fca::LogicalDrive->new(%{$_}));
251 }
252
253 $oids = {
254 cpqFcaPhyDrvEntry => '1.3.6.1.4.1.232.16.2.5.1.1',
255 cpqFcaPhyDrvBoxIndex => '1.3.6.1.4.1.232.16.2.5.1.1.1',
256 cpqFcaPhyDrvIndex => '1.3.6.1.4.1.232.16.2.5.1.1.2',
257 cpqFcaPhyDrvModel => '1.3.6.1.4.1.232.16.2.5.1.1.3',
258 cpqFcaPhyDrvBay => '1.3.6.1.4.1.232.16.2.5.1.1.5',
259 cpqFcaPhyDrvStatus => '1.3.6.1.4.1.232.16.2.5.1.1.6',
260 cpqFcaPhyDrvCondition => '1.3.6.1.4.1.232.16.2.5.1.1.31',
261 cpqFcaPhyDrvSize => '1.3.6.1.4.1.232.16.2.5.1.1.38',
262 cpqFcaPhyDrvBusNumber => '1.3.6.1.4.1.232.16.2.5.1.1.42',
263 cpqFcaPhyDrvStatusValue => {
264 1 => 'other',
265 2 => 'unconfigured',
266 3 => 'ok',
267 4 => 'threshExceeded',
268 5 => 'predictiveFailure',
269 6 => 'failed',
270 },
271 cpqFcaPhyDrvConditionValue => {
272 1 => 'other',
273 2 => 'ok',
274 3 => 'degraded',
275 4 => 'failed',
276 },
277 };
278
279 # INDEX { cpqFcaPhyDrvBoxIndex, cpqFcaPhyDrvIndex }
280 foreach ($self->get_entries($oids, 'cpqFcaPhyDrvEntry')) {
281 push(@{$self->{physical_drives}},
282 HP::Proliant::Component::DiskSubsystem::Fca::PhysicalDrive->new(%{$_}));
283 }
284
285 $oids = {
286 cpqFcaMibRevMajor => '1.3.6.1.4.1.232.16.1.1.0',
287 cpqFcaMibRevMinor => '1.3.6.1.4.1.232.16.1.2.0',
288 cpqFcaMibCondition => '1.3.6.1.4.1.232.16.1.3.0',
289 cpqFcaMibConditionValue => {
290 1 => 'other',
291 2 => 'ok',
292 3 => 'degraded',
293 4 => 'failed',
294 },
295 };
296 $self->{global_status} =
297 HP::Proliant::Component::DiskSubsystem::Fca::GlobalStatus->new(
298 runtime => $self->{runtime},
299 cpqFcaMibCondition =>
300 SNMP::Utils::get_object_value($snmpwalk,
301 $oids->{cpqFcaMibCondition}, $oids->{cpqFcaMibConditionValue})
302 );
303 }