1 |
|
<?php |
2 |
|
|
3 |
< |
// A test navigation thingy. |
3 |
> |
// Navigation for the i-scream reports. |
4 |
|
// pjm2@ukc.ac.uk |
5 |
|
|
6 |
|
|
7 |
+ |
function isReportEmpty($filename) { |
8 |
+ |
if (filesize($filename) < 33) { |
9 |
+ |
return TRUE; |
10 |
+ |
} |
11 |
+ |
return FALSE; |
12 |
+ |
} |
13 |
+ |
|
14 |
|
function getdirArray($dir='./',$sort='asort') { |
15 |
|
global $dir_file_count; |
16 |
|
if ( is_dir($dir) ) { |
36 |
|
} |
37 |
|
} |
38 |
|
|
32 |
– |
include("day.inc"); |
33 |
– |
|
39 |
|
?> |
40 |
|
|
41 |
< |
<html> |
37 |
< |
<body bgcolor="eeeeff"> |
41 |
> |
<? include("title.inc"); ?> |
42 |
|
|
43 |
< |
<font face="arial, sans-serif"> |
40 |
< |
<h4>I-scream report browser [trial 2.0]</h4> |
41 |
< |
</font> |
43 |
> |
<hr weight="1" color="#9999ff"> |
44 |
|
|
45 |
< |
<hr> |
45 |
> |
<b>Most recent reports available</b> |
46 |
> |
<form method="GET" action="browser.php"> |
47 |
> |
<? |
48 |
|
|
49 |
< |
<font face="arial, sans-serif" size="2"> |
50 |
< |
<b>View reports for <? echo "$day" ?></b> |
51 |
< |
</font> |
49 |
> |
$file_array = getdirArray('/home/cut/pjm2/webpages/reports','rsort'); |
50 |
> |
print "<select size=\"1\" name=\"day\">"; |
51 |
> |
foreach($file_array as $file_name) { |
52 |
> |
if (is_dir($file_name)) { |
53 |
> |
$i++; |
54 |
> |
print "<option value=\"$file_name\">$file_name</option>"; |
55 |
> |
} |
56 |
> |
if ($i >= 20) { |
57 |
> |
break; |
58 |
> |
} |
59 |
> |
} |
60 |
> |
print "</select>"; |
61 |
|
|
62 |
< |
<p> |
62 |
> |
?> |
63 |
> |
<input type="submit" name="submit" value="Go"> |
64 |
> |
</form> |
65 |
|
|
66 |
< |
<form method="GET" action=""> |
52 |
< |
<select size="1" name="machine_name"> |
53 |
< |
<? include("machine_name.inc"); ?> |
54 |
< |
</select> |
66 |
> |
<hr weight="1" color="#9999ff"> |
67 |
|
|
68 |
< |
<select size="1" name="report"> |
57 |
< |
<? include("report.inc"); ?> |
58 |
< |
</select> |
68 |
> |
<? if ($day) { ?> |
69 |
|
|
70 |
< |
<input type="submit" name="submit" value="bung"> |
70 |
> |
<b>Available reports for <? echo $day ?></b> |
71 |
|
|
72 |
< |
</form> |
72 |
> |
<form method="GET" action="browser.php"> |
73 |
> |
<select size="1" name="machine_name"> |
74 |
> |
<? if ($machine_name) { ?> |
75 |
> |
<option selected value="<? echo $machine_name ?>"><? echo $machine_name ?></option> |
76 |
> |
<option value="">----------------</option> |
77 |
> |
<? } else { ?> |
78 |
> |
<option selected value="">[select machine]</option> |
79 |
> |
<? } ?> |
80 |
> |
<? include("$day/machine_name.inc"); ?> |
81 |
> |
</select> |
82 |
|
|
83 |
< |
</p> |
83 |
> |
<select size="1" name="report"> |
84 |
> |
<? if ($report) { ?> |
85 |
> |
<option selected value="<? echo $report ?>"><? echo $report ?></option> |
86 |
> |
<option value="">----------------</option> |
87 |
> |
<? } else { ?> |
88 |
> |
<option selected value="">[select report]</option> |
89 |
> |
<? } ?> |
90 |
> |
<? include("$day/report.inc"); ?> |
91 |
> |
</select> |
92 |
|
|
93 |
+ |
<input type="hidden" name="day" value="<? echo $day ?>"> |
94 |
+ |
<input type="submit" name="submit" value="Show"> |
95 |
+ |
</form> |
96 |
+ |
|
97 |
+ |
<hr weight="1" color="#9999ff"> |
98 |
+ |
|
99 |
+ |
<? } ?> |
100 |
+ |
|
101 |
+ |
</p> |
102 |
+ |
|
103 |
+ |
|
104 |
|
<? |
105 |
< |
if ($submit == "bung") { |
106 |
< |
$url = escapeshellcmd("$day/$machine_name/$report/chart.gif"); |
107 |
< |
if (file_exists($url)) { |
108 |
< |
echo "<p><img src=\"$url\" width=\"500\" height=\"250\"><br><img src=\"24hour.gif\" width=\"500\" height=\"39\"></p>"; |
105 |
> |
if ($submit == "Show" && $machine_name && $report) { |
106 |
> |
|
107 |
> |
include("$day/$machine_name/$report/i-maxmin.txt"); |
108 |
> |
|
109 |
> |
$url = escapeshellcmd("$day/$machine_name/$report/i-chart.gif"); |
110 |
> |
if (isReportEmpty("$day/$machine_name/$report/i-data.txt")) { |
111 |
> |
echo "Host <b>$machine_name</b> did not send any information about <b>$report</b> on <b>$day</b>. Please select another report."; |
112 |
|
} |
113 |
+ |
else if (file_exists($url)) { ?> |
114 |
+ |
|
115 |
+ |
<center><b>[<? echo $machine_name; ?>] - <? echo $report; ?></b></center> |
116 |
+ |
|
117 |
+ |
<table border="0" cellpadding="0" cellspacing="0"> |
118 |
+ |
<tr> |
119 |
+ |
<td align="right" valign="top"> |
120 |
+ |
<font size="2"><? printf("%.1f", $max_value); ?></font> |
121 |
+ |
</td> |
122 |
+ |
<td rowspan="2"> |
123 |
+ |
<img src="<? echo $url; ?>" width="500" height="250"> |
124 |
+ |
</td> |
125 |
+ |
</tr> |
126 |
+ |
<tr> |
127 |
+ |
<td align="right" valign="bottom"> |
128 |
+ |
<font size="2"><? echo $min_value; ?></font> |
129 |
+ |
</td> |
130 |
+ |
</tr> |
131 |
+ |
<tr> |
132 |
+ |
<td> </td> |
133 |
+ |
<td><img src="24hour.gif" width="500" height="39"></td> |
134 |
+ |
</tr> |
135 |
+ |
</table> |
136 |
+ |
|
137 |
+ |
<hr weigth="1" color="#9999ff"> |
138 |
+ |
|
139 |
+ |
<b>Extra data</b> |
140 |
+ |
<p> |
141 |
+ |
<a href="<? echo "$day/$machine_name/$report/i-data.txt" ?>">Raw plot data</a><br> |
142 |
+ |
<a href="<? echo "$day/$machine_name/$report/i-chart.gif" ?>">GIF chart</a><br> |
143 |
+ |
<a href="<? echo "$day/$machine_name/$report/i-maxmin.txt" ?>">PHP y-axis limits include</a> |
144 |
+ |
|
145 |
+ |
<? } |
146 |
|
else { |
147 |
|
echo "<p>The report could not be found.</p>"; |
148 |
|
} |
149 |
+ |
echo "<hr weight=\"1\" color=\"#9999ff\">"; |
150 |
|
} |
151 |
|
|
152 |
|
?> |
153 |
|
|
154 |
< |
<hr> |
80 |
< |
|
81 |
< |
<p> |
82 |
< |
<font face="arial, sans-serif" size="2"> |
83 |
< |
<b>Or browse all dates</b> |
84 |
< |
</font> |
85 |
< |
</p> |
86 |
< |
|
87 |
< |
<? |
88 |
< |
|
89 |
< |
$file_array = getdirArray('/home/cut/pjm2/webpages/reports','asort'); |
90 |
< |
foreach($file_array as $file_name) { |
91 |
< |
if (is_dir($file_name)) { |
92 |
< |
print "+ <a href=\"$file_name\">$file_name</a><br>"; |
93 |
< |
} |
94 |
< |
} |
95 |
< |
|
96 |
< |
?> |
97 |
< |
|
98 |
< |
</body> |
99 |
< |
</html> |
154 |
> |
<? include("bottom.inc"); ?> |