19 |
|
|
20 |
|
|
21 |
|
function showStat($title, $value, $input) { |
22 |
+ |
|
23 |
+ |
$report = $value; |
24 |
+ |
|
25 |
|
preg_match("/$value=([^\,]*)[\,\}]/", $input, $matches); |
26 |
|
$value = $matches[1]; |
27 |
|
if (empty($value)) { |
30 |
|
?> |
31 |
|
<table border="0" width="100%"> |
32 |
|
<tr> |
33 |
< |
<td width="50%" align="right" valign="top"><b><?=$title?></b></td> |
34 |
< |
<td width="50%" align="left" valign="top"><?=$value?></td> |
33 |
> |
<td width="50%" align="right" valign="top"> |
34 |
> |
<b><?=$title?></b> |
35 |
> |
</td> |
36 |
> |
<td width="50%" align="left" valign="top"> |
37 |
> |
<? if (preg_match("/^[0-9]+\.?[0-9]*$/", $value)) { |
38 |
> |
linkToHistory($report); |
39 |
> |
} ?> |
40 |
> |
<?=$value?></td> |
41 |
|
</tr> |
42 |
|
</table> |
43 |
|
<? |
48 |
|
global $machine; |
49 |
|
$yesterday = date("Y-m-d", time() - 86400); |
50 |
|
echo <<<EOT |
51 |
< |
<a href="browser.php?machine_name=$machine&report=$report&day=$yesterday&submit=Show"> |
43 |
< |
<img src="minichart.gif" width="20" height="20" border="0"> |
44 |
< |
</a> |
45 |
< |
<font size="2">View yesterday's 24-hour chart</font> |
51 |
> |
<a href="browser.php?machine_name=$machine&report=$report&day=$yesterday&submit=Show"><img src="minichart.gif" alt="View yesterday's 24-hour chart" width="20" height="20" border="0"></a> |
52 |
|
EOT; |
53 |
|
} |
54 |
|
|
75 |
|
?> |
76 |
|
<table border="0" cellpadding="0" cellspacing="0" align="center"> |
77 |
|
<tr> |
78 |
< |
<td colspan="2"><b><?=$title?></b> <font size="2">(<?=$value?><?=$units?>)</font></td> |
78 |
> |
<td colspan="2"><? linkToHistory($report); ?> <b><?=$title?></b> <font size="2">(<?=$value?><?=$units?>)</font></td> |
79 |
|
</tr> |
80 |
|
<tr> |
81 |
|
<td colspan="2" bgcolor="#eeeeff"><img src="<?=$barImage?>" border="0" height="20" width="<?=$width?>"></td> |
88 |
|
<td align="right"><?=$max?><?=$units?></td> |
89 |
|
</tr> |
90 |
|
<tr> |
85 |
– |
<td colspan="2" align="center"><? linkToHistory($report); ?></td> |
86 |
– |
</tr> |
87 |
– |
<tr> |
91 |
|
<td colspan="2"> </td> |
92 |
|
</tr> |
93 |
|
</table> |
147 |
|
</td> |
148 |
|
<td bgcolor="#ffffcc"> |
149 |
|
<font face="arial,sans-serif" size="2"> |
150 |
< |
<b>Recipt date:</b> $last_modified |
150 |
> |
<b>Receipt date:</b> $last_modified |
151 |
|
$warning |
152 |
|
</font> |
153 |
|
</td> |
156 |
|
EOT; |
157 |
|
|
158 |
|
# Read the file. |
159 |
< |
#$input = "packet.attributes.machine_name=raptor.ukc.ac.uk,packet.memory.free=10,packet.memory.total=100,"; |
160 |
< |
$input = file("$latestDirectory/$machine/$latestData"); |
161 |
< |
# All we need is the first line if there is more than one line. |
162 |
< |
$input = $input[0]; |
159 |
> |
if (file_exists("$latestDirectory/$machine/$latestData")) { |
160 |
> |
$input = file("$latestDirectory/$machine/$latestData"); |
161 |
> |
# All we need is the first line if there is more than one line. |
162 |
> |
$input = $input[0]; |
163 |
> |
} |
164 |
|
|
165 |
|
if (empty($input)) { |
166 |
< |
echo "<br><br>There was an error reading from the latest packet received. Please notify your i-scream server administrator."; |
166 |
> |
echo "<br><br>There are currently no latest details about <b>$machine</b>. Please notify your i-scream server administrator if you believe this to be incorrect."; |
167 |
|
} |
168 |
|
else { |
169 |
|
# Display the data specified in the display include. |