[LON-CAPA-cvs] cvs: loncom /debugging_tools get_active.pl

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 07 Sep 2005 18:24:04 -0000


albertel		Wed Sep  7 14:24:04 2005 EDT

  Added files:                 
    /loncom/debugging_tools	get_active.pl 
  Log:
  - script for quickly getting number of users across the cluster (and msu specifically)
  
  
  

Index: loncom/debugging_tools/get_active.pl
+++ loncom/debugging_tools/get_active.pl
open(HOST,"<$ARGV[0]");
my $i++;
my $msu_total=0;
my $total=0;
my %done;
while(my $line=<HOST>) {
    if ($line=~/^\#/) { next; }
    my ($domain,$host)=(split(':',$line))[1,3];
    chomp($host);
    if (!$host || exists($done{$host})) { next; }
    $done{$host}=1;
    print($host." -> ");
    my $result=`curl --user lonadm:litelite --connect-timeout 5 -s http://$host/cgi-bin/userstatus.pl?simple`;
    my ($count)= ($result=~/\&Active=(\d+)\&/);
    print($count."\n");
    $total+=$count;
    if ($domain eq 'msu') { $msu_total+=$count; }
#    if ($i++==14) { last; }
}

print("\n Total\t= $total\n");
print("\n MSU Total\t= $msu_total\n");
open(LOG,">>$ARGV[1]");
print LOG (time." $total $msu_total\n");