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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 14 Oct 2005 15:13:43 -0000


albertel		Fri Oct 14 11:13:43 2005 EDT

  Added files:                 
    /loncom/debugging_tools	get_all_active.pl 
  Log:
  - does all domains 
  
  

Index: loncom/debugging_tools/get_all_active.pl
+++ loncom/debugging_tools/get_all_active.pl
open(HOST,"<$ARGV[0]");
my $i++;
my $msu_total=0;
my $total=0;
my %total;
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 -m 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; }
    $total{$domain}+=$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 ");
print(time." $total ");
foreach my $domain (sort(keys(%total))) {
	print LOG ("$domain $total{$domain} ");
	print ("$domain $total{$domain} \n");
}
print LOG ("\n");
print("\n");
close(LOG);