From 4358907c9cfb76be59d4f33dea7d8ec996ce768f Mon Sep 17 00:00:00 2001 From: "Paul Buetow (mars)" Date: Mon, 26 Dec 2011 15:03:31 +0100 Subject: Merge back CHANGELOG from master --- CHANGELOG | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 5b4e3b0..928caba 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,12 @@ +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 + the --togglepeak 1 startup option. +* Peak CPU load is now also displayd in text format (marked as pk) +* New option --cluster which brings rudimentary ClusterSSH config file + support. E.g. './loadbars --cluster server' reads cluster server from + the /etc/clusters file. + Sat Nov 19 11:54:51 CET 2011 * Released v0.2.2 * Added a 1px horizontal line to each bar which represent the max. peak -- cgit v1.2.3 From 2e4329ceec29f9ca1ad9347268a0d76f1446a260 Mon Sep 17 00:00:00 2001 From: "Paul Buetow (mars)" Date: Mon, 26 Dec 2011 15:04:07 +0100 Subject: It is now -devel --- loadbars | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/loadbars b/loadbars index b212f5c..fd31091 100755 --- a/loadbars +++ b/loadbars @@ -25,8 +25,8 @@ use threads; use threads::shared; use constant { - DEPTH => 8, - VERSION => 'loadbars v0.3.0', + DEPTH => 8, + VERSION => 'loadbars v0.3.1-devel', Copyright => '2010-2011 (c) Paul Buetow ', BLACK => SDL::Color->new(-r => 0x00, -g => 0x00, -b => 0x00), BLUE => SDL::Color->new(-r => 0x00, -g => 0x00, -b => 0xff), -- cgit v1.2.3 From 7749c8604f72b3b4cd62a9cfa16142c685d449cd Mon Sep 17 00:00:00 2001 From: "Paul Buetow (mars)" Date: Mon, 26 Dec 2011 15:18:08 +0100 Subject: Support for aliases in /etc/clusters. E.g. clusters of clusters --- loadbars | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/loadbars b/loadbars index fd31091..83cd241 100755 --- a/loadbars +++ b/loadbars @@ -28,6 +28,8 @@ use constant { DEPTH => 8, VERSION => 'loadbars v0.3.1-devel', Copyright => '2010-2011 (c) Paul Buetow ', + CSSH_CONFFILE => '/etc/clusters', + CSSH_MAX_RECURSION => 10, BLACK => SDL::Color->new(-r => 0x00, -g => 0x00, -b => 0x00), BLUE => SDL::Color->new(-r => 0x00, -g => 0x00, -b => 0xff), GREEN => SDL::Color->new(-r => 0x00, -g => 0x90, -b => 0x00), @@ -686,11 +688,19 @@ END return (\$hosts, $closure); } -sub get_cluster_hosts ($) { - my $cluster = shift; - my $confile = '/etc/clusters'; +# Recursuve function +sub get_cluster_hosts ($;$); +sub get_cluster_hosts ($;$) { + my ($cluster, $recursion) = @_; - open my $fh, $confile or error "$!: $confile"; + unless (defined $recursion) { + $recursion = 1; + + } elsif ($recursion > CSSH_MAX_RECURSION) { + error "CSSH_MAX_RECURSION reached. Infinite circle loop in " . CSSH_CONFFILE . "?"; + } + + open my $fh, CSSH_CONFFILE or error "$!: " . CSSH_CONFFILE; my $hosts; while (<$fh>) { @@ -702,9 +712,16 @@ sub get_cluster_hosts ($) { close $fh; - error "No such cluster in $confile: $cluster" unless defined $hosts; + unless (defined $hosts) { + error "No such cluster in " . CSSH_CONFFILE . ": $cluster" + unless defined $recursion; + + return ($cluster); + } - return split /\s+/, $hosts; + my @hosts; + push @hosts, get_cluster_hosts $_, ($recursion + 1) for (split /\s+/, $hosts); + return @hosts; } sub main () { -- cgit v1.2.3 From 71658348127f1364ac278bf189edc786da384ecb Mon Sep 17 00:00:00 2001 From: "pbuetow (lxpbuetow)" Date: Tue, 27 Dec 2011 10:24:06 +0100 Subject: Default height is now 150 --- loadbars | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loadbars b/loadbars index 83cd241..8d80c1d 100755 --- a/loadbars +++ b/loadbars @@ -72,7 +72,7 @@ my %C : shared; samples => 1000, sshopts => '', width => 1250, - height => 200, + height => 150, ); # Quick n dirty helpers -- cgit v1.2.3 From ec28b82ecbd459e240559f05ac989473d1ede8cd Mon Sep 17 00:00:00 2001 From: "pbuetow (lxpbuetow)" Date: Tue, 27 Dec 2011 12:24:50 +0100 Subject: New nice stuff --- CHANGELOG | 10 ++++++++++ loadbars | 21 ++++++++++++--------- 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}; -- cgit v1.2.3 From 578c3a4320ec746978089cb770187934d38f767e Mon Sep 17 00:00:00 2001 From: "pbuetow (lxpbuetow)" Date: Tue, 27 Dec 2011 12:26:24 +0100 Subject: New wishlist brainstorming --- WISHLIST | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WISHLIST b/WISHLIST index 46f1d9f..9a9ee12 100644 --- a/WISHLIST +++ b/WISHLIST @@ -1,5 +1,5 @@ -* Stats for other stuff (e.g. memory, inodes..., disk usage) +* Stats for memory +* Stats for network * Dynamic/online resizing of the window * Adding and removing hosts online * .deb for Debian and Ubuntu -* Allow sshusername@hostname in --hosts -- cgit v1.2.3 From dddacc0f9f02f40541db17d787642319e736e4ce Mon Sep 17 00:00:00 2001 From: "pbuetow (lxpbuetow)" Date: Tue, 27 Dec 2011 12:28:55 +0100 Subject: Releases v0.3.1 --- CHANGELOG | 2 ++ loadbars | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 2cc4235..c50f79d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +Tue Dec 27 12:28:40 CET 2011 +* Released v0.3.1 * --cluster option (which reads the ClusterSSH config file /etc/clusters/) also supports clusters of clusters. e.g.: $ cat /etc/clusters diff --git a/loadbars b/loadbars index 70df6e8..1995bb0 100755 --- a/loadbars +++ b/loadbars @@ -26,7 +26,7 @@ use threads::shared; use constant { DEPTH => 8, - VERSION => 'loadbars v0.3.1-devel', + VERSION => 'loadbars v0.3.1', Copyright => '2010-2011 (c) Paul Buetow ', CSSH_CONFFILE => '/etc/clusters', CSSH_MAX_RECURSION => 10, -- cgit v1.2.3