summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpbuetow (lxpbuetow) <puppet@mx.buetow.org>2011-12-27 12:24:50 +0100
committerpbuetow (lxpbuetow) <puppet@mx.buetow.org>2011-12-27 12:24:50 +0100
commitec28b82ecbd459e240559f05ac989473d1ede8cd (patch)
tree1ad7248ce1e5b45b9664f0931dc2c5eed77490a3
parent71658348127f1364ac278bf189edc786da384ecb (diff)
New nice stuff
-rw-r--r--CHANGELOG10
-rwxr-xr-xloadbars21
2 files changed, 22 insertions, 9 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 928caba..2cc4235 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,13 @@
+* --cluster option (which reads the ClusterSSH config file /etc/clusters/)
+ also supports clusters of clusters. e.g.:
+ $ cat /etc/clusters
+ clusterA server01 server02
+ clusterB clusterA server03
+ So --cluster clusterB will connect to server01 server02 and server03
+* --hosts option supports username to be specified. E.g.:
+ # ./loadbars --hosts user1@server01,user2@server02
+ will connect to server01 using user1 and server02 with user2.
+
Mon Dec 26 14:46:25 CET 2011
* Released v0.3.0
* Peak CPU load is not displayed by default anymore. User 'p' command or
diff --git a/loadbars b/loadbars
index 8d80c1d..70df6e8 100755
--- a/loadbars
+++ b/loadbars
@@ -93,8 +93,9 @@ sub parse_cpu_line ($) {
return ($name, \%load);
}
-sub thread_get_stats ($) {
- my $host = shift;
+sub thread_get_stats ($;$) {
+ my ($host, $user) = @_;
+ $user = defined $user ? "-l $user" : '';
my ($sigusr1, $quit) = (0, 0);
my $loadavgexp = qr/(\d+\.\d{2}) (\d+\.\d{2}) (\d+\.\d{2})/;
@@ -120,8 +121,10 @@ sub thread_get_stats ($) {
done
fi
BASH
+
+
my $cmd = $host eq 'localhost' ? $bash
- : "ssh -o StrictHostKeyChecking=no $C{sshopts} $host '$bash'";
+ : "ssh $user -o StrictHostKeyChecking=no $C{sshopts} $host '$bash'";
my $pid = open my $pipe, "$cmd |" or do {
say "Warning: $!";
@@ -212,7 +215,7 @@ sub create_threads (@) {
$_;
} map {
- threads->create('thread_get_stats', $_);
+ threads->create('thread_get_stats', split /:/);
} @_;
}
@@ -220,14 +223,11 @@ sub create_threads (@) {
sub main_loop ($@) {
my ($dispatch, @threads) = @_;
- # Planned for the future
- my $statusbar_height = 0;
-
my $app = SDL::App->new(
-title => $C{title},
-icon_title => $C{title},
-width => $C{width},
- -height => $C{height}+$statusbar_height,
+ -height => $C{height},
-depth => Loadbars::DEPTH,
-resizeable => 0,
);
@@ -737,7 +737,10 @@ sub main () {
set_togglecpu_regexp;
- my @hosts = split ',', $$hosts;
+ my @hosts = map {
+ my ($a, $b) = split /\@/, $_;
+ defined $b ? "$b:$a" : $a;
+ } split ',', $$hosts;
if (@hosts || defined $C{cluster}) {
push @hosts, get_cluster_hosts $C{cluster} if defined $C{cluster};