version 1.53, 2004/06/09 13:30:41
|
version 1.58, 2005/04/13 18:56:07
|
Line 114 sub checkon_daemon {
|
Line 114 sub checkon_daemon {
|
my ($fh,$daemon,$maxsize,$sendusr1,$args)=@_; |
my ($fh,$daemon,$maxsize,$sendusr1,$args)=@_; |
|
|
&log($fh,'<hr /><a name="'.$daemon.'" /><h2>'.$daemon.'</h2><h3>Log</h3><p style="white-space: pre;"><tt>'); |
&log($fh,'<hr /><a name="'.$daemon.'" /><h2>'.$daemon.'</h2><h3>Log</h3><p style="white-space: pre;"><tt>'); |
printf("%-10s ",$daemon); |
printf("%-15s ",$daemon); |
if (-e "$perlvar{'lonDaemons'}/logs/$daemon.log"){ |
if (-e "$perlvar{'lonDaemons'}/logs/$daemon.log"){ |
open (DFH,"tail -n25 $perlvar{'lonDaemons'}/logs/$daemon.log|"); |
open (DFH,"tail -n25 $perlvar{'lonDaemons'}/logs/$daemon.log|"); |
while (my $line=<DFH>) { |
while (my $line=<DFH>) { |
Line 152 sub checkon_daemon {
|
Line 152 sub checkon_daemon {
|
if ($restartflag==1) { |
if ($restartflag==1) { |
$simplestatus{$daemon}='off'; |
$simplestatus{$daemon}='off'; |
$errors++; |
$errors++; |
|
my $kadaemon=$daemon; |
|
if ($kadaemon eq 'lonmemcached') { $kadaemon='memcached'; } |
&log($fh,'<br><font color="red">Killall '.$daemon.': '. |
&log($fh,'<br><font color="red">Killall '.$daemon.': '. |
`killall $daemon 2>&1`.' - '); |
`killall $kadaemon 2>&1`.' - '); |
sleep 2; |
sleep 2; |
&log($fh,unlink($pidfile).' - '. |
&log($fh,unlink($pidfile).' - '. |
`killall -9 $daemon 2>&1`. |
`killall -9 $kadaemon 2>&1`. |
'</font><br>'); |
'</font><br>'); |
&log($fh,"<h3>$daemon not running, trying to start</h3>"); |
&log($fh,"<h3>$daemon not running, trying to start</h3>"); |
|
|
Line 463 sub test_connections {
|
Line 465 sub test_connections {
|
foreach my $tryserver (sort(keys(%{$hostname}))) { |
foreach my $tryserver (sort(keys(%{$hostname}))) { |
print("."); |
print("."); |
my $result; |
my $result; |
my $answer=reply("pong",$tryserver); |
my $answer=reply("ping",$tryserver); |
if ($answer eq "$tryserver:$perlvar{'lonHostID'}") { |
if ($answer eq "$tryserver:$perlvar{'lonHostID'}") { |
$result="<b>ok</b>"; |
$result="<b>ok</b>"; |
$good++; |
$good++; |
Line 554 sub log_simplestatus {
|
Line 556 sub log_simplestatus {
|
sub send_mail { |
sub send_mail { |
print "sending mail\n"; |
print "sending mail\n"; |
my $emailto="$perlvar{'lonAdmEMail'}"; |
my $emailto="$perlvar{'lonAdmEMail'}"; |
if ($totalcount>1000) { |
if ($totalcount>2500) { |
$emailto.=",$perlvar{'lonSysEMail'}"; |
$emailto.=",$perlvar{'lonSysEMail'}"; |
} |
} |
my $subj="LON: $perlvar{'lonHostID'} E:$errors W:$warnings N:$notices"; |
my $subj="LON: $perlvar{'lonHostID'} E:$errors W:$warnings N:$notices"; |
|
|
my $result=system("metasend -b -t $emailto -s '$subj' -f $statusdir/index.html -m text/html >& /dev/null"); |
my $result=system("metasend -b -S 4000000 -t $emailto -s '$subj' -f $statusdir/index.html -m text/html >& /dev/null"); |
if ($result != 0) { |
if ($result != 0) { |
$result=system("mail -s '$subj' $emailto < $statusdir/index.html"); |
$result=system("mail -s '$subj' $emailto < $statusdir/index.html"); |
} |
} |
Line 633 sub main () {
|
Line 635 sub main () {
|
my (%hostname,%hostdom,%hostrole,%spareid); |
my (%hostname,%hostdom,%hostrole,%spareid); |
while (my $configline=<$config>) { |
while (my $configline=<$config>) { |
next if ($configline =~ /^(\#|\s*\$)/); |
next if ($configline =~ /^(\#|\s*\$)/); |
my ($id,$domain,$role,$name,$ip,$domdescr)=split(/:/,$configline); |
my ($id,$domain,$role,$name)=split(/:/,$configline); |
if ($id && $domain && $role && $name && $ip) { |
if ($id && $domain && $role && $name) { |
|
$name=~s/\s//g; |
$hostname{$id}=$name; |
$hostname{$id}=$name; |
$hostdom{$id}=$domain; |
$hostdom{$id}=$domain; |
$hostrole{$id}=$role; |
$hostrole{$id}=$role; |
Line 677 sub main () {
|
Line 680 sub main () {
|
if ($oldlonc) { $args = ''; } |
if ($oldlonc) { $args = ''; } |
&checkon_daemon($fh,'lonc',40000,1,$args); |
&checkon_daemon($fh,'lonc',40000,1,$args); |
&checkon_daemon($fh,'lonhttpd',40000); |
&checkon_daemon($fh,'lonhttpd',40000); |
|
&checkon_daemon($fh,'lonmemcached',40000); |
} |
} |
if (!$justcheckdaemons) { |
if (!$justcheckdaemons) { |
&test_connections($fh,\%hostname); |
&test_connections($fh,\%hostname); |