This is the Monitor Script

Start a new log: number of rows on the page: Time Interval (approx sec(s)):
#### #!/usr/bin/perl require "cgi-lib.pl"; ReadParse(*in); $goodcolor="GREEN"; $medcolor="ORANGE"; $badcolor="RED"; $old="history.txt"; $numofrows=8; $startfile="time.txt"; $timing=5; if($in{numofr} >= 1) { $numofrows=$in{numofr}; } if($in{timers} >= 1) { $timing=$in{timers}; } @months = ('Jan','Feb','Mar','Apr','May','June', 'July','Aug','Sept','Oct','Nov','Dec'); @days = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); ($sec,$min,$hour,$mday,$mon,$year,$wday) =(localtime(time))[0,1,2,3,4,5,6]; $year=$year+1900; $date = " $days[$wday], $months[$mon]/$mday/$year $hour:$min:$sec"; $date2 = " $hour:$min:$sec"; $loada=`more /proc/loadavg`; open(OLDPAGE, $old); $filesize = -s OLDPAGE; read(OLDPAGE, $oldpage, $filesize); close(OLDPAGE); open(OLDPAGE2, $startfile); $filesize = -s OLDPAGE; read(OLDPAGE2, $heading, $filesize); close(OLDPAGE2); if($in{new}) { $heading="This script started $date"; open(DUMPTIME, ">$startfile"); print DUMPTIME $heading; $oldpage=""; close(DUMPTIME); $numofrows--; } $script="monitor.pl?numofr=$numofrows&timers=$timing"; my @list = split /\s+/, $loada; if ($list[0] >= 80) { $color=$badcolor; }elsif ($list[0] >= 55){ $color=$medcolor; }else{ $color=$goodcolor; } $fontc =""; $oldpage = " $fontc $list[3] $fontc $list[6] $fontc $list[7] $fontc $date2 \n$oldpage"; print "Content-type: text/html\n\n"; print ""; print "
$heading
"; print ""; print "$oldpage"; print "
% CPUrun/alllast PIDTime
"; my @bigarray = split /\n+/, $oldpage; @bigarray=@bigarray[0 .. ($numofrows*6)]; open(FILEOUT2, ">$old"); foreach (@bigarray) { print FILEOUT2 "$_ \n";} close(FILEOUT2);