--- loncom/cgi/clusterstatus.pl 2003/08/05 12:52:23 1.15 +++ loncom/cgi/clusterstatus.pl 2003/08/29 17:42:32 1.20 @@ -3,10 +3,11 @@ $|=1; # The LearningOnline Network with CAPA # Cluster Status # -# $Id: clusterstatus.pl,v 1.15 2003/08/05 12:52:23 www Exp $ +# $Id: clusterstatus.pl,v 1.20 2003/08/29 17:42:32 www Exp $ use lib '/home/httpd/lib/perl/'; use LONCAPA::Configuration; +use strict; use LWP::UserAgent(); use HTTP::Headers; @@ -20,6 +21,31 @@ my %perlvar=(); my $mode; my $concount=0; +my $fromcache; + +my %domaindescription = (); +my %domain_auth_def = (); +my %domain_auth_arg_def = (); +my %domain_lang_def=(); +my %domain_city=(); +my %domain_longi=(); +my %domain_lati=(); + +my %hostname=(); +my %hostip=(); +my %hostdom=(); +my %hostrole=(); +my %libserv=(); + +my $maxusers=0; +my $maxload=0; +my $totalusers=0; + +my %FORM=(); + +my $stat_total=0; +my $stat_notyet=0; +my $stat_fromcache=0; sub select_form { my ($def,$name,%hash) = @_; @@ -51,11 +77,23 @@ sub request { $cachetime*=(0.5+rand); my $key=&key($local,$url); my $reply=''; + $stat_total++; +# if fromcache flag is set, only return cached values + if ($fromcache) { + if ($FORM{$key.'_time'}) { + return $FORM{$key}; + $stat_fromcache++; + } else { + return 'not_yet'; + $stat_notyet++; + } + } +# normal mode, refresh when expired or not yet present if ($FORM{$key.'_time'}) { if ((time-$FORM{$key.'_time'})<$cachetime) { $reply=$FORM{$key}; &hidden($key.'_time',$FORM{$key.'_time'}); - &hidden($key.'_fromcache',1); + $stat_fromcache++; } } unless ($reply) { @@ -97,7 +135,9 @@ sub connected { # but always do the first five. # unless ($FORM{&key($local,$url)}) { - unless (($concount<=5) || (rand>0.95)) { + unless (($concount<=5) || (rand>0.95)) { + $stat_total++; + $stat_notyet++; return 'not_yet'; } else { $concount++; @@ -176,6 +216,11 @@ sub server { print &otherwindow($local,'/server-status','Server Status'); } +sub announcement { + my $local=shift; + print &otherwindow($local,'/announcement.txt','Announcement'); +} + # ========================================================= Produce a green bar sub bar { my $parm=shift; @@ -197,9 +242,11 @@ sub serverstatus {