--- loncom/cgi/clusterstatus.pl 2003/07/31 16:07:47 1.10 +++ loncom/cgi/clusterstatus.pl 2003/08/01 19:20:26 1.14 @@ -3,7 +3,7 @@ $|=1; # The LearningOnline Network with CAPA # Cluster Status # -# $Id: clusterstatus.pl,v 1.10 2003/07/31 16:07:47 www Exp $ +# $Id: clusterstatus.pl,v 1.14 2003/08/01 19:20:26 www Exp $ use lib '/home/httpd/lib/perl/'; use LONCAPA::Configuration; @@ -19,6 +19,7 @@ my %connectionstatus=(); my %perlvar=(); my $mode; +my $concount=0; sub select_form { my ($def,$name,%hash) = @_; @@ -47,6 +48,7 @@ sub hidden { sub request { my ($local,$url,$cachetime)=@_; + $cachetime*=(0.5+rand); my $key=&key($local,$url); my $reply=''; if ($FORM{$key.'_time'}) { @@ -61,7 +63,7 @@ sub request { $reply='local_unknown'; } else { - my $ua=new LWP::UserAgent(timeout => 20); + my $ua=new LWP::UserAgent(timeout => 10); my $request=new HTTP::Request('GET', "http://".$hostname{$local}.$url); @@ -91,10 +93,15 @@ sub connected { unless ($hostname{$remote}) { return 'remote_unknown'; } my $url='/cgi-bin/ping.pl?'.$remote; # -# Slowly phase this in: if not cached, only do 10 percent of the cases +# Slowly phase this in: if not cached, only do 5 percent of the cases, +# but always do the first five. # unless ($FORM{&key($local,$url)}) { - unless (rand>0.9) { return 'not_yet'; } + unless (($concount<=5) || (rand>0.95)) { + return 'not_yet'; + } else { + $concount++; + } } # # Actually do the query @@ -169,11 +176,23 @@ sub server { print &otherwindow($local,'/server-status','Server Status'); } +# ========================================================= Produce a green bar +sub bar { + my $parm=shift; + my $number=int($parm+0.5); + print "
"; + for (my $i=0;$i<$number;$i++) { + print "+"; + } + print " |
$local $hostdom{$local} ($hostname{$local}; $hostrole{$local}) @@ -182,7 +201,11 @@ $local $hostdom{$local} ($hostna ENDHEADER &login($local);&server($local);&users($local);&versions($local); &loncron($local);&lond($local);&lonc($local);&runloncron($local); - print " |
"; + print " |
$trouble |
";
# load
if (($host{$local.'_load_doomed'}>0.5) || ($mode eq 'load_doomed')) {
print " Load: ".$host{$local.'_load'} @@ -200,6 +223,19 @@ ENDHEADER if ($host{$local.'_mysql'}) { print " MySQL Database: ".$host{$local.'_mysql'} } +# connections + if ($host{$local.'_notconnected'}) { + print " Not connected: "; + foreach (split(/ /,$host{$local.'_notconnected'})) { + if ($_) { + print " $_"; + } + } + } +# errors + if ($host{$local.'_errors'}) { + print " loncron errors: ".$host{$local.'_errors'}; + } print " |