use gnt-node to get list of nodes
authorDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 28 Jan 2015 19:23:19 +0000 (20:23 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 28 Jan 2015 19:23:19 +0000 (20:23 +0100)
gnt-i

diff --git a/gnt-i b/gnt-i
index 19beadc..918ee48 100755 (executable)
--- a/gnt-i
+++ b/gnt-i
@@ -15,10 +15,14 @@ my $stat;
 my $mac_to_name;
 my $lines;
 
-next_argv:
+my @nodes = @ARGV;
+
+@nodes = map { chomp ; $_ } `gnt-node list -o name --no-header` unless @nodes;
+
+next_node:
 my $ssh = '';
-if ( @ARGV ) {
-       $hostname = shift @ARGV;
+if ( @nodes ) {
+       $hostname = shift @nodes;
        $ssh = "ssh $hostname ";
 }
 
@@ -99,7 +103,7 @@ while(<$ip>) {
        }
 }
 
-goto next_argv if @ARGV;
+goto next_node if @nodes;
 
 warn "# stat ", Dumper( $stat ) if $DEBUG;
 XXX( @ps_cols );