--- loncom/cgi/clusterstatus.pl 2008/12/25 01:56:03 1.26
+++ loncom/cgi/clusterstatus.pl 2014/05/28 18:16:09 1.28
@@ -1,7 +1,7 @@
#!/usr/bin/perl
$|=1;
# Generates a html page showing various status reports about the domain or cluster
-# $Id: clusterstatus.pl,v 1.26 2008/12/25 01:56:03 raeburn Exp $
+# $Id: clusterstatus.pl,v 1.28 2014/05/28 18:16:09 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -165,7 +165,7 @@ sub connected {
#
# Actually do the query
#
- &statuslist($local,'connecting '.$remote);
+ &statuslist($local,&mt('connecting [_1]',$remote),1);
my $reply=&request($local,$url,3600);
$reply=(split("\n",$reply))[0];
$reply=~s/\W//g;
@@ -260,13 +260,15 @@ sub reroute {
sub allreroutes {
my $local=shift;
&takeoffline($local);
- print(&Apache::lonlocal::mt('Reroute to:').' ');
- foreach my $remote (sort keys %hostname) {
+ my $reroute;
+ foreach my $remote (sort(keys(%hostname))) {
unless ($local eq $remote) {
- &reroute($local,$remote);
+ $reroute .= &reroute($local,$remote);
}
}
- print('');
+ if ($reroute) {
+ print(&Apache::lonlocal::mt('Reroute to:').' '.$reroute.'');
+ }
}
# ========================================================= Produce a green bar
@@ -295,7 +297,7 @@ sub serverstatus {
vers => 'Version:',
load => 'Load:',
acti => 'Active Users:',
- rpms => 'RPMs',
+ rpms => 'RPMs:',
mysq => 'MySQL Database:',
notc => 'Not connected',
lonc => 'loncron errors',
@@ -652,13 +654,18 @@ sub reports {
# ====================================================================== Status
sub statuslist {
- my ($local,$what)=@_;
+ my ($local,$what,$nomt)=@_;
my $displaylocal;
if (defined($local)) {
$displaylocal = " $local ($hostname{$local})";
}
- print ''."\n";
+ my $output = &Apache::lonlocal::mt('Testing[_1]:',$displaylocal).' ';
+ if ($nomt) {
+ $output .= $what;
+ } else {
+ $output .= &Apache::lonlocal::mt($what);
+ }
+ print ''."\n";
}
# =============================================================================
@@ -740,8 +747,22 @@ if ($Apache::lonnet::env{'request.role'}
%hostname = %allhostname;
$scope = 'Cluster';
} else {
+ my $roledom = $env{'request.role.domain'};
+ if ((!$roledom) || ($roledom eq 'public')) {
+ print &LONCAPA::lonauthcgi::unauthorized_msg('clusterstatus');
+ exit;
+ }
undef(%hostname);
my @poss_domains = &Apache::lonnet::current_machine_domains();
+ if (!grep(/^\Q$roledom\E$/,@poss_domains)) {
+ my $home = &Apache::lonnet::domain($roledom,'primary');
+ print &LONCAPA::lonauthcgi::unauthorized_msg('clusterstatus');
+ print '
'.&mt("You need to select a role in this server's domain ([_1]) to display domain status for this server and other servers in the domain.",$roledom).'
';
+ if ($home) {
+ print ''.&mt("Alternatively, you'll need to [_1]switch server[_2] to display domain status for servers in the domain of your current role ([_3]).",'','',$roledom).'/span>';
+ }
+ exit;
+ }
foreach my $host (keys(%allhostname)) {
if (grep(/^\Q$hostdom{$host}\E$/,@poss_domains)) {
$hostname{$host} = $allhostname{$host};
@@ -760,10 +781,10 @@ print &Apache::lonlocal::mt('Choose next
if (!$FORM{'runonetime'}) {
my $lcscope = lc($scope);
print ''.&Apache::lonlocal::mt("Gathering initial $lcscope data").'
'.
- &Apache::lonlocal::mt('This may take some time ..').'
';
+ &Apache::lonlocal::mt('This may take some time ...').'
';
$fromcache=0;
&mainloop();
- &statuslist(undef,'Done initial run.');
+ &statuslist(undef,'Done initial run');
&reports();
} else {
$fromcache=1;
@@ -776,7 +797,7 @@ print &Apache::lonlocal::mt('Choose next
&hidden('runonetime',1);
print '
'.&Apache::lonlocal::mt('Total number of queries: [_1]',$stat_total);
if ($stat_total != 0) {
- print '
'.&Apache::lonlocal::mt('Percent complete:').''.
+ print '
'.&Apache::lonlocal::mt('Percent complete:').' '.
int(($stat_total-$stat_notyet)/$stat_total*100.).
'
'.&Apache::lonlocal::mt('Percent from cache:').' '.
int($stat_fromcache/$stat_total*100.).'';