Annotation of loncom/debugging_tools/get_all_active.pl, revision 1.1
1.1 ! albertel 1: open(HOST,"<$ARGV[0]");
! 2: my $i++;
! 3: my $msu_total=0;
! 4: my $total=0;
! 5: my %total;
! 6: my %done;
! 7: while(my $line=<HOST>) {
! 8: if ($line=~/^\#/) { next; }
! 9: my ($domain,$host)=(split(':',$line))[1,3];
! 10: chomp($host);
! 11: if (!$host || exists($done{$host})) { next; }
! 12: $done{$host}=1;
! 13: print($host." -> ");
! 14: my $result=`curl --user lonadm:litelite -m 5 -s http://$host/cgi-bin/userstatus.pl?simple`;
! 15: my ($count)= ($result=~/\&Active=(\d+)\&/);
! 16: print($count."\n");
! 17: $total+=$count;
! 18: if ($domain eq 'msu') { $msu_total+=$count; }
! 19: $total{$domain}+=$count;
! 20: # if ($i++==14) { last; }
! 21: }
! 22:
! 23: print("\n Total\t= $total\n");
! 24: print("\n MSU Total\t= $msu_total\n");
! 25: open(LOG,">>$ARGV[1]");
! 26: print LOG (time." $total ");
! 27: print(time." $total ");
! 28: foreach my $domain (sort(keys(%total))) {
! 29: print LOG ("$domain $total{$domain} ");
! 30: print ("$domain $total{$domain} \n");
! 31: }
! 32: print LOG ("\n");
! 33: print("\n");
! 34: close(LOG);
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>