7 my $mode = $cgi->param('mode');
10 my $PROCESSORS = 16*4;
11 my $THRESHOLD = 80; #Percent CPU to consider processor "used"
15 for(my $i=1; $i<=8; $i++){
16 push(@services, "/var/lib/spong/database/blade$i.cluster.sgn/services");
17 push(@services, "/var/lib/spong/database/shiv$i.cluster.sgn/services");
23 my ($cpu_file) = `ls $_/cpu*`;
24 my ($machine) = /(shiv\d+)/;
25 ($machine) = /(blade\d+)/ unless $machine;
27 $cpu_files{$machine} = $cpu_file;
31 my $web_html = "<table border=\"0\" cellspacing=\"5\">";
33 foreach my $mach ( sort keys %cpu_files ) {
34 my $cpu_file = $cpu_files{$mach};
35 $web_html .= "<tr> <td style=\"vertical-align:top\">";
36 print "\n$mach" unless $mode eq "html";
37 $web_html .= "$mach</td><td style=\"vertical-align:top;width:100px\">";
43 my ($pid, $cpu, $status, $time, $command) =
44 /(\d+)\s+([0-9\.]+)\s+(\w+)\s+\S+\s+([0-9\:\-]+)\s+(.*)$/;
46 if($cpu >= $THRESHOLD){
47 $content .= "\n\t$pid\t$cpu\t$time\t$command";
49 #Style command for web display:
50 $command =~ s/^(\S*?)([^\/\s]+)\s/$1<span style
="color:black;font-weight:bold">$2<\
/span> /; #embolden the name of the program
51 $command = "<span style=\"font-size:0.9em;color:#555\">$command</span>"; #default stylin'
53 $row_html .= "$pid $cpu $time $command<br />";
58 $row_html .= "<span style=\"color:#555\">Available</span>" unless $used;
59 $web_html .= " $used in use </td><td style=\"vertical-align:top\">$row_html</td></tr>";
60 # $content .= "\n" unless $used;
61 print "\t$used/4 processors in use" unless $mode eq "html";
62 print $content unless $mode eq "html";
64 $web_html .= "</table>";
67 my $available = ($PROCESSORS - $total_used);
73 <title>Cluster QuickView</title>
77 <h2>Cluster QuickView</h2>
79 <a href="http://rubisco.sgn.cornell.edu/spong-cgi/www-spong.cgi"><<Back to Spong</a><br />
81 <span style="font-size:1.05em; color:#222">
82 Total processors used: <b style="color:#411">$total_used</b> Available: <b style="color:#141">$available</b>
88 <a href="server_room.pl" target="_TOP"><< Back</a>
99 print "\nTotal Processors used: $total_used\tAvailable: $available";