diff --git a/app/app.js b/app/app.js index 0167912..a47fe0d 100644 --- a/app/app.js +++ b/app/app.js @@ -16,7 +16,9 @@ angular.module('bansho', [ 'bansho.view.dashboard', 'bansho.view.singleTable', 'bansho.view.host', - 'bansho.view.service' + 'bansho.view.service', + 'bansho.view.drupalDashboard', + 'bansho.view.drupal' ]) .config(['$routeProvider', function ($routeProvider) { diff --git a/app/assets/sass/app.scss b/app/assets/sass/app.scss index 73ba480..076b4f1 100644 --- a/app/assets/sass/app.scss +++ b/app/assets/sass/app.scss @@ -60,3 +60,4 @@ // TEMPORARY MODULES //----------------------------------*/ @import 'temporary'; +@import 'temporary/temporary'; diff --git a/app/assets/sass/temporary/temporary.scss b/app/assets/sass/temporary/temporary.scss new file mode 100644 index 0000000..3a98ab1 --- /dev/null +++ b/app/assets/sass/temporary/temporary.scss @@ -0,0 +1,68 @@ +.tile__main { + background: $_color_dark_beta none repeat scroll 0 0; + //border: 1px solid; + float: left; + margin: 20px; + padding: 10px; + text-align: center; + width: 400px; +} + +.tile__main label { + color: #FFFFFF; + width: 100%; +} + +.btn-success { + background-color: #5cb85c; + border-color: #4cae4c; + color: #fff; +} + +.btn-warning { + background-color: #f0ad4e; + border-color: #eea236; + color: #fff; +} + +.btn-danger { + background-color: #d9534f; + border-color: #d43f3a; + color: #fff; +} + +.btn { + -moz-user-select: none; + background-image: none; + border: 1px solid transparent; + border-radius: 4px; + cursor: pointer; + display: inline-block; + font-size: 14px; + font-weight: 400; + line-height: 1.42857; + margin-bottom: 0; + margin: 2px; + text-align: center; + vertical-align: middle; + white-space: nowrap; +} + +.drupal-warn { + background-color: $_color_warning; +} + +.drupal-ok { + background-color: $_color_ok; +} + +.drupal-critical { + background-color: $_color_error; +} + +.drupal__dashboard__title { + margin-bottom: 15px; + margin-left: 15px; + padding: 0 15px; + color: #FFFFFF; +} diff --git a/app/components/config/config.json b/app/components/config/config.json index d9080d8..4b1d9cb 100644 --- a/app/components/config/config.json +++ b/app/components/config/config.json @@ -249,13 +249,38 @@ ] }, "host": { - "title": "Host", - "refreshInterval": 0, - "template": "host" + "title": "Host", + "refreshInterval": 0, + "template": "host" }, "service": { - "title": "Service", - "refreshInterval": 0, - "template": "service" + "title": "Service", + "refreshInterval": 0, + "template": "service" + }, + "drupal": { + "title": "Drupal", + "refreshInterval": 0, + "template": "drupal" + }, + "drupalDashboard": { + "title": "Drupal dashboard", + "refreshInterval": 0, + "template": "drupal_dashboard", + "servicesMap": { + "drupal_cache": "Drupal cache", + "drupal_codebase": "Drupal codebase", + "drupal_cron": "Drupal cron", + "drupal_database": "Drupal Database", + "drupal_extensions": "Drupal Extensions", + "drupal_logging": "Drupal logging", + "drupal_security": "Drupal security", + "drupal_status": "Drupal status", + "drupal_views": "Drupal views" + }, + "hostsMap": { + "drupal": "Wonderful Drupal Website" + }, + "hideStatusOk": false } } diff --git a/app/index.html b/app/index.html index c9a3a3e..b9deb7d 100644 --- a/app/index.html +++ b/app/index.html @@ -87,6 +87,8 @@ + + diff --git a/app/templates/drupal/drupal.html b/app/templates/drupal/drupal.html new file mode 100644 index 0000000..5bf32a0 --- /dev/null +++ b/app/templates/drupal/drupal.html @@ -0,0 +1,116 @@ +
+

{{drupal_id}}

+
+
+

General informations

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Core version :7.37
Core up-to-date :YES
Vulnerable core :NO
JQuery version:2.1.4
Database :MySQL
Database version :5.6.23
Database state :OK
Cache activated :YES
+
+ +
+

Database 100%

+ + + + + + + + + + + + + + + + + + + +
Total size35.54 Mb
CollationsEvery tables are using UTF-8
Storage EnginesAll tables are using innoDB
Tables over 1000 rows20
+
+ +
+

Cache 17%

+ + + + + + + + + + + + + + + + + + + + + + + +
Anonymous cachingNot enabled
Minimum cache lifetimeNone
Expiration of cached pagesNot set
Aggregate and compress CSSNot enabled
Aggregate JavascriptNot enabled
+
+ +
+

Cron jobs 100%

+ + + + + + + + + + + + + + + +
Crontab statusEnabled
RunningNo
Last run24 min 51 sec ago
+
+
+
diff --git a/app/templates/drupal/drupal.js b/app/templates/drupal/drupal.js new file mode 100644 index 0000000..4315cf5 --- /dev/null +++ b/app/templates/drupal/drupal.js @@ -0,0 +1,12 @@ +"use strict"; + +angular.module("bansho.view.drupal", []) + + .controller("DrupalViewCtrl", ["$scope", "$routeParams", + function ($scope, $routeParams) { + if (!!$routeParams.id) { + $scope.drupal_id = $routeParams.id; + } else { + throw new Error("ERROR: 'id' GET parameter required"); + } + }]); diff --git a/app/templates/drupal_dashboard/drupal_dashboard.html b/app/templates/drupal_dashboard/drupal_dashboard.html new file mode 100644 index 0000000..bc48c99 --- /dev/null +++ b/app/templates/drupal_dashboard/drupal_dashboard.html @@ -0,0 +1,40 @@ +
+

Drupal dashboard

+ + + +
+

{{host.host_text}}

+ +
+
+
+ + +
+

Site B

+ + + +
+
+ +
+

Site C

+ + + +
+
+ +
+

Site D

+ + + +
+
+
diff --git a/app/templates/drupal_dashboard/drupal_dashboard.js b/app/templates/drupal_dashboard/drupal_dashboard.js new file mode 100644 index 0000000..5614945 --- /dev/null +++ b/app/templates/drupal_dashboard/drupal_dashboard.js @@ -0,0 +1,66 @@ +"use strict"; + +angular.module("bansho.view.drupalDashboard", []) + + .controller("DrupalDashboardViewCtrl", ["$scope", "$routeParams", 'surveilStatus', 'configManager', + function ($scope, $routeParams, surveilStatus, configManager) { + var out_data = [], + config = configManager.readConfig()[$routeParams.view], + hostsMap = config.hostsMap, + servicesMap = config.servicesMap, + hideStatusOk = config.hideStatusOk, + filters = {}, + hosts = []; + + angular.forEach(hostsMap, function (host_text, host_name) { + hosts.push(host_name); + }); + + filters = {'is': {'host_name': hosts}}; + + surveilStatus.getObjects([], filters, 'services').success(function (services) { + + for (var i = 0; i < services.length; i++) { + var index, + service = services[i], + service_out = {}; + + // Look if host_name already in the array + for (var j = 0; j < out_data.length; j++) { + if (service.host_name === out_data[j].host_name) { + index = j; + break; + } + } + + if (index === undefined) { + out_data.push({'host_name': service.host_name}); + index = out_data.length - 1; + out_data[index].host_text = hostsMap[service.host_name]; + } + + if (!('services' in out_data[index])) { + out_data[index].services = []; + } + + out_data[index].services.push({}); + service_out = out_data[index].services[out_data[index].services.length - 1]; + service_out.description = servicesMap[service.service_description]; + + if (service.state === 'CRITICAL') { + service_out.state = 'btn-danger'; + } else if (service.state === 'WARNING') { + service_out.state = 'btn-warning'; + } else if (service.state === 'OK') { + if (hideStatusOk) { + service_out.hide = true; + } + service_out.state = 'btn-success'; + } else { + service_out.state = ''; + } + } + + $scope.data = out_data; + }); + }]);