First round of testing the monitoring table

This commit is contained in:
Ubergeek 2019-02-06 14:09:30 +00:00
parent eeb2a74635
commit cab3bbad97
1 changed files with 44 additions and 1 deletions

View File

@ -23,7 +23,50 @@
<h2 class="title">Server Status</h2>
<div style="clear: both;">&nbsp;</div>
<div class="entry">
<p>(Coming soon)</p>
<p>
<!-- Have to clean this section up a bit, styling, really -->
<?php
$hosts="all";
$f = fopen("./report", "r");
echo "Last update: " . date ("H:i", filemtime('/tmp/report'))."<p>\n";
while (($line = fgetcsv($f)) !== false) {
echo "<tr>";
if ($hosts == "failed" ) {
if ($line[2] == "FAILED") {
foreach ($line as $cell) {
if ($cell == "FAILED") {
echo '<td style="color:#FF0000">' . htmlspecialchars($cell) . '</td>';
}
else {
echo "<td>" .htmlspecialchars($cell) . "</td>";
}
}
}
}
elseif ($hosts == "all") {
foreach ($line as $cell) {
if ($cell == "FAILED") {
echo '<td style="color:#FF0000">' . htmlspecialchars($cell) . '</td>';
}
elseif ($cell=="GOOD") {
echo '<td style="color:#00FF00">' . htmlspecialchars($cell) . "</td>";
}
else {
echo "<td>" .htmlspecialchars($cell) . "</td>";
}
}
}
echo "</tr>\n";
}
echo "\n</table><p>\n";
fclose($f);
?>
</p>
</div>
</div>
<div style="clear: both;">&nbsp;</div>