From 782e5607cc631cf4f703a6c0b96edfd359139639 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 6 Nov 2010 17:16:45 +0000 Subject: it works --- cpupload.pl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cpupload.pl b/cpupload.pl index 34112d1..5538e04 100755 --- a/cpupload.pl +++ b/cpupload.pl @@ -119,6 +119,7 @@ sub graph_stats ($$) { loop { my ($x, $y) = (0, 0); + for my $key (sort keys %GLOBAL_STATS) { my ($host, $name) = split ';', $key; my %stat = map { my ($k, $v) = split '='; $k => $v } split ';', $GLOBAL_STATS{$key}; @@ -177,9 +178,10 @@ sub graph_stats ($$) { $x += $width + 1; - usleep $GLOBAL_CONF{sleep} * 100000; }; + usleep $GLOBAL_CONF{sleep} * 1000000; + }; return undef; @@ -212,11 +214,11 @@ sub display_stats () { } sub main (@_) { - my $host = shift; - $host = 'localhost' unless defined $host; + my @hosts = @_; + @hosts = 'localhost' unless @hosts; my @threads; - push @threads, threads->create('get_remote_stat', $host); + push @threads, threads->create('get_remote_stat', $_) for @hosts; push @threads, threads->create('display_stats'); while () { -- cgit v1.2.3