Check glances status on monitor page.

This commit is contained in:
opi 2014-02-14 20:36:01 +01:00
parent c9afc3edde
commit 78132cc22d
2 changed files with 32 additions and 16 deletions

View file

@ -589,28 +589,36 @@ app = Sammy('#main', function (sam) {
monitorData = {}
// Why this method ?
c.api('/monitor/update-stats', function(data) { // ?
c.api('/service/status', function(data) { // ?
monitorData.status = true;
c.api('/monitor/system', function(data) {
monitorData.system = data;
if (data.status == 'running') {
c.api('/monitor/system', function(data) {
monitorData.system = data;
c.api('/monitor/disk', function(data) {
monitorData.disk = data;
c.api('/monitor/disk', function(data) {
monitorData.disk = data;
c.api('/monitor/network', function(data) {
monitorData.network = data;
// Remove useless interface
delete monitorData.network.usage.lo;
c.api('/monitor/network', function(data) {
monitorData.network = data;
// Remove useless interface
delete monitorData.network.usage.lo;
c.view('monitor', monitorData);
});
c.view('monitor', monitorData);
});
});
});
});
}
else {
monitorData.status = false;
c.view('monitor', monitorData);
}
}, 'POST', {period: 'day'});
}, 'GET', {names: 'glances'});
});

View file

@ -5,6 +5,7 @@
<div class="view-title">Monitoring</div>
<div class="br"></div>
{{#if status}}
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title"><span class="glyphicon glyphicon-info-sign"></span> Infos</h2>
@ -216,5 +217,12 @@
</div><!-- .panel-group -->
{{else}}
<div class="alert alert-warning">
<span class="glyphicon glyphicon-exclamation-sign"></span>
Monitoring is not enabled.
<br>
Check <a href="/#/services/glances">glances</a> service status.
</div>
</div>
{{/if}}