remove a lot of deprecated files ;
[monitor.git] / www / gadgets / gadget.php
1 <?php
2 #function get_comon_count()
3 #{
4 #       $url = "http://summer.cs.princeton.edu/status/tabulator.cgi?table=table_nodeview&format=nameonly";
5 #       $count = `wget --quiet -O - "$url" | wc -l`;
6 #       return $count;
7 #}
8 #function get_comon_count_for($query)
9 #{
10 #       $url = "http://summer.cs.princeton.edu/status/tabulator.cgi?table=table_nodeviewshort&format=nameonly&select='$query'";
11 #       $count = `wget --quiet -O - "$url" | wc -l`;
12 #       return $count;
13 #}
14 #$total = get_comon_count();
15 #$alive = get_comon_count_for("lastcotop==0");
16 #$fc2 = get_comon_count_for("fcname==2");
17 #$fc4 = get_comon_count_for("fcname==4");
18 #$not_alive = $total - $alive;
19 #$nossh = get_comon_count_for("sshstatus>0||sshstatus<0");
20 #$unknown = abs($not_alive - $nossh);
21 #$time = date("D M j G:i:s");
22 #$monday_csv_list= trim(file_get_contents("monday.txt"));
23 #$monday_array = split(",", $monday_csv_list);
24
25 $bad_csv_list= trim(file_get_contents("badcsv.txt"));
26 $sarray = split(",", $bad_csv_list);    # split on comma
27
28 $alpha_running = $sarray[0];
29 $prod_running = $sarray[1];
30 $oldboot_running = $sarray[2];
31 $alpha_debug = $sarray[3];
32
33 $prod_debug = $sarray[4];
34 $oldboot_debug = $sarray[5];
35 $down = $sarray[6];
36 #$prod_since_monday = $alpha_running - $monday_array[0];
37 #$oldboot_since_monday = $monday_array[1] - $oldboot_running;
38 $monitor_total = $prod_running + $prod_debug + $down +$oldboot_running + $oldboot_debug + $alpha_running + $alpha_debug;
39 ?>
40
41 <table cellspacing=3>
42 <!--/table>
43
44 <table cellspacing=3-->
45 <tr>
46 <th align=left>MONITOR</th>
47 <th align=right>Boot</th>
48 <th align=right>Debug</th>
49 <th align=right>Down</th>
50 <th align=right></th>
51 </tr> 
52 <tr> 
53 <th align=left>Production 4.2</th> 
54 <td bgcolor=lightgrey align=right><?php echo $alpha_running ?></td> 
55 <td align=right><?php echo $alpha_debug + $prod_debug ?></td> 
56 <td align=right><?php echo $down ?></td>
57 <td align=right><?php echo ($alpha_running + $alpha_debug + $prod_debug + $down) ?></td> 
58 </tr> 
59 <tr> 
60 <th align=left>Production 4.1</th> 
61 <td align=right><?php echo $prod_running ?></td> 
62 <td align=right>--</td> 
63 <td align=right>--</td> 
64 <td align=right><?php echo ($prod_running) ?></td>
65 </tr> 
66 <tr> 
67 <th align=left>Old BootCD</th> 
68 <td align=right><?php echo $oldboot_running ?></td> 
69 <td align=right><?php echo $oldboot_debug ?></td> 
70 <td align=right>--</td> 
71 <td align=right><?php echo ($oldboot_running + $oldboot_debug) ?></td> 
72 <tr> 
73 <th align=left>Sums</th> 
74 <td align=right><?php echo $prod_running+$alpha_running+$oldboot_running ?></td> 
75 <td align=right><?php echo $prod_debug+$oldboot_debug+$alpha_debug ?></td> 
76 <td align=right>--</td>
77 <td bgcolor=lightgrey align=right><?php echo ($prod_running + $prod_debug + $down +$oldboot_running + $oldboot_debug + $alpha_running + $alpha_debug) ?></td>
78 </tr> 
79 <tr> 
80 <th align=left></th> 
81 <td align=right><?php echo sprintf("%.1f%%", ($prod_running+$alpha_running+$oldboot_running)/1.0/$monitor_total*100) ?></td> 
82 <td align=right><?php echo sprintf("%.1f%%", (($prod_debug+$oldboot_debug+$alpha_debug)/1.0/$monitor_total*100)) ?></td>
83 <td align=right><?php echo sprintf("%.1f%%", ($down/1.0/$monitor_total*100)) ?></td>
84 <td align=right></td>
85 </tr> 
86 <tr> 
87 <td>
88 <a target=_blank href="http://monitor.planet-lab.org/monitor/gadget.php">Direct Link</a>
89 </td>
90 </tr> 
91 </table>