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
push @info, sprintf('%s: %s', $global{'product'}, $global_info{$global_status_map{$global{'status'}}});
my @ts = getEnabledSensors($baseOidTemp . '.1.5');
my @hs = getEnabledSensors($baseOidHumi . '.1.5');
foreach my $s (@ts) {
checkTempSensor($s);
}
foreach my $s (@hs) {
checkHumiSensor($s);
}
}
sub checkTempSensor {
my $id = shift;
my $oid = $baseOidTemp;
my %result = fetchOids({
$oid . '.1.1.' . $id => 'description', # Sensor name / description
$oid . '.1.14.' . $id => 'degree', # Currently measured degree
$oid . '.1.4.' . $id => 'status', # Sensor status, see %status_map
$oid . '.1.7.' . $id => 'highWarning', # Configured upper warning threshold
$oid . '.1.8.' . $id => 'highCritical', # Configured upper critical threshold
$oid . '.1.9.' . $id => 'lowWarning', # Configured lower warning threshold
$oid . '.1.10.' . $id => 'lowCritical', # Configured lower critical threshold
$oid . '.1.12.' . $id => 'degreeType', # fahr(0), celcius(1)
});
$performance{sanitize($result{'description'})} = sprintf(
"%.2f%s;%.1f:%.1f;%.1f:%.1f",
$result{'degree'} / 10,
$degree_map{$result{'degreeType'}},
$result{'lowWarning'},
$result{'highWarning'},
$result{'lowCritical'},
$result{'highCritical'}
);
push @info, sprintf(
'%s Temperature sensor "%s": %.2f%s (%.1f:%.1f/%.1f:%.1f)',
$status_map{$result{'status'}},
$result{'description'},
$result{'degree'} / 10,
$degree_map{$result{'degreeType'}},
$result{'lowWarning'},
$result{'highWarning'},
$result{'lowCritical'},
$result{'highCritical'}
);
}
foreach my $s (@ts) { checkTempSensor($s); } foreach my $s (@hs) { checkHumiSensor($s); }}
1
2
3
4
5
6
7
8
foreach my $s (@ts) {
$port = substr($s,0,1) + 1;
print "\nPort: $port\n";
}
foreach my $s (@hs) {
$port = substr($s,0,1) + 1;
print "\nPort: $port\n";
}