forked from Munzy/ServerStatus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
75 lines (72 loc) · 1.9 KB
/
index.php
File metadata and controls
75 lines (72 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
// main page
$title = 'Live';
if (file_exists('./includes/config.php')) {
include('./includes/config.php');
}
else {
exit("You need to create includes/config.php");
}
global $sJavascript, $sTable;
$sJavascript .= '<script type="text/javascript">
function uptime() {
$(function() {';
$id = 0;
$sTable ='
<thead>
<tr>
<th id="status" style="text-align: center;">Status</th>
<th id="name">Name</th>
<th id="host">Host</th>
<th id="type">Type</th>
<th id="location">Location</th>
<th id="uptime">Uptime</th>
<th id="load">Load</th>
<th id="ram">RAM</th>
<th id="hdd">HDD</th>
</tr>
</thead>
<tbody>';
foreach($servers as $result) {
$sJavascript .= '$.getJSON("pull/index.php?url='.$id.'",function(result){
$("#online'.$id.'").html(result.online);
$("#uptime'.$id.'").html(result.uptime);
$("#load'.$id.'").html(result.load);
$("#memory'.$id.'").html(result.memory);
$("#hdd'.$id.'").html(result.hdd);
});';
$sTable .= '
<tr>
<td id="online'.$id.'">
<div class="progress">
<div class="bar bar-danger" style="width: 100%;"><small>Down</small></div>
</div>
</td>
<td><a href="outages.php?name='.$result["name"].'">'.$result["name"].'</td>
<td><a href="outages.php?host='.$result["host"].'">'.$result["host"].'</td>
<td>'.$result["type"].'</td>
<td>'.$result["location"].'</td>
<td id="uptime'.$id.'">n/a</td>
<td id="load'.$id.'">n/a</td>
<td id="memory'.$id.'">
<div class="progress progress-striped active">
<div class="bar bar-danger" style="width: 100%;"><small>n/a</small></div>
</div>
</td>
<td id="hdd'.$id.'">
<div class="progress progress-striped active">
<div class="bar bar-danger" style="width: 100%;"><small>n/a</small></div>
</div>
</td>
</tr>
';
$id++;
}
$sTable .= '</tbody>';
$sJavascript .= '});
}
uptime();
setInterval(uptime, '.$refresh.');
</script>';
include($index);
?>