diff options
| author | Paul Buetow <paul@buetow.org> | 2011-08-07 21:16:44 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2011-08-07 21:16:44 +0000 |
| commit | 19d6b280a556436fc29d73e66e80df7f10025a98 (patch) | |
| tree | b87882e480a231cff9ff014136f341642531eb86 | |
| parent | ddcd8cf175246a0c2b55fa3808e34f4f60e1ab9a (diff) | |
FreeBSD works
| -rw-r--r-- | CHANGELOG | 2 | ||||
| -rwxr-xr-x | loadbars.pl | 22 |
2 files changed, 17 insertions, 7 deletions
@@ -3,6 +3,8 @@ So 7. Aug 15:53:08 CEST 2011 each single core * More intelligent CPU core numbering if displaying each single core (starting counting by 0 for each host). +* FreeBSD server support for CPU graphs has been tested and is working using + linprocfs mounted on /compat/linux/proc. * Some more documentation * Some minor bugfixes diff --git a/loadbars.pl b/loadbars.pl index 5f943bd..37ecbf6 100755 --- a/loadbars.pl +++ b/loadbars.pl @@ -122,22 +122,27 @@ sub thread_get_stats ($) { if [ -e /proc/stat ]; then loadavg=/proc/loadavg stat=/proc/stat + + for i in \$(seq $C{samples}); do + cat \$loadavg \$stat + sleep $C{inter} + done else loadavg=/compat/linux/proc/loadavg stat=/compat/linux/proc/stat + + for i in \$(jot $C{samples}); do + cat \$loadavg \$stat + sleep $C{inter} + done fi - - for i in \$(seq $C{samples}); do - cat \$loadavg \$stat - sleep $C{inter} - done BASH my $cmd = $host eq 'localhost' ? $bash : "ssh -o StrictHostKeyChecking=no $C{sshopts} $host '$bash'"; my $pid = open my $pipe, "$cmd |" or do { say "Warning: $!"; - sleep 3; + sleep 1; next; }; @@ -152,7 +157,10 @@ BASH } elsif (/$cpuregexp/) { my ($name, $load) = parse_cpu_line $_; $CPUSTATS{"$host;$name"} = join ';', - map { $_ . '=' . $load->{$_} } keys %$load; + map { $_ . '=' . $load->{$_} } + grep { defined $load->{$_} } keys %$load; + + not defined $load->{$_} and debugsay $_ for keys %$load; } if ($sigusr1) { |
