Find file
Fetching contributors…
Cannot retrieve contributors at this time
63 lines (59 sloc) 1.92 KB
<html>
<head>
<title></title>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet">
<script src="http://localhost:3333/socket.io/socket.io.js"></script>
<script src="http://localhost:3333/viewer?key=test"></script>
<script>
window.addEventListener('WatchdogsLoaded', function() {
watchdogs.onupdate = function(name) {
table = document.querySelector('table')
tr = document.querySelector('tr#' + name)
if (!tr) {
tr = document.createElement('tr')
tr.id = name
cols = ['name', 'status', 'uptime', 'load', 'memory']
for (col in cols) {
td = document.createElement('td')
td.classList.add(cols[col])
tr.appendChild(td)
}
table.appendChild(tr)
}
server = this.servers[name]
tr.querySelector('.name').innerText = server.getHostname()
tr.querySelector('.status').innerText = server.getStatus()
tr.querySelector('.uptime').innerText = server.getUptime()
tr.querySelector('.load').innerText = server.getLoad()
tr.querySelector('.memory').innerText = server.getMemory()
}
})
</script>
</head>
<body>
<div class="container">
<h1>Watchdogs</h1>
<table class="table table-bordered">
<thead>
<th>
name
</th>
<th>
status
</th>
<th>
uptime
</th>
<th>
load
</th>
<th>
free memory
</th>
</thead>
<tbody>
</tbody>
</table>
</div>
</body>
</html>