Commit 87ee9bbd by Johannes Stelzer

* added health section to details with disk and datasource infos

* fixed health display when application is DOWN
parent b5ecd215
This diff was suppressed by a .gitattributes entry.
......@@ -21,7 +21,7 @@ angular.module('springBootAdmin')
$scope.loadData = function() {
Applications.query(function(applications) {
for (var i in applications) {
for (var i = 0; i< applications.length; i++) {
var app = applications[i];
ApplicationOverview.getVersion(app);
ApplicationOverview.getHealth(app);
......@@ -57,6 +57,12 @@ angular.module('springBootAdmin')
$scope.error = error;
});
ApplicationDetails.getHealth(application).success(function(health) {
$scope.health = health;
}).error( function(health) {
$scope.health = health;
});
ApplicationDetails.getMetrics(application).success( function(metrics) {
$scope.metrics = metrics;
$scope.metrics["mem.used"] = $scope.metrics["mem"] - $scope.metrics["mem.free"];
......
......@@ -39,20 +39,16 @@ angular.module('springBootAdmin.services', ['ngResource'])
});
}
this.getHealth = function(app) {
return $http.get(app.url + '/health').success(function(response) {
if (typeof(response) === 'string' && response.indexOf('ok') != -1
|| typeof(response.status) === 'string' &&
(response.status.indexOf('ok') != -1 || response.status.indexOf('UP') != -1)) {
app.up = true;
} else if (typeof(response.status) === 'string' && response.status.indexOf('DOWN') != -1) {
app.down = true;
} else if (typeof(response.status) === 'string' && response.status.indexOf('OUT-OF-SERVICE') != -1) {
app.outofservice = true;
return $http.get(app.url + '/health').success(function (response) {
app.status = response.status;
}).error(function (response, httpStatus) {
if (httpStatus === 503) {
app.status = response.status;
} else if (httpStatus === 404) {
app.status = 'OFFLINE';
} else {
app.unknown = true;
app.status = 'UNKNOWN';
}
}).error(function() {
app.offline = true;
});
}
this.getLogfile = function(app) {
......@@ -78,6 +74,10 @@ angular.module('springBootAdmin.services', ['ngResource'])
this.getEnv = function(app) {
return $http.get(app.url + '/env');
}
this.getHealth = function(app) {
return $http.get(app.url + '/health');
}
}])
.service('ApplicationLogging', ['$http' , 'Jolokia', function($http, jolokia) {
var LOGBACK_MBEAN = 'ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator';
......
......@@ -150,25 +150,27 @@ a:hover.spring-boot-logo span {
/** Status in Application Overview-View **/
span.up {
span.status-UP {
color: #00AA00;
font-weight: bold;
}
span.offline {
color: #DD0000;
span.status-OFFLINE {
color: #000000;
font-weight: bold;
}
span.down, span.outofservice {
color: #FF8800;
span.status-DOWN,
span.status-OUT_OF_SERVICE {
color: #DD0000;
font-weight: bold;
}
span.unknown {
color: #DDDDDD;
span.status-UNKNOWN {
font-weight: bold;
color: #FF8800;
}
/** Headings and Tabs in Detail-View **/
.accordion-heading ,
.accordion-heading > a,
......
......@@ -13,6 +13,40 @@
</table>
</div>
<div class="span6">
<table class="table">
<thead>
<tr><th>Health Checks</th><th><small class="pull-right"><a href="{{ application.url }}/health">raw JSON</a></small></th></tr>
</thead>
<tbody>
<tr>
<td>Application</td><td><span class="status-{{health.status}}">{{ health.status }}</span></td>
</tr>
<tr ng-if="health.db">
<td>Datasources</td>
<td><span class="status-{{health.db.status}}">{{ health.db.status }}</span><br>
{{health.db.database}}
</td>
</tr>
<tr ng-if="health.db.error" colspan="2" class="alert alert-error" >{{ health.db.error }}</td></tr>
<tr ng-repeat-start="(dbname, db) in health.db" ng-if="dbname != 'status' && dbname != 'error' && dbname != 'database' && dbname != 'hello'" >
<td>{{ dbname | capitalize }} Datasource</td><td><span class="status-{{db.status}}">{{ db.status }}</span><br>
{{db.database}}
</td>
</tr>
<tr ng-repeat-end ng-if="db.error"><td colspan="2" class="alert alert-error" >{{ db.error }}</td></tr>
<tr ng-if="health.diskSpace">
<td>Diskspace</td><td><span class="status-{{health.diskSpace.status}}">{{ health.diskSpace.status }}</span><br>
{{ health.diskSpace.free / 1024 / 1024 | number:0 }}M free / {{ health.diskSpace.threshold / 1024 / 1024 | number:0 }}M threshold
</td>
</tr>
</tbody>
</table>
</div>
<div class="span6">
<table class="table">
<thead><tr><th colspan="2">Memory</th></tr></thead>
......
......@@ -29,7 +29,7 @@
</thead>
<tbody>
<tr>
<td> {{gaugeData.length}}
<td>
<div class="center-block" style="width: 800px; height: {{ 75 + gaugeData[0].values.length * ( gaugeData.length * 10 ) }}px; position:relative; overflow: hidden;">
<nvd3-multi-bar-horizontal-chart id="gaugesChart" nodata="not available"
data="gaugeData"
......
......@@ -19,15 +19,9 @@
<tr ng-repeat="application in applications track by application.id">
<td>{{ application.id }}</td>
<td>{{ application.version }}</td>
<td><span class="status-{{application.status}}">{{ application.status }}</span></td>
<td>
<span ng-show="application.up" class="up">UP</span>
<span ng-show="application.down" class="down">DOWN</span>
<span ng-show="application.outofservice" class="oufofservice">OUT OF SERVICE</span>
<span ng-show="application.unknown" class="unknown">UNKNOWN</span>
<span ng-show="application.offline" class="offline">OFFLINE</span>
</td>
<td>
<span ng-show="application.up" style="float:right">
<span class="pull-right" ng-hide="application.status == null || application.status == 'OFFLINE'">
<a ng-disabled="!application.providesLogfile" target="_self" class="btn btn-success" ng-href="{{application.urlLogfile}}"><i class="icon-file icon-white"></i>Logfile</a>
<a ui-sref="apps.details.metrics({id: application.id})" class="btn btn-success">Details</a>
<a ui-sref="apps.logging({id: application.id})" class="btn btn-success">Logging</a>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment