Diff for /loncom/loncron between versions 1.125 and 1.127

version 1.125, 2021/01/30 21:26:04 version 1.127, 2021/02/02 20:53:05
Line 46  use GDBM_File; Line 46  use GDBM_File;
 use Storable qw(thaw);  use Storable qw(thaw);
 use File::ReadBackwards;  use File::ReadBackwards;
 use File::Copy;  use File::Copy;
   use GDBM_File qw(GDBM_READER);
   use Storable qw(thaw nfreeze);
 use Sys::Hostname::FQDN();  use Sys::Hostname::FQDN();
   
 #globals  #globals
Line 231  sub log_machine_info { Line 233  sub log_machine_info {
     &log($fh,'<hr /><a name="machine" /><h2>Machine Information</h2>');      &log($fh,'<hr /><a name="machine" /><h2>Machine Information</h2>');
     &log($fh,"<h3>loadavg</h3>");      &log($fh,"<h3>loadavg</h3>");
   
       my $cpucount;
       if (open(PIPE,"lscpu |grep '^CPU(s)' 2>&1 |")) {
           my $info = <PIPE>;
           chomp($info);
           ($cpucount) = ($info =~ /^\QCPU(s):\E\s+(\d+)$/);
           close(PIPE);
       }
       if (!$cpucount) {
           $cpucount = 1;
       }
       my %loadtarget = (
                           error => 4.0*$cpucount,
                           warn  => 2.0*$cpucount,
                           note  => 1.0*$cpucount,
                        );
     open (LOADAVGH,"/proc/loadavg");      open (LOADAVGH,"/proc/loadavg");
     my $loadavg=<LOADAVGH>;      my $loadavg=<LOADAVGH>;
     close (LOADAVGH);      close (LOADAVGH);
Line 238  sub log_machine_info { Line 255  sub log_machine_info {
     &log($fh,"<tt>$loadavg</tt>");      &log($fh,"<tt>$loadavg</tt>");
   
     my @parts=split(/\s+/,$loadavg);      my @parts=split(/\s+/,$loadavg);
     if ($parts[1]>4.0) {      if ($parts[1]>$loadtarget{'error'}) {
  $errors++;   $errors++;
     } elsif ($parts[1]>2.0) {      } elsif ($parts[1]>$loadtarget{'warn'}) {
  $warnings++;   $warnings++;
     } elsif ($parts[1]>1.0) {      } elsif ($parts[1]>$loadtarget{'note'}) {
  $notices++;   $notices++;
     }      }
   

Removed from v.1.125  
changed lines
  Added in v.1.127


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>