| 1 |
package HP::Proliant::Component::MemorySubsystem::SNMP; |
| 2 |
our @ISA = qw(HP::Proliant::Component::MemorySubsystem |
| 3 |
HP::Proliant::Component::SNMP); |
| 4 |
|
| 5 |
use strict; |
| 6 |
|
| 7 |
sub new { |
| 8 |
my $class = shift; |
| 9 |
my %params = @_; |
| 10 |
my $self = { |
| 11 |
runtime => $params{runtime}, |
| 12 |
rawdata => $params{rawdata}, |
| 13 |
dimms => [], |
| 14 |
si_dimms => [], |
| 15 |
he_dimms => [], |
| 16 |
h2_dimms => [], |
| 17 |
he_cartridges => [], |
| 18 |
h2_cartridges => [], |
| 19 |
si_overall_condition => undef, |
| 20 |
he_overall_condition => undef, |
| 21 |
h2_overall_condition => undef, |
| 22 |
blacklisted => 0, |
| 23 |
info => undef, |
| 24 |
extendedinfo => undef, |
| 25 |
}; |
| 26 |
bless $self, $class; |
| 27 |
$self->si_init(); |
| 28 |
$self->he_init(); |
| 29 |
$self->he_cartridge_init(); |
| 30 |
$self->h2_init(); |
| 31 |
#$self->h2_cartridge_init(); |
| 32 |
$self->condense(); |
| 33 |
return $self; |
| 34 |
} |
| 35 |
|
| 36 |
sub si_init { |
| 37 |
my $self = shift; |
| 38 |
my $snmpwalk = $self->{rawdata}; |
| 39 |
my $oids = { |
| 40 |
cpqSiMemModuleEntry => '1.3.6.1.4.1.232.2.2.4.5.1', |
| 41 |
cpqSiMemBoardIndex => '1.3.6.1.4.1.232.2.2.4.5.1.1', |
| 42 |
cpqSiMemModuleIndex => '1.3.6.1.4.1.232.2.2.4.5.1.2', |
| 43 |
cpqSiMemModuleSize => '1.3.6.1.4.1.232.2.2.4.5.1.3', |
| 44 |
cpqSiMemModuleType => '1.3.6.1.4.1.232.2.2.4.5.1.4', |
| 45 |
cpqSiMemECCStatus => '1.3.6.1.4.1.232.2.2.4.5.1.11', |
| 46 |
cpqSiMemModuleHwLocation => '1.3.6.1.4.1.232.2.2.4.5.1.12', |
| 47 |
cpqSiMemModuleTypeValue => { |
| 48 |
1 => 'other', |
| 49 |
2 => 'board', |
| 50 |
3 => 'cpqSingleWidthModule', |
| 51 |
4 => 'cpqDoubleWidthModule', |
| 52 |
5 => 'simm', |
| 53 |
6 => 'pcmcia', |
| 54 |
7 => 'compaq-specific', |
| 55 |
8 => 'dimm', |
| 56 |
9 => 'smallOutlineDimm', |
| 57 |
10 => 'rimm', |
| 58 |
11 => 'srimm', |
| 59 |
}, |
| 60 |
cpqSiMemECCStatusValue => { |
| 61 |
0 => "n/a", |
| 62 |
1 => "other", |
| 63 |
2 => "ok", |
| 64 |
3 => "degraded", |
| 65 |
4 => "degradedModuleIndexUnknown", |
| 66 |
34 => 'n/a', # es ist zum kotzen... |
| 67 |
104 => 'n/a', |
| 68 |
}, |
| 69 |
}; |
| 70 |
# INDEX { cpqSiMemBoardIndex, cpqSiMemModuleIndex } |
| 71 |
foreach ($self->get_entries($oids, 'cpqSiMemModuleEntry')) { |
| 72 |
$_->{cartridge} = $_->{cpqSiMemBoardIndex}; |
| 73 |
$_->{module} = $_->{cpqSiMemModuleIndex}; |
| 74 |
next if (! defined $_->{cartridge} || ! defined $_->{module}); |
| 75 |
$_->{size} = $_->{cpqSiMemModuleSize}; |
| 76 |
$_->{type} = $_->{cpqSiMemModuleType}; |
| 77 |
$_->{condition} = $_->{cpqSiMemECCStatus}; |
| 78 |
$_->{status} = ($_->{cpqSiMemModuleSize} > 0) ? 'present' : 'notPresent'; |
| 79 |
push(@{$self->{si_dimms}}, |
| 80 |
HP::Proliant::Component::MemorySubsystem::Dimm->new(%{$_}) |
| 81 |
); |
| 82 |
} |
| 83 |
my $cpqSiMemECCCondition = '1.3.6.1.4.1.232.2.2.4.15.0'; |
| 84 |
my $cpqSiMemECCConditionValue = { |
| 85 |
1 => 'other', |
| 86 |
2 => 'ok', |
| 87 |
3 => 'degraded', |
| 88 |
}; |
| 89 |
$self->{si_overall_condition} = SNMP::Utils::get_object_value( |
| 90 |
$self->{rawdata}, $cpqSiMemECCCondition, |
| 91 |
$cpqSiMemECCConditionValue); |
| 92 |
$self->trace(2, sprintf 'overall si condition is %s', |
| 93 |
$self->{si_overall_condition} || 'undefined'); |
| 94 |
} |
| 95 |
|
| 96 |
sub he_init { |
| 97 |
my $self = shift; |
| 98 |
my $snmpwalk = $self->{rawdata}; |
| 99 |
my $oids = { |
| 100 |
cpqHeResMemModuleEntry => '1.3.6.1.4.1.232.6.2.14.11.1', |
| 101 |
cpqHeResMemBoardIndex => '1.3.6.1.4.1.232.6.2.14.11.1.1', |
| 102 |
cpqHeResMemModuleIndex => '1.3.6.1.4.1.232.6.2.14.11.1.2', |
| 103 |
cpqHeResMemModuleStatus => '1.3.6.1.4.1.232.6.2.14.11.1.4', |
| 104 |
cpqHeResMemModuleCondition => '1.3.6.1.4.1.232.6.2.14.11.1.5', |
| 105 |
cpqHeResMemModuleStatusValue => { |
| 106 |
1 => "other", # unknown or could not be determined |
| 107 |
2 => "notPresent", # not present or un-initialized |
| 108 |
3 => "present", # present but not in use |
| 109 |
4 => "good", # present and in use. ecc threshold not exceeded |
| 110 |
5 => "add", # added but not yet in use |
| 111 |
6 => "upgrade", # upgraded but not yet in use |
| 112 |
7 => "missing", # expected but missing |
| 113 |
8 => "doesNotMatch", # does not match the other modules in the bank |
| 114 |
9 => "notSupported", # module not supported |
| 115 |
10 => "badConfig", # violates add/upgrade configuration |
| 116 |
11 => "degraded", # ecc exceeds threshold |
| 117 |
}, |
| 118 |
# condition = status of the correctable memory errors |
| 119 |
cpqHeResMemModuleConditionValue => { |
| 120 |
0 => "n/a", # this appears only with buggy firmwares. |
| 121 |
# (only 1 module shows up) |
| 122 |
1 => "other", |
| 123 |
2 => "ok", |
| 124 |
3 => "degraded", |
| 125 |
}, |
| 126 |
}; |
| 127 |
my $tablesize = SNMP::Utils::get_size($snmpwalk, |
| 128 |
$oids->{cpqHeResMemModuleEntry}); |
| 129 |
# INDEX { cpqHeResMemBoardIndex, cpqHeResMemModuleIndex } |
| 130 |
foreach ($self->get_entries($oids, 'cpqHeResMemModuleEntry')) { |
| 131 |
$_->{cartridge} = $_->{cpqHeResMemBoardIndex}; |
| 132 |
$_->{module} = $_->{cpqHeResMemModuleIndex}; |
| 133 |
$_->{present} = $_->{cpqHeResMemModuleStatus}; |
| 134 |
$_->{status} = $_->{cpqHeResMemModuleStatus}; |
| 135 |
$_->{condition} = $_->{cpqHeResMemModuleCondition}; |
| 136 |
if ((! defined $_->{module}) && ($_->{cartridge} == 0)) { |
| 137 |
$_->{module} = $_->{index2}; # auf dem systemboard verbaut |
| 138 |
} |
| 139 |
|
| 140 |
push(@{$self->{he_dimms}}, |
| 141 |
HP::Proliant::Component::MemorySubsystem::Dimm->new(%{$_}) |
| 142 |
) unless (! defined $_->{cartridge} || ! defined $_->{module} || |
| 143 |
$tablesize == 1); |
| 144 |
} |
| 145 |
my $cpqHeResilientMemCondition = '1.3.6.1.4.1.232.6.2.14.4.0'; |
| 146 |
my $cpqHeResilientMemConditionValue = { |
| 147 |
1 => 'other', |
| 148 |
2 => 'ok', |
| 149 |
3 => 'degraded', |
| 150 |
}; |
| 151 |
$self->{he_overall_condition} = SNMP::Utils::get_object_value( |
| 152 |
$self->{rawdata}, $cpqHeResilientMemCondition, |
| 153 |
$cpqHeResilientMemConditionValue); |
| 154 |
$self->trace(2, sprintf 'overall he condition is %s', |
| 155 |
$self->{hei_overall_condition} || 'undefined'); |
| 156 |
} |
| 157 |
|
| 158 |
sub he_cartridge_init { |
| 159 |
my $self = shift; |
| 160 |
my $snmpwalk = $self->{rawdata}; |
| 161 |
my $oids = { |
| 162 |
cpqHeResMemBoardEntry => '1.3.6.1.4.1.232.6.2.14.10.1', |
| 163 |
cpqHeResMemBoardSlotIndex => '1.3.6.1.4.1.232.6.2.14.10.1.1', |
| 164 |
cpqHeResMemBoardOnlineStatus => '1.3.6.1.4.1.232.6.2.14.10.1.2', |
| 165 |
cpqHeResMemBoardErrorStatus => '1.3.6.1.4.1.232.6.2.14.10.1.3', |
| 166 |
cpqHeResMemBoardNumSockets => '1.3.6.1.4.1.232.6.2.14.10.1.5', |
| 167 |
cpqHeResMemBoardOsMemSize => '1.3.6.1.4.1.232.6.2.14.10.1.6', |
| 168 |
cpqHeResMemBoardTotalMemSize => '1.3.6.1.4.1.232.6.2.14.10.1.7', |
| 169 |
cpqHeResMemBoardCondition => '1.3.6.1.4.1.232.6.2.14.10.1.8', |
| 170 |
# onlinestatus |
| 171 |
cpqHeResMemBoardOnlineStatusValue => { |
| 172 |
0 => "n/a", # this appears only with buggy firmwares. |
| 173 |
# (only 1 module shows up) |
| 174 |
1 => "other", |
| 175 |
2 => "present", |
| 176 |
3 => "absent", |
| 177 |
}, |
| 178 |
cpqHeResMemBoardErrorStatusValue => { |
| 179 |
1 => "other", # |
| 180 |
2 => "noError", # |
| 181 |
3 => "dimmEccError", # |
| 182 |
4 => "unlockError", # |
| 183 |
5 => "configError", # |
| 184 |
6 => "busError", # |
| 185 |
7 => "powerError", # |
| 186 |
}, |
| 187 |
# condition = status of the correctable memory errors |
| 188 |
cpqHeResMemBoardConditionValue => { |
| 189 |
0 => "n/a", # this appears only with buggy firmwares. |
| 190 |
# (only 1 module shows up) |
| 191 |
1 => "other", |
| 192 |
2 => "ok", |
| 193 |
3 => "degraded", |
| 194 |
}, |
| 195 |
}; |
| 196 |
my $tablesize = SNMP::Utils::get_size($snmpwalk, |
| 197 |
$oids->{cpqHeResMemBoardEntry}); |
| 198 |
# INDEX { cpqHeResMemBoardIndex, cpqHeResMemBoardIndex } |
| 199 |
foreach ($self->get_entries($oids, 'cpqHeResMemBoardEntry')) { |
| 200 |
push(@{$self->{he_cartridges}}, |
| 201 |
HP::Proliant::Component::MemorySubsystem::Cartridge->new(%{$_}) |
| 202 |
) unless (! defined $_->{cpqHeResMemBoardSlotIndex} || $tablesize == 1); |
| 203 |
} |
| 204 |
} |
| 205 |
|
| 206 |
sub h2_init { |
| 207 |
my $self = shift; |
| 208 |
my $snmpwalk = $self->{rawdata}; |
| 209 |
my $oids = { |
| 210 |
cpqHeResMem2ModuleEntry => '1.3.6.1.4.1.232.6.2.14.13.1', |
| 211 |
cpqHeResMem2BoardNum => '1.3.6.1.4.1.232.6.2.14.13.1.2', |
| 212 |
cpqHeResMem2ModuleNum => '1.3.6.1.4.1.232.6.2.14.13.1.5', |
| 213 |
cpqHeResMem2ModuleStatus => '1.3.6.1.4.1.232.6.2.14.13.1.19', |
| 214 |
cpqHeResMem2ModuleCondition => '1.3.6.1.4.1.232.6.2.14.13.1.20', |
| 215 |
cpqHeResMem2ModuleSize => '1.3.6.1.4.1.232.6.2.14.13.1.6', |
| 216 |
|
| 217 |
cpqHeResMem2ModuleStatusValue => { |
| 218 |
1 => "other", # unknown or could not be determined |
| 219 |
2 => "notPresent", # not present or un-initialized |
| 220 |
3 => "present", # present but not in use |
| 221 |
4 => "good", # present and in use. ecc threshold not exceeded |
| 222 |
5 => "add", # added but not yet in use |
| 223 |
6 => "upgrade", # upgraded but not yet in use |
| 224 |
7 => "missing", # expected but missing |
| 225 |
8 => "doesNotMatch", # does not match the other modules in the bank |
| 226 |
9 => "notSupported", # module not supported |
| 227 |
10 => "badConfig", # violates add/upgrade configuration |
| 228 |
11 => "degraded", # ecc exceeds threshold |
| 229 |
}, |
| 230 |
# condition = status of the correctable memory errors |
| 231 |
cpqHeResMem2ModuleConditionValue => { |
| 232 |
0 => "n/a", # this appears only with buggy firmwares. |
| 233 |
# (only 1 module shows up) |
| 234 |
1 => "other", |
| 235 |
2 => "ok", |
| 236 |
3 => "degraded", |
| 237 |
}, |
| 238 |
}; |
| 239 |
# INDEX { cpqHeResMem2ModuleNum } |
| 240 |
my $lastboard = 0; |
| 241 |
my $lastmodule = 0; |
| 242 |
my $myboard= 0; |
| 243 |
my $hpboard = 0; |
| 244 |
foreach (sort { $a->{index1} <=> $b->{index1} } |
| 245 |
$self->get_entries($oids, 'cpqHeResMem2ModuleEntry')) { |
| 246 |
$hpboard = $_->{cpqHeResMem2BoardNum}; |
| 247 |
# dass hier faelschlicherweise 0 zurueckkommt, wundert mich schon |
| 248 |
# gar nicht mehr |
| 249 |
$_->{module} = $_->{cpqHeResMem2ModuleNum}; |
| 250 |
if ($_->{module} < $lastmodule) { |
| 251 |
# sieht so aus, als haette man es mit einem neuen board zu tun |
| 252 |
# da hp zu bloed ist, selber hochzuzaehlen, muss ich das tun |
| 253 |
$myboard++; |
| 254 |
} |
| 255 |
$lastmodule = $_->{cpqHeResMem2ModuleNum}; |
| 256 |
$_->{cartridge} = ($myboard != $hpboard) ? $myboard : $hpboard; |
| 257 |
$_->{present} = $_->{cpqHeResMem2ModuleStatus}; |
| 258 |
$_->{status} = $_->{cpqHeResMem2ModuleStatus}; |
| 259 |
$_->{condition} = $_->{cpqHeResMem2ModuleCondition}; |
| 260 |
$_->{size} = $_->{cpqHeResMem2ModuleSize}; |
| 261 |
push(@{$self->{h2_dimms}}, |
| 262 |
HP::Proliant::Component::MemorySubsystem::Dimm->new(%{$_}) |
| 263 |
) unless (! defined $_->{cpqHeResMem2BoardNum} || |
| 264 |
! defined $_->{cpqHeResMem2ModuleNum}); |
| 265 |
} |
| 266 |
} |
| 267 |
|
| 268 |
sub h2_cartridge_init { |
| 269 |
my $self = shift; |
| 270 |
my $snmpwalk = $self->{rawdata}; |
| 271 |
my $oids = { |
| 272 |
cpqHeResMem2BoardEntry => '1.3.6.1.4.1.232.6.2.14.12.1', |
| 273 |
cpqHeResMem2BoardIndex => '1.3.6.1.4.1.232.6.2.14.12.1.1', |
| 274 |
cpqHeResMem2BoardOnlineStatus => '1.3.6.1.4.1.232.6.2.14.12.1.5', |
| 275 |
cpqHeResMem2BoardErrorStatus => '1.3.6.1.4.1.232.6.2.14.12.1.6', |
| 276 |
cpqHeResMem2BoardNumSockets => '1.3.6.1.4.1.232.6.2.14.12.1.8', |
| 277 |
cpqHeResMem2BoardOsMemSize => '1.3.6.1.4.1.232.6.2.14.12.1.9', |
| 278 |
cpqHeResMem2BoardTotalMemSize => '1.3.6.1.4.1.232.6.2.14.12.1.10', |
| 279 |
cpqHeResMem2BoardCondition => '1.3.6.1.4.1.232.6.2.14.12.1.11', |
| 280 |
# onlinestatus |
| 281 |
cpqHeResMem2BoardOnlineStatusValue => { |
| 282 |
0 => "n/a", # this appears only with buggy firmwares. |
| 283 |
# (only 1 module shows up) |
| 284 |
1 => "other", |
| 285 |
2 => "present", |
| 286 |
3 => "absent", |
| 287 |
}, |
| 288 |
cpqHeResMem2BoardErrorStatusValue => { |
| 289 |
1 => "other", # |
| 290 |
2 => "noError", # |
| 291 |
3 => "dimmEccError", # |
| 292 |
4 => "unlockError", # |
| 293 |
5 => "configError", # |
| 294 |
6 => "busError", # |
| 295 |
7 => "powerError", # |
| 296 |
}, |
| 297 |
# condition = status of the correctable memory errors |
| 298 |
cpqHeResMem2BoardConditionValue => { |
| 299 |
0 => "n/a", # this appears only with buggy firmwares. |
| 300 |
# (only 1 module shows up) |
| 301 |
1 => "other", |
| 302 |
2 => "ok", |
| 303 |
3 => "degraded", |
| 304 |
}, |
| 305 |
}; |
| 306 |
my $tablesize = SNMP::Utils::get_size($snmpwalk, |
| 307 |
$oids->{cpqHeResMemBoardEntry}); |
| 308 |
# INDEX { cpqHeResMem2BoardIndex, cpqHeResMem2BoardIndex } |
| 309 |
foreach ($self->get_entries($oids, 'cpqHeResMem2BoardEntry')) { |
| 310 |
push(@{$self->{h2_cartridges}}, |
| 311 |
HP::Proliant::Component::MemorySubsystem::Cartridge->new(%{$_}) |
| 312 |
) unless (! defined $_->{cpqHeRes2MemBoardIndex} || $tablesize == 1); |
| 313 |
} |
| 314 |
} |
| 315 |
|
| 316 |
sub condense { |
| 317 |
my $self = shift; |
| 318 |
my $snmpwalk = $self->{rawdata}; |
| 319 |
# wenn saemtliche dimms n/a sind |
| 320 |
# wenn ignore dimms: ignoring %d dimms with status 'n/a' |
| 321 |
# wenn buggyfirmware: ignoring %d dimms with status 'n/a' because of buggy firmware |
| 322 |
# if buggy firmware : condition n/a ist normal |
| 323 |
# ignore-dimms : |
| 324 |
# es gibt si_dimms und he_dimms |
| 325 |
my $si_dimms = scalar(@{$self->{si_dimms}}); |
| 326 |
my $he_dimms = scalar(@{$self->{he_dimms}}); |
| 327 |
my $h2_dimms = scalar(@{$self->{h2_dimms}}); |
| 328 |
$self->trace(2, sprintf "SI: %02d HE: %02d H2: %02d", |
| 329 |
$si_dimms, $he_dimms, $h2_dimms) |
| 330 |
if ($self->{runtime}->{options}->{verbose} >= 2); |
| 331 |
foreach ($self->get_si_boards()) { |
| 332 |
printf "SI%02d-> ", $_ if ($self->{runtime}->{options}->{verbose} >= 2); |
| 333 |
foreach ($self->get_si_modules($_)) { |
| 334 |
printf "%02d ", $_ if ($self->{runtime}->{options}->{verbose} >= 2); |
| 335 |
} |
| 336 |
printf "\n" if ($self->{runtime}->{options}->{verbose} >= 2); |
| 337 |
} |
| 338 |
foreach ($self->get_he_boards()) { |
| 339 |
printf "HE%02d-> ", $_ if ($self->{runtime}->{options}->{verbose} >= 2); |
| 340 |
foreach ($self->get_he_modules($_)) { |
| 341 |
printf "%02d ", $_ if ($self->{runtime}->{options}->{verbose} >= 2); |
| 342 |
} |
| 343 |
printf "\n" if ($self->{runtime}->{options}->{verbose} >= 2); |
| 344 |
} |
| 345 |
foreach ($self->get_h2_boards()) { |
| 346 |
printf "H2%02d-> ", $_ if ($self->{runtime}->{options}->{verbose} >= 2); |
| 347 |
foreach ($self->get_h2_modules($_)) { |
| 348 |
printf "%02d ", $_ if ($self->{runtime}->{options}->{verbose} >= 2); |
| 349 |
} |
| 350 |
printf "\n" if ($self->{runtime}->{options}->{verbose} >= 2); |
| 351 |
} |
| 352 |
if (($h2_dimms == 0) && ($he_dimms == 0) && ($si_dimms > 0)) { |
| 353 |
printf "TYP1 %s\n", $self->{runtime}->{product} |
| 354 |
if ($self->{runtime}->{options}->{verbose} >= 2); |
| 355 |
@{$self->{dimms}} = $self->update_si_with_si(); |
| 356 |
} elsif (($h2_dimms == 0) && ($he_dimms > 0) && ($si_dimms > 0)) { |
| 357 |
printf "TYP2 %s\n", $self->{runtime}->{product} |
| 358 |
if ($self->{runtime}->{options}->{verbose} >= 2); |
| 359 |
@{$self->{dimms}} = $self->update_si_with_he(); |
| 360 |
} elsif (($h2_dimms == 0) && ($he_dimms > 0) && ($si_dimms == 0)) { |
| 361 |
printf "TYP3 %s\n", $self->{runtime}->{product} |
| 362 |
if ($self->{runtime}->{options}->{verbose} >= 2); |
| 363 |
@{$self->{dimms}} = $self->update_he_with_he(); |
| 364 |
} elsif (($h2_dimms > 0) && ($he_dimms == 0) && ($si_dimms == 0)) { |
| 365 |
printf "TYP4 %s\n", $self->{runtime}->{product} |
| 366 |
if ($self->{runtime}->{options}->{verbose} >= 2); |
| 367 |
@{$self->{dimms}} = $self->update_h2_with_h2(); |
| 368 |
} elsif (($h2_dimms > 0) && ($he_dimms > 0) && ($si_dimms == 0)) { |
| 369 |
printf "TYP5 %s\n", $self->{runtime}->{product} |
| 370 |
if ($self->{runtime}->{options}->{verbose} >= 2); |
| 371 |
@{$self->{dimms}} = $self->update_he_with_h2(); |
| 372 |
} elsif (($h2_dimms > 0) && ($he_dimms == 0) && ($si_dimms > 0)) { |
| 373 |
printf "TYP6 %s\n", $self->{runtime}->{product} |
| 374 |
if ($self->{runtime}->{options}->{verbose} >= 2); |
| 375 |
@{$self->{dimms}} = $self->update_si_with_h2(); |
| 376 |
} elsif (($h2_dimms > 0) && ($he_dimms > 0) && ($si_dimms > 0)) { |
| 377 |
if ($h2_dimms > $si_dimms) { |
| 378 |
printf "TYP7 %s\n", $self->{runtime}->{product} |
| 379 |
if ($self->{runtime}->{options}->{verbose} >= 2); |
| 380 |
@{$self->{dimms}} = $self->update_he_with_h2(); |
| 381 |
} else { |
| 382 |
printf "TYP8 %s\n", $self->{runtime}->{product} |
| 383 |
if ($self->{runtime}->{options}->{verbose} >= 2); |
| 384 |
@{$self->{dimms}} = $self->update_si_with_he(); |
| 385 |
} |
| 386 |
} else { |
| 387 |
printf "TYPX %s\n", $self->{runtime}->{product} |
| 388 |
if ($self->{runtime}->{options}->{verbose} >= 2); |
| 389 |
} |
| 390 |
my $all_dimms = scalar(@{$self->{dimms}}); |
| 391 |
$self->trace(2, sprintf "ALL: %02d", $all_dimms); |
| 392 |
} |
| 393 |
|
| 394 |
sub dump { |
| 395 |
my $self = shift; |
| 396 |
if ($self->{runtime}->{options}->{verbose} > 2) { |
| 397 |
printf "[SI]\n"; |
| 398 |
foreach (@{$self->{si_dimms}}) { |
| 399 |
$_->dump(); |
| 400 |
} |
| 401 |
printf "[HE]\n"; |
| 402 |
foreach (@{$self->{he_dimms}}) { |
| 403 |
$_->dump(); |
| 404 |
} |
| 405 |
printf "[H2]\n"; |
| 406 |
foreach (@{$self->{h2_dimms}}) { |
| 407 |
$_->dump(); |
| 408 |
} |
| 409 |
} |
| 410 |
$self->SUPER::dump(); |
| 411 |
} |
| 412 |
|
| 413 |
sub update_si_with_si { |
| 414 |
my $self = shift; |
| 415 |
my $snmpwalk = $self->{rawdata}; |
| 416 |
my @dimms = (); |
| 417 |
my $repaircondition = undef; |
| 418 |
# wenn si keine statusinformationen liefert, dann besteht die chance |
| 419 |
# dass ein undokumentiertes he-fragment vorliegt |
| 420 |
# 1.3.6.1.4.1.232.6.2.14.11.1.1.0.<anzahl der dimms> |
| 421 |
my $cpqHeResMemModuleEntry = "1.3.6.1.4.1.232.6.2.14.11.1"; |
| 422 |
if (SNMP::Utils::get_size($snmpwalk, $cpqHeResMemModuleEntry) == 1) { |
| 423 |
$repaircondition = lc SNMP::Utils::get_object( |
| 424 |
$snmpwalk, $cpqHeResMemModuleEntry.'.1.0.'.scalar(@{$self->{si_dimms}})); |
| 425 |
# repaircondition 0 (ok) biegt alles wieder gerade |
| 426 |
} else { |
| 427 |
# anderer versuch |
| 428 |
if ($self->{si_overall_condition} && |
| 429 |
$self->{si_overall_condition} eq 'ok') { |
| 430 |
$repaircondition = 0; |
| 431 |
} |
| 432 |
} |
| 433 |
foreach my $si_dimm (@{$self->{si_dimms}}) { |
| 434 |
if (($si_dimm->{condition} eq 'n/a') || |
| 435 |
($si_dimm->{condition} eq 'other')) { |
| 436 |
$si_dimm->{condition} = 'ok' if |
| 437 |
(defined $repaircondition && $repaircondition == 0); |
| 438 |
} |
| 439 |
push(@dimms, |
| 440 |
HP::Proliant::Component::MemorySubsystem::Dimm->new( |
| 441 |
runtime => $si_dimm->{runtime}, |
| 442 |
cartridge => $si_dimm->{cartridge}, |
| 443 |
module => $si_dimm->{module}, |
| 444 |
size => $si_dimm->{size}, |
| 445 |
status => $si_dimm->{status}, |
| 446 |
condition => $si_dimm->{condition}, |
| 447 |
)); |
| 448 |
} |
| 449 |
return @dimms; |
| 450 |
} |
| 451 |
|
| 452 |
sub update_si_with_he { |
| 453 |
my $self = shift; |
| 454 |
my @dimms = (); |
| 455 |
my $first_si_cartridge = ($self->get_si_boards())[0]; |
| 456 |
my $first_he_cartridge = ($self->get_he_boards())[0]; |
| 457 |
my $offset = 0; |
| 458 |
if (scalar(@{$self->{si_dimms}}) == scalar(@{$self->{he_dimms}})) { |
| 459 |
# aufpassen! sowas kann vorkommen: si cartridge 0...6, he cartridge 1...7 |
| 460 |
if ($first_si_cartridge != $first_he_cartridge) { |
| 461 |
# README case 5 |
| 462 |
$offset = $first_si_cartridge - $first_he_cartridge; |
| 463 |
} |
| 464 |
} elsif ((scalar(@{$self->{si_dimms}}) > 1) && |
| 465 |
(scalar(@{$self->{he_dimms}}) == 1)) { |
| 466 |
# siehe update_si_with_si. he-fragment |
| 467 |
return $self->update_si_with_si(); |
| 468 |
} else { |
| 469 |
# z.b. 4 si notpresent, 4 si present, 4 he |
| 470 |
} |
| 471 |
foreach my $si_dimm (@{$self->{si_dimms}}) { |
| 472 |
if (($si_dimm->{condition} eq 'n/a') || |
| 473 |
($si_dimm->{condition} eq 'other')) { |
| 474 |
if (my $he_dimm = $self->get_he_module( |
| 475 |
$si_dimm->{cartridge} - $offset, $si_dimm->{module})) { |
| 476 |
# vielleicht hat he mehr ahnung |
| 477 |
$si_dimm->{condition} = $he_dimm->{condition}; |
| 478 |
if (($si_dimm->{condition} eq 'n/a') || |
| 479 |
($si_dimm->{condition} eq 'other')) { |
| 480 |
# wenns immer noch kein brauchbares ergebnis gibt.... |
| 481 |
if ($self->{he_overall_condition} && |
| 482 |
$self->{he_overall_condition} eq 'ok') { |
| 483 |
# wird schon stimmen... |
| 484 |
$si_dimm->{condition} = 'ok'; |
| 485 |
} else { |
| 486 |
# ansonsten stellen wir uns dumm |
| 487 |
$si_dimm->{status} = 'notPresent'; |
| 488 |
} |
| 489 |
} |
| 490 |
} else { |
| 491 |
# in dem fall zeigt si unbestueckte cartridges an |
| 492 |
} |
| 493 |
} |
| 494 |
push(@dimms, |
| 495 |
HP::Proliant::Component::MemorySubsystem::Dimm->new( |
| 496 |
runtime => $si_dimm->{runtime}, |
| 497 |
cartridge => $si_dimm->{cartridge}, |
| 498 |
module => $si_dimm->{module}, |
| 499 |
size => $si_dimm->{size}, |
| 500 |
status => $si_dimm->{status}, |
| 501 |
condition => $si_dimm->{condition}, |
| 502 |
)); |
| 503 |
} |
| 504 |
return @dimms; |
| 505 |
} |
| 506 |
|
| 507 |
sub update_he_with_he { |
| 508 |
my $self = shift; |
| 509 |
my @dimms = (); |
| 510 |
foreach my $he_dimm (@{$self->{he_dimms}}) { |
| 511 |
push(@dimms, |
| 512 |
HP::Proliant::Component::MemorySubsystem::Dimm->new( |
| 513 |
runtime => $he_dimm->{runtime}, |
| 514 |
cartridge => $he_dimm->{cartridge}, |
| 515 |
module => $he_dimm->{module}, |
| 516 |
size => $he_dimm->{size}, |
| 517 |
status => $he_dimm->{status}, |
| 518 |
condition => $he_dimm->{condition}, |
| 519 |
)); |
| 520 |
} |
| 521 |
return @dimms; |
| 522 |
} |
| 523 |
|
| 524 |
sub update_si_with_h2 { |
| 525 |
my $self = shift; |
| 526 |
my @dimms = (); |
| 527 |
my $first_si_cartridge = ($self->get_si_boards())[0]; |
| 528 |
my $first_h2_cartridge = ($self->get_h2_boards())[0]; |
| 529 |
my $offset = 0; |
| 530 |
if (scalar(@{$self->{si_dimms}}) == scalar(@{$self->{h2_dimms}})) { |
| 531 |
# aufpassen! sowas kann vorkommen: si cartridge 0...6, he cartridge 1...7 |
| 532 |
if ($first_si_cartridge != $first_h2_cartridge) { |
| 533 |
# README case 5 |
| 534 |
$offset = $first_si_cartridge - $first_h2_cartridge; |
| 535 |
} |
| 536 |
} else { |
| 537 |
# z.b. 4 si notpresent, 4 si present, 4 he |
| 538 |
} |
| 539 |
foreach my $si_dimm (@{$self->{si_dimms}}) { |
| 540 |
if (($si_dimm->{condition} eq 'n/a') || |
| 541 |
($si_dimm->{condition} eq 'other')) { |
| 542 |
if (my $h2_dimm = $self->get_h2_module( |
| 543 |
$si_dimm->{cartridge} - $offset, $si_dimm->{module})) { |
| 544 |
# vielleicht hat h2 mehr ahnung |
| 545 |
$si_dimm->{condition} = $h2_dimm->{condition}; |
| 546 |
if (1) { |
| 547 |
# ist zwar da, aber irgendwie auskonfiguriert |
| 548 |
$si_dimm->{status} = 'notPresent' if $h2_dimm->{status} eq 'other'; |
| 549 |
} |
| 550 |
} else { |
| 551 |
# in dem fall zeigt si unbestueckte cartridges an |
| 552 |
} |
| 553 |
} |
| 554 |
push(@dimms, |
| 555 |
HP::Proliant::Component::MemorySubsystem::Dimm->new( |
| 556 |
runtime => $si_dimm->{runtime}, |
| 557 |
cartridge => $si_dimm->{cartridge}, |
| 558 |
module => $si_dimm->{module}, |
| 559 |
size => $si_dimm->{size}, |
| 560 |
status => $si_dimm->{status}, |
| 561 |
condition => $si_dimm->{condition}, |
| 562 |
)); |
| 563 |
} |
| 564 |
return @dimms; |
| 565 |
} |
| 566 |
|
| 567 |
sub update_he_with_h2 { |
| 568 |
my $self = shift; |
| 569 |
my @dimms = (); |
| 570 |
my $first_he_cartridge = ($self->get_he_boards())[0]; |
| 571 |
my $first_h2_cartridge = ($self->get_h2_boards())[0]; |
| 572 |
my $offset = 0; |
| 573 |
# auch hier koennte sowas u.u.vorkommen: he cartridge 0..6, h2 cartridge 1..7 |
| 574 |
# ich habs zwar nie gesehen, aber wer weiss... |
| 575 |
if ($first_h2_cartridge != $first_he_cartridge) { |
| 576 |
$offset = $first_h2_cartridge - $first_he_cartridge; |
| 577 |
} |
| 578 |
foreach my $he_dimm (@{$self->{he_dimms}}) { |
| 579 |
if (($he_dimm->{condition} eq 'n/a') || |
| 580 |
($he_dimm->{condition} eq 'other')) { |
| 581 |
if (my $h2_dimm = $self->get_h2_module( |
| 582 |
$he_dimm->{cartridge} + $offset, $he_dimm->{module})) { |
| 583 |
# vielleicht hat h2 mehr ahnung |
| 584 |
$he_dimm->{condition} = $h2_dimm->{condition}; |
| 585 |
if (1) { |
| 586 |
# ist zwar da, aber irgendwie auskonfiguriert |
| 587 |
$he_dimm->{status} = 'notPresent' if $h2_dimm->{status} eq 'other'; |
| 588 |
} |
| 589 |
} else { |
| 590 |
# in dem fall weiss he mehr als h2 |
| 591 |
} |
| 592 |
} |
| 593 |
if ($he_dimm->{size} == 0) { |
| 594 |
if (my $h2_dimm = $self->get_h2_module( |
| 595 |
$he_dimm->{cartridge} + $offset, $he_dimm->{module})) { |
| 596 |
$he_dimm->{size} = $h2_dimm->{size}; |
| 597 |
# h2 beinhaltet eine size-oid |
| 598 |
} |
| 599 |
} |
| 600 |
push(@dimms, |
| 601 |
HP::Proliant::Component::MemorySubsystem::Dimm->new( |
| 602 |
runtime => $he_dimm->{runtime}, |
| 603 |
cartridge => $he_dimm->{cartridge}, |
| 604 |
module => $he_dimm->{module}, |
| 605 |
size => $he_dimm->{size}, |
| 606 |
status => $he_dimm->{status}, |
| 607 |
condition => $he_dimm->{condition}, |
| 608 |
)); |
| 609 |
} |
| 610 |
return @dimms; |
| 611 |
} |
| 612 |
|
| 613 |
sub update_h2_with_h2 { |
| 614 |
my $self = shift; |
| 615 |
my @dimms = (); |
| 616 |
foreach my $h2_dimm (@{$self->{h2_dimms}}) { |
| 617 |
push(@dimms, |
| 618 |
HP::Proliant::Component::MemorySubsystem::Dimm->new( |
| 619 |
runtime => $h2_dimm->{runtime}, |
| 620 |
cartridge => $h2_dimm->{cartridge}, |
| 621 |
module => $h2_dimm->{module}, |
| 622 |
size => $h2_dimm->{size}, |
| 623 |
status => $h2_dimm->{status}, |
| 624 |
condition => $h2_dimm->{condition}, |
| 625 |
)); |
| 626 |
} |
| 627 |
return @dimms; |
| 628 |
} |
| 629 |
|
| 630 |
sub is_faulty { |
| 631 |
my $self = shift; |
| 632 |
if (scalar(@{$self->{si_dimms}}) > 0 && |
| 633 |
scalar(@{$self->{he_dimms}}) > 0) { |
| 634 |
return $self->si_is_faulty() || $self->he_is_faulty(); |
| 635 |
} elsif (scalar(@{$self->{si_dimms}}) > 0 && |
| 636 |
scalar(@{$self->{he_dimms}}) == 0) { |
| 637 |
return $self->si_is_faulty(); |
| 638 |
} elsif (scalar(@{$self->{si_dimms}}) == 0 && |
| 639 |
scalar(@{$self->{he_dimms}}) > 0) { |
| 640 |
return $self->he_is_faulty(); |
| 641 |
} else { |
| 642 |
return 0; |
| 643 |
} |
| 644 |
} |
| 645 |
|
| 646 |
sub si_is_faulty { |
| 647 |
my $self = shift; |
| 648 |
return ! defined $self->{si_overall_condition} ? 0 : |
| 649 |
$self->{si_overall_condition} eq 'degraded' ? 1 : 0; |
| 650 |
} |
| 651 |
|
| 652 |
sub si_is_ok { |
| 653 |
my $self = shift; |
| 654 |
return ! defined $self->{si_overall_condition} ? 1 : |
| 655 |
$self->{si_overall_condition} eq 'ok' ? 1 : 0; |
| 656 |
} |
| 657 |
|
| 658 |
sub he_is_faulty { |
| 659 |
my $self = shift; |
| 660 |
return ! defined $self->{he_overall_condition} ? 0 : |
| 661 |
$self->{he_overall_condition} eq 'degraded' ? 1 : 0; |
| 662 |
} |
| 663 |
|
| 664 |
sub he_is_ok { |
| 665 |
my $self = shift; |
| 666 |
return ! defined $self->{he_overall_condition} ? 1 : |
| 667 |
$self->{he_overall_condition} eq 'ok' ? 1 : 0; |
| 668 |
} |
| 669 |
|
| 670 |
sub get_si_boards { |
| 671 |
my $self = shift; |
| 672 |
my %found = (); |
| 673 |
foreach (@{$self->{si_dimms}}) { |
| 674 |
$found{$_->{cartridge}} = 1; |
| 675 |
} |
| 676 |
return sort { $a <=> $b } keys %found; |
| 677 |
} |
| 678 |
|
| 679 |
sub get_si_modules { |
| 680 |
my $self = shift; |
| 681 |
my $board = shift; |
| 682 |
my %found = (); |
| 683 |
foreach (grep { $_->{cartridge} == $board } @{$self->{si_dimms}}) { |
| 684 |
$found{$_->{module}} = 1; |
| 685 |
} |
| 686 |
return sort { $a <=> $b } keys %found; |
| 687 |
} |
| 688 |
|
| 689 |
sub get_he_boards { |
| 690 |
my $self = shift; |
| 691 |
my %found = (); |
| 692 |
foreach (@{$self->{he_dimms}}) { |
| 693 |
$found{$_->{cartridge}} = 1; |
| 694 |
} |
| 695 |
return sort { $a <=> $b } keys %found; |
| 696 |
} |
| 697 |
|
| 698 |
sub get_he_modules { |
| 699 |
my $self = shift; |
| 700 |
my $board = shift; |
| 701 |
my %found = (); |
| 702 |
foreach (grep { $_->{cartridge} == $board } @{$self->{he_dimms}}) { |
| 703 |
$found{$_->{module}} = 1; |
| 704 |
} |
| 705 |
return sort { $a <=> $b } keys %found; |
| 706 |
} |
| 707 |
|
| 708 |
sub get_he_module { |
| 709 |
my $self = shift; |
| 710 |
my $board = shift; |
| 711 |
my $module = shift; |
| 712 |
my $found = (grep { $_->{cartridge} == $board && $_->{module} == $module } |
| 713 |
@{$self->{he_dimms}})[0]; |
| 714 |
return $found; |
| 715 |
} |
| 716 |
|
| 717 |
sub get_h2_boards { |
| 718 |
my $self = shift; |
| 719 |
my %found = (); |
| 720 |
# |
| 721 |
foreach (@{$self->{h2_dimms}}) { |
| 722 |
$found{$_->{cartridge}} = 1; |
| 723 |
} |
| 724 |
return sort { $a <=> $b } keys %found; |
| 725 |
} |
| 726 |
|
| 727 |
sub get_h2_modules { |
| 728 |
my $self = shift; |
| 729 |
my $board = shift; |
| 730 |
my %found = (); |
| 731 |
foreach (grep { $_->{cartridge} == $board } @{$self->{h2_dimms}}) { |
| 732 |
$found{$_->{module}} = 1; |
| 733 |
} |
| 734 |
return sort { $a <=> $b } keys %found; |
| 735 |
} |
| 736 |
|
| 737 |
sub get_h2_module { |
| 738 |
my $self = shift; |
| 739 |
my $board = shift; |
| 740 |
my $module = shift; |
| 741 |
my $found = (grep { $_->{cartridge} == $board && $_->{module} == $module } |
| 742 |
@{$self->{h2_dimms}})[0]; |
| 743 |
return $found; |
| 744 |
} |
| 745 |
|
| 746 |
|