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') ...@@ -21,7 +21,7 @@ angular.module('springBootAdmin')
$scope.loadData = function() { $scope.loadData = function() {
Applications.query(function(applications) { Applications.query(function(applications) {
for (var i in applications) { for (var i = 0; i< applications.length; i++) {
var app = applications[i]; var app = applications[i];
ApplicationOverview.getVersion(app); ApplicationOverview.getVersion(app);
ApplicationOverview.getHealth(app); ApplicationOverview.getHealth(app);
...@@ -57,6 +57,12 @@ angular.module('springBootAdmin') ...@@ -57,6 +57,12 @@ angular.module('springBootAdmin')
$scope.error = error; $scope.error = error;
}); });
ApplicationDetails.getHealth(application).success(function(health) {
$scope.health = health;
}).error( function(health) {
$scope.health = health;
});
ApplicationDetails.getMetrics(application).success( function(metrics) { ApplicationDetails.getMetrics(application).success( function(metrics) {
$scope.metrics = metrics; $scope.metrics = metrics;
$scope.metrics["mem.used"] = $scope.metrics["mem"] - $scope.metrics["mem.free"]; $scope.metrics["mem.used"] = $scope.metrics["mem"] - $scope.metrics["mem.free"];
......
...@@ -39,20 +39,16 @@ angular.module('springBootAdmin.services', ['ngResource']) ...@@ -39,20 +39,16 @@ angular.module('springBootAdmin.services', ['ngResource'])
}); });
} }
this.getHealth = function(app) { this.getHealth = function(app) {
return $http.get(app.url + '/health').success(function(response) { return $http.get(app.url + '/health').success(function (response) {
if (typeof(response) === 'string' && response.indexOf('ok') != -1 app.status = response.status;
|| typeof(response.status) === 'string' && }).error(function (response, httpStatus) {
(response.status.indexOf('ok') != -1 || response.status.indexOf('UP') != -1)) { if (httpStatus === 503) {
app.up = true; app.status = response.status;
} else if (typeof(response.status) === 'string' && response.status.indexOf('DOWN') != -1) { } else if (httpStatus === 404) {
app.down = true; app.status = 'OFFLINE';
} else if (typeof(response.status) === 'string' && response.status.indexOf('OUT-OF-SERVICE') != -1) {
app.outofservice = true;
} else { } else {
app.unknown = true; app.status = 'UNKNOWN';
} }
}).error(function() {
app.offline = true;
}); });
} }
this.getLogfile = function(app) { this.getLogfile = function(app) {
...@@ -78,6 +74,10 @@ angular.module('springBootAdmin.services', ['ngResource']) ...@@ -78,6 +74,10 @@ angular.module('springBootAdmin.services', ['ngResource'])
this.getEnv = function(app) { this.getEnv = function(app) {
return $http.get(app.url + '/env'); return $http.get(app.url + '/env');
} }
this.getHealth = function(app) {
return $http.get(app.url + '/health');
}
}]) }])
.service('ApplicationLogging', ['$http' , 'Jolokia', function($http, jolokia) { .service('ApplicationLogging', ['$http' , 'Jolokia', function($http, jolokia) {
var LOGBACK_MBEAN = 'ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator'; 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 { ...@@ -150,25 +150,27 @@ a:hover.spring-boot-logo span {
/** Status in Application Overview-View **/ /** Status in Application Overview-View **/
span.up { span.status-UP {
color: #00AA00; color: #00AA00;
font-weight: bold;
} }
span.offline { span.status-OFFLINE {
color: #DD0000; color: #000000;
font-weight: bold; font-weight: bold;
} }
span.down, span.outofservice { span.status-DOWN,
color: #FF8800; span.status-OUT_OF_SERVICE {
color: #DD0000;
font-weight: bold; font-weight: bold;
} }
span.unknown { span.status-UNKNOWN {
color: #DDDDDD; font-weight: bold;
color: #FF8800;
} }
/** Headings and Tabs in Detail-View **/ /** Headings and Tabs in Detail-View **/
.accordion-heading , .accordion-heading ,
.accordion-heading > a, .accordion-heading > a,
......
...@@ -13,6 +13,40 @@ ...@@ -13,6 +13,40 @@
</table> </table>
</div> </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"> <div class="span6">
<table class="table"> <table class="table">
<thead><tr><th colspan="2">Memory</th></tr></thead> <thead><tr><th colspan="2">Memory</th></tr></thead>
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
</thead> </thead>
<tbody> <tbody>
<tr> <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;"> <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" <nvd3-multi-bar-horizontal-chart id="gaugesChart" nodata="not available"
data="gaugeData" data="gaugeData"
......
...@@ -19,15 +19,9 @@ ...@@ -19,15 +19,9 @@
<tr ng-repeat="application in applications track by application.id"> <tr ng-repeat="application in applications track by application.id">
<td>{{ application.id }}</td> <td>{{ application.id }}</td>
<td>{{ application.version }}</td> <td>{{ application.version }}</td>
<td><span class="status-{{application.status}}">{{ application.status }}</span></td>
<td> <td>
<span ng-show="application.up" class="up">UP</span> <span class="pull-right" ng-hide="application.status == null || application.status == 'OFFLINE'">
<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">
<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 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.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> <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