Commit f14dfb41 authored by Mike Hibler's avatar Mike Hibler

more changes from DETER for reading APC power values

parent 959ec06b
......@@ -206,25 +206,39 @@ sub dostatus(@) {
$errors++;
next;
}
my $msg = "$ctrl: ";
$msg .= $status{current} . "A, "
if ($docurrent && defined($status{current}));
$msg .= $status{power} . "W, "
if ($dopower && defined($status{power}));
if ($dotemps &&
defined($status{tempF}) || defined($status{tempC})) {
my $temp = $status{tempF};
if (!defined($temp)) {
$temp = $status{tempC} * 9 / 5 + 32;
}
$msg .= ${temp} . "F";
} elsif ($ctrls{$ctrl} =~ /^APC/) {
my $device = new snmpit_apc($ctrl, 0);
if (!defined($device) || $device->status(\%status)) {
logit("Could not get status for $ctrl.");
$errors++;
next;
}
logit($msg);
} elsif (!$doall) {
logit("Cannot get status for $ctrl (type " .
$ctrls{$ctrl} . ") yet");
$errors++;
next;
}
if (!defined($status{current}) && !defined($status{power}) &&
!defined($status{tempF}) && !defined($status{tempC})) {
next;
}
my $msg = "$ctrl: ";
$msg .= $status{current} . "A, "
if ($docurrent && defined($status{current}));
$msg .= $status{power} . "W, "
if ($dopower && defined($status{power}));
if ($dotemps &&
defined($status{tempF}) || defined($status{tempC})) {
my $temp = $status{tempF};
if (!defined($temp)) {
$temp = $status{tempC} * 9 / 5 + 32;
}
$msg .= ${temp} . "F";
}
logit($msg);
}
close(WHINE);
exit($errors);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment