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