summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcpupload.pl10
1 files 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 (<STDIN>) {