--- loncom/cgi/clusterstatus.pl 2003/08/01 14:47:44 1.13
+++ loncom/cgi/clusterstatus.pl 2003/08/05 12:52:23 1.15
@@ -3,7 +3,7 @@ $|=1;
# The LearningOnline Network with CAPA
# Cluster Status
#
-# $Id: clusterstatus.pl,v 1.13 2003/08/01 14:47:44 www Exp $
+# $Id: clusterstatus.pl,v 1.15 2003/08/05 12:52:23 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) = @_;
@@ -62,7 +63,7 @@ sub request {
$reply='local_unknown';
} else {
- my $ua=new LWP::UserAgent(timeout => 15);
+ my $ua=new LWP::UserAgent(timeout => 10);
my $request=new HTTP::Request('GET',
"http://".$hostname{$local}.$url);
@@ -92,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.95) { return 'not_yet'; }
+ unless (($concount<=5) || (rand>0.95)) {
+ return 'not_yet';
+ } else {
+ $concount++;
+ }
}
#
# Actually do the query
@@ -200,6 +206,10 @@ ENDHEADER
print ("
$trouble |
");
}
print "";
+# version
+ if ($host{$local.'_version'}) {
+ print " Version: ".$host{$local.'_version'}
+ }
# load
if (($host{$local.'_load_doomed'}>0.5) || ($mode eq 'load_doomed')) {
print " Load: ".$host{$local.'_load'}
@@ -387,6 +397,15 @@ foreach $local (sort keys %hostname) {
$host{$local.'_errors'}=$loncron{'errors'};
}
}
+# -- Check version
+ &statuslist($local,'Version');
+ my $version=&request($local,'/lon-status/version.txt',7200);
+ if ($version eq 'local_error') {
+ $host{$local.'_version'}='Could not determine.';
+ $host{$local.'_unresponsive_doomed'}++;
+ } else {
+ $host{$local.'_version'}=$version;
+ }
# -- Check user status
&statuslist($local,'Users');
my %userstatus=&replyhash($local,'/cgi-bin/userstatus.pl?simple',600);
@@ -483,13 +502,27 @@ foreach $local (sort keys %hostname) {
print ' |
'.$local.' | ';
foreach my $remote (sort keys %hostname) {
if ($connectionstatus{$local.'_TO_'.$remote} eq 'not_yet') {
- print 'not yet tested | ';
+ my $cellcolor='#FFFFFF';
+ if ($local eq $remote) { $cellcolor='#DDDDDD'; }
+ print 'not yet tested | ';
} elsif ($connectionstatus{$local.'_TO_'.$remote} eq 'ok') {
+ my $cellcolor='#BBDDBB';
+ if ($local eq $remote) { $cellcolor='#99DD99'; }
print
-'ok | ';
+'ok | ';
} else {
+ my $cellcolor='#DDBBBB';
+ if ($connectionstatus{$local.'_TO_'.$remote} eq 'local_error') {
+ if ($local eq $remote) {
+ $cellcolor='#DD88AA';
+ } else {
+ $cellcolor='#DDAACC';
+ }
+ } else {
+ if ($local eq $remote) { $cellcolor='#DD9999'; }
+ }
print
- ''.
+ ' | '.
$connectionstatus{$local.'_TO_'.$remote}.' ';
&lonc($local); &lond($remote);
print ' | ';
@@ -550,6 +583,9 @@ foreach $local (sort keys %hostname) {
my $count=0;
foreach $local (sort keys %hostname) {
my $trouble='';
+ if ($host{$local.'_unresponsive_doomed'}>3) {
+ $trouble='Does not respond to several queries.
';
+ }
if ($host{$local.'_errors'}) {
$trouble='Has loncron errors.
';
} elsif ($host{$local.'_loncron_doomed'}>600) {
---|