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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
|
package HP::Proliant::Component::FanSubsystem::SNMP;
our _æ_ ISA = qw(HP::Proliant::Component::FanSubsystem
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},
fans => [],
he_fans => [],
th_fans => [],
blacklisted => 0,
info => undef,
extendedinfo => undef,
};
bless $self, $class;
$self->overall_init(%params);
$self->he_init(%params);
$self->te_init(%params);
$self->unite();
return $self;
}
sub overall_init {
my $self = shift;
my %params = _æ_ _;
my $snmpwalk = $params{rawdata};
# overall
my $cpqHeThermalSystemFanStatus = '1.3.6.1.4.1.232.6.2.6.4.0';
my $cpqHeThermalSystemFanStatusValue = {
1 => 'other',
2 => 'ok',
3 => 'degraded',
4 => 'failed',
};
my $cpqHeThermalCpuFanStatus = '1.3.6.1.4.1.232.6.2.6.5.0';
my $cpqHeThermalCpuFanStatusValue = {
1 => 'other',
2 => 'ok',
4 => 'failed', # shutdown
};
$self->{sysstatus} = SNMP::Utils::get_object_value(
$snmpwalk, $cpqHeThermalSystemFanStatus,
$cpqHeThermalSystemFanStatusValue);
$self->{cpustatus} = SNMP::Utils::get_object_value(
$snmpwalk, $cpqHeThermalCpuFanStatus,
$cpqHeThermalCpuFanStatusValue);
$self->{sysstatus} |= lc $self->{sysstatus};
$self->{cpustatus} |= lc $self->{cpustatus};
}
sub te_init {
my $self = shift;
my %params = _æ_ _;
my $snmpwalk = $params{rawdata};
my $ignore_redundancy = $params{ignore_redundancy};
# cpqHeThermalFanTable
my $oids = {
cpqHeThermalFanEntry => '1.3.6.1.4.1.232.6.2.6.6.1',
cpqHeThermalFanIndex => '1.3.6.1.4.1.232.6.2.6.6.1.1',
cpqHeThermalFanRequired => '1.3.6.1.4.1.232.6.2.6.6.1.2',
cpqHeThermalFanPresent => '1.3.6.1.4.1.232.6.2.6.6.1.3',
cpqHeThermalFanCpuFan => '1.3.6.1.4.1.232.6.2.6.6.1.4',
cpqHeThermalFanStatus => '1.3.6.1.4.1.232.6.2.6.6.1.5',
cpqHeThermalFanHwLocation => '1.3.6.1.4.1.232.6.2.6.6.1.6',
cpqHeThermalFanRequiredValue => {
1 => 'other',
2 => 'nonRequired',
3 => 'required',
},
cpqHeThermalFanPresentValue => {
1 => 'other',
2 => 'absent',
3 => 'present',
},
cpqHeThermalFanCpuFanValue => {
1 => 'other',
2 => 'systemFan',
3 => 'cpuFan',
},
cpqHeThermalFanStatusValue => {
1 => 'other',
2 => 'ok',
4 => 'failed',
},
};
# INDEX { cpqHeThermalFanIndex }
foreach ($self->get_entries($oids, 'cpqHeThermalFanEntry')) {
next if ! $_->{cpqHeThermalFanPresent};
push( _æ_ {$self->{th_fans}},
HP::Proliant::Component::FanSubsystem::Fan->new(%{$_}));
}
}
sub he_init {
my $self = shift;
my %params = _æ_ _;
my $snmpwalk = $params{rawdata};
my $ignore_redundancy = $params{ignore_redundancy};
# cpqHeFltTolFanTable
my $oids = {
cpqHeFltTolFanEntry => '1.3.6.1.4.1.232.6.2.6.7.1',
cpqHeFltTolFanChassis => '1.3.6.1.4.1.232.6.2.6.7.1.1',
cpqHeFltTolFanIndex => '1.3.6.1.4.1.232.6.2.6.7.1.2',
cpqHeFltTolFanLocale => '1.3.6.1.4.1.232.6.2.6.7.1.3',
cpqHeFltTolFanPresent => '1.3.6.1.4.1.232.6.2.6.7.1.4',
cpqHeFltTolFanType => '1.3.6.1.4.1.232.6.2.6.7.1.5',
cpqHeFltTolFanSpeed => '1.3.6.1.4.1.232.6.2.6.7.1.6',
cpqHeFltTolFanRedundant => '1.3.6.1.4.1.232.6.2.6.7.1.7',
cpqHeFltTolFanRedundantPartner => '1.3.6.1.4.1.232.6.2.6.7.1.8',
cpqHeFltTolFanCondition => '1.3.6.1.4.1.232.6.2.6.7.1.9',
cpqHeFltTolFanHotPlug => '1.3.6.1.4.1.232.6.2.6.7.1.10',
cpqHeFltTolFanHwLocation => '1.3.6.1.4.1.232.6.2.6.7.1.11',
cpqHeFltTolFanCurrentSpeed => '1.3.6.1.4.1.232.6.2.6.7.1.12',
cpqHeFltTolFanLocaleValue => {
1 => "other",
2 => "unknown",
3 => "system",
4 => "systemBoard",
5 => "ioBoard",
6 => "cpu",
7 => "memory",
8 => "storage",
9 => "removableMedia",
10 => "powerSupply",
11 => "ambient",
12 => "chassis",
13 => "bridgeCard",
},
cpqHeFltTolFanPresentValue => {
1 => "other",
2 => "absent",
3 => "present",
},
cpqHeFltTolFanSpeedValue => {
1 => "other",
2 => "normal",
3 => "high",
},
cpqHeFltTolFanRedundantValue => {
1 => "other",
2 => "notRedundant",
3 => "redundant",
},
cpqHeFltTolFanTypeValue => {
1 => "other",
2 => "tachInput",
3 => "spinDetect",
},
cpqHeFltTolFanConditionValue => {
1 => "other",
2 => "ok",
3 => "degraded",
4 => "failed",
},
cpqHeFltTolFanHotPlugValue => {
1 => "other",
2 => "nonHotPluggable",
3 => "hotPluggable",
},
};
# INDEX { cpqHeFltTolFanChassis, cpqHeFltTolFanIndex }
foreach ($self->get_entries($oids, 'cpqHeFltTolFanEntry')) {
next if ! defined $_->{cpqHeFltTolFanIndex};
# z.b. USM65201WS hat nur solche fragmente. die werden erst gar nicht
# als fans akzeptiert. dafuer gibts dann die overall condition
# SNMPv2-SMI::enterprises.232.6.2.6.7.1.1.0.1 = INTEGER: 0
# SNMPv2-SMI::enterprises.232.6.2.6.7.1.1.0.2 = INTEGER: 0
$_->{cpqHeFltTolFanPctMax} = ($_->{cpqHeFltTolFanPresent} eq 'present') ?
50 : 0;
push( _æ_ {$self->{he_fans}},
HP::Proliant::Component::FanSubsystem::Fan->new(%{$_}));
}
}
sub unite {
my $self = shift;
my $tmpfans = {};
foreach ( _æ_ {$self->{he_fans}}) {
$tmpfans->{$_->{cpqHeFltTolFanIndex}} = $_;
}
foreach ( _æ_ {$self->{he_fans}}) {
if (exists $tmpfans->{$_->{cpqHeFltTolFanRedundantPartner}}) {
$_->{partner} = $tmpfans->{$_->{cpqHeFltTolFanRedundantPartner}};
} else {
$_->{partner} = undef;
}
}
_æ_ {$self->{fans}} = _æ_ {$self->{he_fans}};
}
sub overall_check {
my $self = shift;
my $result = 0;
$self->blacklist('ofs', '');
if ($self->{sysstatus} && $self->{cpustatus}) {
if ($self->{sysstatus} eq 'degraded') {
$result = 1;
$self->add_message(WARNING,
sprintf 'system fan overall status is %s', $self->{sysstatus});
} elsif ($self->{sysstatus} eq 'failed') {
$result = 2;
$self->add_message(CRITICAL,
sprintf 'system fan overall status is %s', $self->{sysstatus});
}
if ($self->{cpustatus} eq 'degraded') {
$result = 1;
$self->add_message(WARNING,
sprintf 'cpu fan overall status is %s', $self->{cpustatus});
} elsif ($self->{cpustatus} eq 'failed') {
$result = 2;
$self->add_message(CRITICAL,
sprintf 'cpu fan overall status is %s', $self->{cpustatus});
}
$self->add_info(sprintf 'overall fan status: system=%s, cpu=%s',
$self->{sysstatus}, $self->{cpustatus});
} else {
$result = 0;
$self->add_info('this system seems to be water-cooled. no fans found');
}
return $result;
}
1;
|