blob: 2d8639a98671dbf71da80cd05ee5833f397241a1 (
plain) (
tree)
|
|
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>-</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<style>
.button-expand {
margin-right: 1em;
}
h1, .h1 {
margin-top: 20px;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="col">
<h1 id="hostname">-</h1>
</div>
<div class="col h1 text-right">
<div class="btn-group align-middle" role="group">
<a role="button" class="btn btn-sm btn-warning" href="#" onclick="reboot();">Reboot</a>
<a role="button" class="btn btn-sm btn-danger" href="#" onclick="shutdown();">Shutdown</a>
</div>
</div>
</div>
<div class="row">
<div class="col">
<hr>
<p><button type="button" class="btn btn-outline-primary btn-sm button-expand" data-toggle="collapse" data-target="#collapse_top">+</button><a href="#collapse_top" data-toggle="collapse"><code>top</code></a> <span class="float-right"><small>refreshed every <span id="top_refresh_interval">-</span> seconds</small></span></p>
<div class="collapse show" id="collapse_top">
<pre class="pre-scrollable" id="top"></pre>
</div>
<hr>
<p><button type="button" class="btn btn-outline-primary btn-sm button-expand" data-toggle="collapse" data-target="#collapse_systemctl_failed_system">+</button><a href="#collapse_systemctl_failed_system" data-toggle="collapse"><code>systemctl --system list-units --failed</code></a></p>
<div class="collapse show" id="collapse_systemctl_failed_system">
<pre class="pre-scrollable" id="systemctl_failed_system"></pre>
</div>
<hr>
<p><button type="button" class="btn btn-outline-primary btn-sm button-expand" data-toggle="collapse" data-target="#collapse_systemctl_failed_user">+</button><a href="#collapse_systemctl_failed_user" data-toggle="collapse"><code>systemctl --user list-units --failed</code></a></p>
<div class="collapse show" id="collapse_systemctl_failed_user">
<pre class="pre-scrollable" id="systemctl_failed_user"></pre>
</div>
<hr>
<p><button type="button" class="btn btn-outline-primary btn-sm button-expand" data-toggle="collapse" data-target="#collapse_systemctl_status_system">+</button><a href="#collapse_systemctl_status_system" data-toggle="collapse"><code>systemctl --system status</code></a></p>
<div class="collapse" id="collapse_systemctl_status_system">
<pre class="pre-scrollable" id="systemctl_status_system"></pre>
</div>
<hr>
<p><button type="button" class="btn btn-outline-primary btn-sm button-expand" data-toggle="collapse" data-target="#collapse_systemctl_status_user">+</button><a href="#collapse_systemctl_status_user" data-toggle="collapse"><code>systemctl --user status</code></a></p>
<div class="collapse" id="collapse_systemctl_status_user">
<pre class="pre-scrollable" id="systemctl_status_user"></pre>
</div>
<hr>
<p><button type="button" class="btn btn-outline-primary btn-sm button-expand" data-toggle="collapse" data-target="#collapse_systemctl_timers_system">+</button><a href="#collapse_systemctl_timers_system" data-toggle="collapse"><code>systemctl --system list-timers --all</code></a> <span class="float-right"><small>refreshed every <span id="systemctl_timers_system_refresh_interval">-</span> seconds</small></span></p>
<div class="collapse" id="collapse_systemctl_timers_system">
<pre class="pre-scrollable" id="systemctl_timers_system"></pre>
</div>
<hr>
<p><button type="button" class="btn btn-outline-primary btn-sm button-expand" data-toggle="collapse" data-target="#collapse_systemctl_timers_user">+</button><a href="#collapse_systemctl_timers_user" data-toggle="collapse"><code>systemctl --user list-timers --all</code></a> <span class="float-right"><small>refreshed every <span id="systemctl_timers_user_refresh_interval">-</span> seconds</small></span></p>
<div class="collapse" id="collapse_systemctl_timers_user">
<pre class="pre-scrollable" id="systemctl_timers_user"></pre>
</div>
<hr>
</div>
</div>
</div>
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/bootstrap.bundle.min.js"></script>
<script>
function reboot() {
$.get('cgi-bin/reboot.sh');
}
function shutdown() {
$.get('cgi-bin/poweroff.sh');
}
function refresh_top() {
$.get('cgi-bin/get.py?what=top', function(data) {
$('#top').text(JSON.parse(data));
});
}
function refresh_timers() {
$.get('cgi-bin/get.py?what=timers', function(data) {
data = JSON.parse(data);
$('#systemctl_timers_system').text(data['system']['timers']);
$('#systemctl_timers_user').text(data['user']['timers']);
});
}
function refresh_status() {
$.get('cgi-bin/get.py?what=status', function(data) {
data = JSON.parse(data);
$('#hostname').text(data['hostname']);
$('title').text(data['hostname']);
$('#top').text(data['top']);
$('#systemctl_failed_system').text(data['system']['failed']);
$('#systemctl_failed_user').text(data['user']['failed']);
$('#systemctl_status_system').text(data['system']['overview']);
$('#systemctl_status_user').text(data['user']['overview']);
$('#systemctl_timers_system').text(data['system']['timers']);
$('#systemctl_timers_user').text(data['user']['timers']);
});
}
var top_refresh_interval_seconds = 5;
function loop_top() {
setInterval(function() { refresh_top(); }, top_refresh_interval_seconds * 1000);
$('#top_refresh_interval').text(top_refresh_interval_seconds);
}
var timers_refresh_interval_seconds = 30;
function loop_timers() {
setInterval(function() {
refresh_timers();
}, timers_refresh_interval_seconds * 1000);
$('#systemctl_timers_system_refresh_interval').text(timers_refresh_interval_seconds);
$('#systemctl_timers_user_refresh_interval').text(timers_refresh_interval_seconds);
}
function loop() {
loop_top();
loop_timers();
}
function main() {
refresh_status();
loop();
}
$(function() {
main();
});
</script>
</body>
</html>
|