version 1.36, 2003/02/03 18:03:52
|
version 1.41, 2003/07/30 16:49:27
|
Line 131 $date=localtime($now);
|
Line 131 $date=localtime($now);
|
|
|
{ |
{ |
my $fh=IO::File->new(">$statusdir/newstatus.html"); |
my $fh=IO::File->new(">$statusdir/newstatus.html"); |
|
my %simplestatus=(); |
|
|
print $fh (<<ENDHEADERS); |
print $fh (<<ENDHEADERS); |
<html> |
<html> |
Line 216 while ($line=<DFH>) {
|
Line 217 while ($line=<DFH>) {
|
} elsif ($usage>60) { |
} elsif ($usage>60) { |
$notices++; |
$notices++; |
} |
} |
if ($usage>95) { $warnings++; $warnings++ } |
if ($usage>95) { $warnings++; $warnings++; $simplestatus{'diskfull'}++; } |
} |
} |
close (DFH); |
close (DFH); |
print $fh "</pre>"; |
print $fh "</pre>"; |
Line 316 print $fh "</pre>";
|
Line 317 print $fh "</pre>";
|
# ---------------------------------------------------------------------- lonsql |
# ---------------------------------------------------------------------- lonsql |
|
|
my $restartflag=1; |
my $restartflag=1; |
if ($perlvar{'lonRole'} eq "library") { |
|
|
|
print $fh '<hr><a name="lonsql"><h2>lonsql</h2><h3>Log</h3><pre>'; |
print $fh '<hr><a name="lonsql"><h2>lonsql</h2><h3>Log</h3><pre>'; |
print "lonsql\n"; |
print "lonsql\n"; |
if (-e "$perlvar{'lonDaemons'}/logs/lonsql.log"){ |
if (-e "$perlvar{'lonDaemons'}/logs/lonsql.log"){ |
Line 352 if ($perlvar{'lonRole'} eq "library") {
|
Line 351 if ($perlvar{'lonRole'} eq "library") {
|
} |
} |
} |
} |
if ($restartflag==1) { |
if ($restartflag==1) { |
|
$simplestatus{'lonsql'}='off'; |
$errors++; |
$errors++; |
print $fh '<br><font color="red">Killall lonsql: '. |
print $fh '<br><font color="red">Killall lonsql: '. |
system('killall lonsql').' - '; |
system('killall lonsql').' - '; |
Line 371 if ($perlvar{'lonRole'} eq "library") {
|
Line 371 if ($perlvar{'lonRole'} eq "library") {
|
sleep 2; |
sleep 2; |
if (kill 0 => $lonsqlpid) { |
if (kill 0 => $lonsqlpid) { |
print $fh "<h3>lonsql at pid $lonsqlpid responding</h3>"; |
print $fh "<h3>lonsql at pid $lonsqlpid responding</h3>"; |
|
$simplestatus{'lonsql'}='restarted'; |
} else { |
} else { |
$errors++; $errors++; |
$errors++; $errors++; |
print $fh "<h3>lonsql at pid $lonsqlpid not responding</h3>"; |
print $fh "<h3>lonsql at pid $lonsqlpid not responding</h3>"; |
Line 403 if ($perlvar{'lonRole'} eq "library") {
|
Line 404 if ($perlvar{'lonRole'} eq "library") {
|
$atime,$mtime,$ctime, |
$atime,$mtime,$ctime, |
$blksize,$blocks)=stat($fname); |
$blksize,$blocks)=stat($fname); |
|
|
if ($size>40000) { |
if ($size>200000) { |
print $fh "Rotating logs ...<p>"; |
print $fh "Rotating logs ...<p>"; |
rename("$fname.2","$fname.3"); |
rename("$fname.2","$fname.3"); |
rename("$fname.1","$fname.2"); |
rename("$fname.1","$fname.2"); |
Line 411 if ($perlvar{'lonRole'} eq "library") {
|
Line 412 if ($perlvar{'lonRole'} eq "library") {
|
} |
} |
|
|
&errout($fh); |
&errout($fh); |
} |
|
# ------------------------------------------------------------------------ lond |
# ------------------------------------------------------------------------ lond |
|
|
print $fh '<hr><a name="lond"><h2>lond</h2><h3>Log</h3><pre>'; |
print $fh '<hr><a name="lond"><h2>lond</h2><h3>Log</h3><pre>'; |
Line 449 if (-e $londfile) {
|
Line 449 if (-e $londfile) {
|
} |
} |
} |
} |
if ($restartflag==1) { |
if ($restartflag==1) { |
|
$simplestatus{'lond'}='off'; |
$errors++; |
$errors++; |
print $fh '<br><font color="red">Killall lond: '. |
print $fh '<br><font color="red">Killall lond: '. |
system('killall lond').' - '; |
system('killall lond').' - '; |
Line 467 if ($restartflag==1) {
|
Line 468 if ($restartflag==1) {
|
sleep 2; |
sleep 2; |
if (kill 0 => $londpid) { |
if (kill 0 => $londpid) { |
print $fh "<h3>lond at pid $londpid responding</h3>"; |
print $fh "<h3>lond at pid $londpid responding</h3>"; |
|
$simplestatus{'lond'}='restarted'; |
} else { |
} else { |
$errors++; $errors++; |
$errors++; $errors++; |
print $fh "<h3>lond at pid $londpid not responding</h3>"; |
print $fh "<h3>lond at pid $londpid not responding</h3>"; |
Line 545 if (-e $loncfile) {
|
Line 547 if (-e $loncfile) {
|
} |
} |
} |
} |
if ($restartflag==1) { |
if ($restartflag==1) { |
|
$simplestatus{'lonc'}='off'; |
$errors++; |
$errors++; |
print $fh '<br><font color="red">Killall lonc: '. |
print $fh '<br><font color="red">Killall lonc: '. |
system('killall lonc').' - '; |
system('killall lonc').' - '; |
Line 563 if ($restartflag==1) {
|
Line 566 if ($restartflag==1) {
|
sleep 2; |
sleep 2; |
if (kill 0 => $loncpid) { |
if (kill 0 => $loncpid) { |
print $fh "<h3>lonc at pid $loncpid responding</h3>"; |
print $fh "<h3>lonc at pid $loncpid responding</h3>"; |
|
$simplestatus{'lonc'}='restarted'; |
} else { |
} else { |
$errors++; $errors++; |
$errors++; $errors++; |
print $fh "<h3>lonc at pid $loncpid not responding</h3>"; |
print $fh "<h3>lonc at pid $loncpid not responding</h3>"; |
Line 641 if (-e $lonhttpdfile) {
|
Line 645 if (-e $lonhttpdfile) {
|
} |
} |
} |
} |
if ($restartflag==1) { |
if ($restartflag==1) { |
|
$simplestatus{'lonhttpd'}='off'; |
$errors++; |
$errors++; |
print $fh '<br><font color="red">Killall lonhttpd: '. |
print $fh '<br><font color="red">Killall lonhttpd: '. |
system('killall lonhttpd').' - '; |
system('killall lonhttpd').' - '; |
Line 659 if ($restartflag==1) {
|
Line 664 if ($restartflag==1) {
|
sleep 2; |
sleep 2; |
if (kill 0 => $lonhttpdpid) { |
if (kill 0 => $lonhttpdpid) { |
print $fh "<h3>lonhttpd at pid $lonhttpdpid responding</h3>"; |
print $fh "<h3>lonhttpd at pid $lonhttpdpid responding</h3>"; |
|
$simplestatus{'lonhttpd'}='restarted'; |
} else { |
} else { |
$errors++; $errors++; |
$errors++; $errors++; |
print $fh "<h3>lonhttpd at pid $lonhttpdpid not responding</h3>"; |
print $fh "<h3>lonhttpd at pid $lonhttpdpid not responding</h3>"; |
Line 782 $unsend=0;
|
Line 788 $unsend=0;
|
print $fh "Total unsend messages: <b>$unsend</b><p>\n"; |
print $fh "Total unsend messages: <b>$unsend</b><p>\n"; |
$warnings=$warnings+5*$unsend; |
$warnings=$warnings+5*$unsend; |
|
|
|
if ($unsend) { $simplestatus{'unsend'}=$unsend; } |
print $fh "<h3>Outgoing Buffer</h3>"; |
print $fh "<h3>Outgoing Buffer</h3>"; |
|
|
open (DFH,"ls -lF $perlvar{'lonSockDir'}/delayed|"); |
open (DFH,"ls -lF $perlvar{'lonSockDir'}/delayed|"); |
Line 799 $now=time;
|
Line 806 $now=time;
|
$date=localtime($now); |
$date=localtime($now); |
print $fh "<hr>$date ($now)</body></html>\n"; |
print $fh "<hr>$date ($now)</body></html>\n"; |
print "writing done\n"; |
print "writing done\n"; |
|
$fh->close(); |
} |
} |
|
if ($errors) { $simplestatus{'errors'}=$errors; } |
|
if ($warnings) { $simplestatus{'warnings'}=$warnings; } |
|
if ($notices) { $simplestatus{'notices'}=$notices; } |
|
$simplestatus{'time'}=time; |
|
|
rename ("$statusdir/newstatus.html","$statusdir/index.html"); |
rename ("$statusdir/newstatus.html","$statusdir/index.html"); |
|
{ |
|
my $sfh=IO::File->new(">$statusdir/loncron_simple.txt"); |
|
foreach (keys %simplestatus) { |
|
print $sfh $_.'='.$simplestatus{$_}.'&'; |
|
} |
|
print $sfh "\n"; |
|
$sfh->close(); |
|
} |
if ($totalcount>200) { |
if ($totalcount>200) { |
print "mailing\n"; |
print "mailing\n"; |
$emailto="$perlvar{'lonAdmEMail'},$perlvar{'lonSysEMail'}"; |
$emailto="$perlvar{'lonAdmEMail'}"; |
|
if ($totalcount>1000) { |
|
$emailto.=",$perlvar{'lonSysEMail'}"; |
|
} |
$subj="LON: $perlvar{'lonHostID'} E:$errors W:$warnings N:$notices"; |
$subj="LON: $perlvar{'lonHostID'} E:$errors W:$warnings N:$notices"; |
system( |
system( |
"metasend -b -t $emailto -s '$subj' -f $statusdir/index.html -m text/html"); |
"metasend -b -t $emailto -s '$subj' -f $statusdir/index.html -m text/html"); |