1 |
pjm2 |
1.1 |
<?php |
2 |
|
|
|
3 |
tdb |
1.41 |
# |
4 |
|
|
# i-scream central monitoring system |
5 |
|
|
# Copyright (C) 2000-2002 i-scream |
6 |
|
|
# |
7 |
|
|
# This program is free software; you can redistribute it and/or |
8 |
|
|
# modify it under the terms of the GNU General Public License |
9 |
|
|
# as published by the Free Software Foundation; either version 2 |
10 |
|
|
# of the License, or (at your option) any later version. |
11 |
|
|
# |
12 |
|
|
# This program is distributed in the hope that it will be useful, |
13 |
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
|
|
# GNU General Public License for more details. |
16 |
|
|
# |
17 |
|
|
# You should have received a copy of the GNU General Public License |
18 |
|
|
# along with this program; if not, write to the Free Software |
19 |
|
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
20 |
|
|
# |
21 |
|
|
|
22 |
pjm2 |
1.16 |
# Navigation for the i-scream reports. |
23 |
|
|
# pjm2@ukc.ac.uk |
24 |
|
|
# |
25 |
pjm2 |
1.31 |
# CONFIGURABLE CONSTANTS: - |
26 |
pjm2 |
1.16 |
|
27 |
pjm2 |
1.33 |
include("browser_config.inc.php"); |
28 |
pjm2 |
1.15 |
|
29 |
pjm2 |
1.16 |
# |
30 |
|
|
# END CONFIGURATION |
31 |
pjm2 |
1.15 |
|
32 |
pjm2 |
1.1 |
|
33 |
pjm2 |
1.27 |
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
# Used to return whether or not a report data file is empty. |
37 |
pjm2 |
1.29 |
function isReportEmpty($filename, $minFileSize) { |
38 |
|
|
if (filesize($filename) < $minFileSize) { |
39 |
pjm2 |
1.14 |
return TRUE; |
40 |
|
|
} |
41 |
|
|
return FALSE; |
42 |
|
|
} |
43 |
|
|
|
44 |
pjm2 |
1.27 |
|
45 |
pjm2 |
1.32 |
include("iutils.inc.php"); |
46 |
pjm2 |
1.1 |
|
47 |
|
|
?> |
48 |
|
|
|
49 |
pjm2 |
1.20 |
<? include($titleHTML); ?> |
50 |
pjm2 |
1.6 |
|
51 |
pjm2 |
1.19 |
<hr weight="1" color="<? echo $lineColor ?>"> |
52 |
pjm2 |
1.11 |
|
53 |
|
|
<b>Most recent reports available</b> |
54 |
pjm2 |
1.26 |
<form method="<? echo $formMethod ?>" action="<? echo $thisPage ?>"> |
55 |
pjm2 |
1.11 |
<? |
56 |
|
|
|
57 |
pjm2 |
1.17 |
$file_array = getdirArray($reportDirectory,'rsort'); |
58 |
pjm2 |
1.11 |
print "<select size=\"1\" name=\"day\">"; |
59 |
pjm2 |
1.30 |
if ($day) { ?> |
60 |
|
|
<option selected value="<? echo $day ?>"><? echo $day ?></option> |
61 |
|
|
<option value="">----------------</option> |
62 |
|
|
<? } |
63 |
pjm2 |
1.11 |
foreach($file_array as $file_name) { |
64 |
pjm2 |
1.34 |
#if (is_dir($file_name)) { |
65 |
pjm2 |
1.35 |
if (preg_match("/^[0-9]{4}\-[0-9]{2}\-[0-9]{2}$/", $file_name)) { |
66 |
pjm2 |
1.11 |
$i++; |
67 |
|
|
print "<option value=\"$file_name\">$file_name</option>"; |
68 |
|
|
} |
69 |
pjm2 |
1.16 |
if ($i >= $maxDaysShown) { |
70 |
pjm2 |
1.11 |
break; |
71 |
|
|
} |
72 |
|
|
} |
73 |
|
|
print "</select>"; |
74 |
|
|
|
75 |
|
|
?> |
76 |
|
|
<input type="submit" name="submit" value="Go"> |
77 |
|
|
</form> |
78 |
|
|
|
79 |
pjm2 |
1.19 |
<hr weight="1" color="<? echo $lineColor ?>"> |
80 |
pjm2 |
1.11 |
|
81 |
|
|
<? if ($day) { ?> |
82 |
|
|
|
83 |
|
|
<b>Available reports for <? echo $day ?></b> |
84 |
|
|
|
85 |
pjm2 |
1.26 |
<form method="<? echo $formMethod ?>" action="<? echo $thisPage ?>"> |
86 |
pjm2 |
1.6 |
<select size="1" name="machine_name"> |
87 |
pjm2 |
1.13 |
<? if ($machine_name) { ?> |
88 |
|
|
<option selected value="<? echo $machine_name ?>"><? echo $machine_name ?></option> |
89 |
|
|
<option value="">----------------</option> |
90 |
|
|
<? } else { ?> |
91 |
|
|
<option selected value="">[select machine]</option> |
92 |
|
|
<? } ?> |
93 |
pjm2 |
1.36 |
<? include("$reportDirectory/$day/$machineNameHTML"); ?> |
94 |
pjm2 |
1.6 |
</select> |
95 |
|
|
|
96 |
|
|
<select size="1" name="report"> |
97 |
pjm2 |
1.13 |
<? if ($report) { ?> |
98 |
|
|
<option selected value="<? echo $report ?>"><? echo $report ?></option> |
99 |
|
|
<option value="">----------------</option> |
100 |
|
|
<? } else { ?> |
101 |
|
|
<option selected value="">[select report]</option> |
102 |
|
|
<? } ?> |
103 |
pjm2 |
1.36 |
<? include("$reportDirectory/$day/$reportHTML"); ?> |
104 |
pjm2 |
1.6 |
</select> |
105 |
pjm2 |
1.1 |
|
106 |
pjm2 |
1.11 |
<input type="hidden" name="day" value="<? echo $day ?>"> |
107 |
pjm2 |
1.8 |
<input type="submit" name="submit" value="Show"> |
108 |
pjm2 |
1.6 |
</form> |
109 |
pjm2 |
1.11 |
|
110 |
pjm2 |
1.19 |
<hr weight="1" color="<? echo $lineColor ?>"> |
111 |
pjm2 |
1.11 |
|
112 |
|
|
<? } ?> |
113 |
pjm2 |
1.1 |
|
114 |
pjm2 |
1.6 |
</p> |
115 |
pjm2 |
1.1 |
|
116 |
pjm2 |
1.2 |
|
117 |
|
|
<? |
118 |
pjm2 |
1.8 |
if ($submit == "Show" && $machine_name && $report) { |
119 |
pjm2 |
1.11 |
|
120 |
pjm2 |
1.38 |
$url = "$webRoot/$day/$machine_name/$report/$reportChartFile"; |
121 |
pjm2 |
1.37 |
if (isReportEmpty("$reportDirectory/$day/$machine_name/$report/$reportChartDataFile", $minFileSize)) { |
122 |
pjm2 |
1.14 |
echo "Host <b>$machine_name</b> did not send any information about <b>$report</b> on <b>$day</b>. Please select another report."; |
123 |
|
|
} |
124 |
pjm2 |
1.39 |
else if (file_exists("$reportDirectory/$day/$machine_name/$report/$reportChartFile")) { |
125 |
|
|
|
126 |
|
|
include("$reportDirectory/$day/$machine_name/$report/$reportLimitsFile"); |
127 |
|
|
|
128 |
|
|
?> |
129 |
|
|
|
130 |
pjm2 |
1.11 |
<center><b>[<? echo $machine_name; ?>] - <? echo $report; ?></b></center> |
131 |
|
|
|
132 |
|
|
<table border="0" cellpadding="0" cellspacing="0"> |
133 |
|
|
<tr> |
134 |
|
|
<td align="right" valign="top"> |
135 |
|
|
<font size="2"><? printf("%.1f", $max_value); ?></font> |
136 |
|
|
</td> |
137 |
|
|
<td rowspan="2"> |
138 |
|
|
<img src="<? echo $url; ?>" width="500" height="250"> |
139 |
|
|
</td> |
140 |
|
|
</tr> |
141 |
|
|
<tr> |
142 |
|
|
<td align="right" valign="bottom"> |
143 |
|
|
<font size="2"><? echo $min_value; ?></font> |
144 |
|
|
</td> |
145 |
|
|
</tr> |
146 |
|
|
<tr> |
147 |
|
|
<td> </td> |
148 |
pjm2 |
1.18 |
<td><img src="<? echo $scaleImage ?>" width="500" height="39"></td> |
149 |
pjm2 |
1.11 |
</tr> |
150 |
|
|
</table> |
151 |
|
|
|
152 |
pjm2 |
1.39 |
<hr weight="1" color="<? echo $lineColor ?>"> |
153 |
|
|
|
154 |
|
|
<b>Latest data</b> |
155 |
|
|
<p> |
156 |
pjm2 |
1.40 |
Latest set of data received from |
157 |
pjm2 |
1.39 |
<a href="<? echo "latest.php?machine=$machine_name"; ?>"><?=$machine_name?></a> |
158 |
pjm2 |
1.40 |
<br> |
159 |
|
|
Alerts for <a href="alerts.php?machine=<?=$machine_name?>"><?=$machine_name?></a> |
160 |
|
|
|
161 |
pjm2 |
1.39 |
|
162 |
|
|
<hr weight="1" color="<? echo $lineColor ?>"> |
163 |
pjm2 |
1.11 |
|
164 |
|
|
<b>Extra data</b> |
165 |
|
|
<p> |
166 |
pjm2 |
1.38 |
<a href="<? echo "$webRoot/$day/$machine_name/$report/$reportChartDataFile" ?>">Raw plot data</a><br> |
167 |
|
|
<a href="<? echo "$webRoot/$day/$machine_name/$report/$reportChartFile" ?>">GIF chart</a><br> |
168 |
|
|
<a href="<? echo "$webRoot/$day/$machine_name/$report/$reportLimitsFile" ?>">PHP y-axis limits include</a> |
169 |
pjm2 |
1.11 |
|
170 |
|
|
<? } |
171 |
pjm2 |
1.2 |
else { |
172 |
pjm2 |
1.15 |
echo "<p>The report could not be found. Somebody must have deleted it!</p>"; |
173 |
pjm2 |
1.2 |
} |
174 |
pjm2 |
1.19 |
echo "<hr weight=\"1\" color=\"$lineColor\">"; |
175 |
pjm2 |
1.2 |
} |
176 |
|
|
|
177 |
pjm2 |
1.1 |
?> |
178 |
pjm2 |
1.6 |
|
179 |
pjm2 |
1.21 |
<? include($bottomHTML); ?> |