loadcheck: perltidy

This commit is contained in:
Matt Simerson 2014-03-21 09:33:16 -07:00
parent 2e356a7cab
commit 767a797dbd

View File

@ -80,6 +80,7 @@ sub loadcheck {
my ($self, $transaction) = @_;
if (time() > ($self->{_time} + $self->{_args}->{cache_time})) {
# cached value expired
if (-r '/kern/loadavg') { # *BSD
@ -91,7 +92,8 @@ sub loadcheck {
$self->{_load} = ($val[0] / $val[3]);
$self->{_time} = time();
$self->log(LOGDEBUG, "/kern/loadavg reported: $self->{_load}");
} elsif ( -r '/proc/loadavg' ) { # *inux
}
elsif (-r '/proc/loadavg') { # *inux
# contains decimal value
# contains fix-point scaling value
open(LD, "</proc/loadavg");
@ -100,7 +102,8 @@ sub loadcheck {
$self->{_load} = (split(/ /, $res))[0];
$self->{_time} = time();
$self->log(LOGDEBUG, "/proc/loadavg reported: $self->{_load}");
} else {
}
else {
# the various formats returned:
#10:33AM up 2:06, 1 user, load averages: 6.55, 3.76, 2.48
# 12:29am 2 users, load average: 0.05, 0.05, 0.06
@ -110,7 +113,8 @@ sub loadcheck {
if ($res =~ /aver\S+: (\d+\.\d+)/) {
$self->{_load} = $1;
$self->{_time} = time();
$self->log(LOGDEBUG, "$self->{_args}->{uptime} reported: $self->{_load}");
$self->log(LOGDEBUG,
"$self->{_args}->{uptime} reported: $self->{_load}");
}
}
}