[LON-CAPA-cvs] cvs: loncom /cgi clusterstatus.pl
www
lon-capa-cvs@mail.lon-capa.org
Fri, 01 Aug 2003 19:20:26 -0000
www Fri Aug 1 15:20:26 2003 EDT
Modified files:
/loncom/cgi clusterstatus.pl
Log:
* Making timeout even smaller. If 10 secs are not enough, there is some
trouble - which is the thing we want to detect
* Always deal with 5 connections - makes no difference in the beginning,
but makes sure that the final obnoxious holes get filed up towards the
end
* Make diagonal (connections to self) better visible in connections matrix
Index: loncom/cgi/clusterstatus.pl
diff -u loncom/cgi/clusterstatus.pl:1.13 loncom/cgi/clusterstatus.pl:1.14
--- loncom/cgi/clusterstatus.pl:1.13 Fri Aug 1 10:47:44 2003
+++ loncom/cgi/clusterstatus.pl Fri Aug 1 15:20:26 2003
@@ -3,7 +3,7 @@
# 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.14 2003/08/01 19:20:26 www Exp $
use lib '/home/httpd/lib/perl/';
use LONCAPA::Configuration;
@@ -19,6 +19,7 @@
my %perlvar=();
my $mode;
+my $concount=0;
sub select_form {
my ($def,$name,%hash) = @_;
@@ -62,7 +63,7 @@
$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 @@
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
@@ -483,13 +489,27 @@
print '<tr><th bgcolor="#DDDDBB">'.$local.'</th>';
foreach my $remote (sort keys %hostname) {
if ($connectionstatus{$local.'_TO_'.$remote} eq 'not_yet') {
- print '<td bgcolor="#FFFFFF"><font color="#555522" size="-2">not yet tested</font></td>';
+ my $cellcolor='#FFFFFF';
+ if ($local eq $remote) { $cellcolor='#DDDDDD'; }
+ print '<td bgcolor="'.$cellcolor.'"><font color="#555522" size="-2">not yet tested</font></td>';
} elsif ($connectionstatus{$local.'_TO_'.$remote} eq 'ok') {
+ my $cellcolor='#BBDDBB';
+ if ($local eq $remote) { $cellcolor='#99DD99'; }
print
-'<td bgcolor="#BBDDBB"><font color="#225522" face="arial"><b>ok</b></td>';
+'<td bgcolor="'.$cellcolor.'"><font color="#225522" face="arial"><b>ok</b></td>';
} 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
- '<td bgcolor="#DDBBBB"><font color="#552222" size="-2">'.
+ '<td bgcolor="'.$cellcolor.'"><font color="#552222" size="-2">'.
$connectionstatus{$local.'_TO_'.$remote}.'<br />';
&lonc($local); &lond($remote);
print '</td>';