Adapt to new live API
Change-Id: I59a1027a60f7d40c1a6db34e3b2c5588ed608540
This commit is contained in:
parent
8be28e0fa5
commit
990f60c8cd
@ -18,7 +18,7 @@
|
|||||||
{
|
{
|
||||||
"type": "table",
|
"type": "table",
|
||||||
"config": {
|
"config": {
|
||||||
"title": "Hosts",
|
"title": "Open Hosts problems",
|
||||||
"cells": {
|
"cells": {
|
||||||
"text": [
|
"text": [
|
||||||
"Host",
|
"Host",
|
||||||
@ -36,9 +36,16 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"apiName": "hosts",
|
"apiName": "hosts",
|
||||||
"additionnalQueryFields": {
|
"filters": {
|
||||||
"acknowledged": 0,
|
"is": {
|
||||||
"state": 1
|
"acknowledged": [
|
||||||
|
false
|
||||||
|
],
|
||||||
|
"state": [
|
||||||
|
"DOWN",
|
||||||
|
"UNREACHABLE"
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"isWrappable": false,
|
"isWrappable": false,
|
||||||
"noRepeatCell": ""
|
"noRepeatCell": ""
|
||||||
@ -47,7 +54,7 @@
|
|||||||
{
|
{
|
||||||
"type": "table",
|
"type": "table",
|
||||||
"config": {
|
"config": {
|
||||||
"title": "Service problems",
|
"title": "Open Service problems",
|
||||||
"cells": {
|
"cells": {
|
||||||
"text": [
|
"text": [
|
||||||
"Host",
|
"Host",
|
||||||
@ -66,16 +73,19 @@
|
|||||||
"filters": {
|
"filters": {
|
||||||
"isnot": {
|
"isnot": {
|
||||||
"state": [
|
"state": [
|
||||||
0
|
"OK"
|
||||||
],
|
],
|
||||||
"host_state": [
|
"host_state": [
|
||||||
2
|
"DOWN",
|
||||||
|
"UNREACHABLE"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"is": {
|
||||||
|
"acknowledged": [
|
||||||
|
false
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionnalQueryFields": {
|
|
||||||
"acknowledged": 0
|
|
||||||
},
|
|
||||||
"isWrappable": true,
|
"isWrappable": true,
|
||||||
"noRepeatCell": "host"
|
"noRepeatCell": "host"
|
||||||
}
|
}
|
||||||
@ -83,7 +93,7 @@
|
|||||||
{
|
{
|
||||||
"type": "table",
|
"type": "table",
|
||||||
"config": {
|
"config": {
|
||||||
"title": "Hosts",
|
"title": "Hosts problems",
|
||||||
"cells": {
|
"cells": {
|
||||||
"text": [
|
"text": [
|
||||||
"Host",
|
"Host",
|
||||||
@ -104,7 +114,7 @@
|
|||||||
"filters": {
|
"filters": {
|
||||||
"isnot": {
|
"isnot": {
|
||||||
"state": [
|
"state": [
|
||||||
0
|
"UP"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -115,7 +125,7 @@
|
|||||||
{
|
{
|
||||||
"type": "table",
|
"type": "table",
|
||||||
"config": {
|
"config": {
|
||||||
"title": "Service problems",
|
"title": "Services problems",
|
||||||
"cells": {
|
"cells": {
|
||||||
"text": [
|
"text": [
|
||||||
"Host",
|
"Host",
|
||||||
@ -134,7 +144,7 @@
|
|||||||
"filters": {
|
"filters": {
|
||||||
"isnot": {
|
"isnot": {
|
||||||
"state": [
|
"state": [
|
||||||
0
|
"OK"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -40,7 +40,7 @@ angular.module('bansho.live', [])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fields.length > 0) {
|
if (fields.length > 0) {
|
||||||
query.fields = JSON.stringify(fields);
|
query.fields = fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
query.filters = JSON.stringify(filters);
|
query.filters = JSON.stringify(filters);
|
||||||
@ -58,8 +58,13 @@ angular.module('bansho.live', [])
|
|||||||
|
|
||||||
var getService = function (hostName, description) {
|
var getService = function (hostName, description) {
|
||||||
var fields = [],
|
var fields = [],
|
||||||
filters = {},
|
filters = {
|
||||||
additionnalFields = {'host_name': hostName, 'description': description};
|
'is': {
|
||||||
|
'host_name': [hostName],
|
||||||
|
'description': [description]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
additionnalFields = {};
|
||||||
|
|
||||||
return this.getObjects(fields, filters, 'services', additionnalFields)
|
return this.getObjects(fields, filters, 'services', additionnalFields)
|
||||||
.error(function () {
|
.error(function () {
|
||||||
@ -69,9 +74,14 @@ angular.module('bansho.live', [])
|
|||||||
|
|
||||||
var getHostOpenProblems = function () {
|
var getHostOpenProblems = function () {
|
||||||
var fields = ['state'],
|
var fields = ['state'],
|
||||||
filters = {},
|
filters = {
|
||||||
|
'is': {
|
||||||
|
'state': ['DOWN', 'UNREACHABLE'],
|
||||||
|
'acknowledged': [false]
|
||||||
|
}
|
||||||
|
},
|
||||||
apiName = 'hosts',
|
apiName = 'hosts',
|
||||||
additionnalFields = {'acknowledged': 0, 'state': 1};
|
additionnalFields = {};
|
||||||
|
|
||||||
return getObjects(fields, filters, apiName, additionnalFields)
|
return getObjects(fields, filters, apiName, additionnalFields)
|
||||||
.error(function () {
|
.error(function () {
|
||||||
@ -81,10 +91,17 @@ angular.module('bansho.live', [])
|
|||||||
|
|
||||||
var getServiceOpenProblems = function () {
|
var getServiceOpenProblems = function () {
|
||||||
var serviceFields = ['host_name', 'state'],
|
var serviceFields = ['host_name', 'state'],
|
||||||
serviceFilters = {'isnot': {'state': [0]}},
|
serviceFilters = {
|
||||||
serviceAdditionnalFields = {'acknowledged': 0},
|
'isnot': {
|
||||||
|
'state': ['OK']
|
||||||
|
},
|
||||||
|
'is': {
|
||||||
|
'acknowledged': [false]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
serviceAdditionnalFields = {},
|
||||||
hostFields = ['host_name', 'state'],
|
hostFields = ['host_name', 'state'],
|
||||||
hostFilters = {'isnot': {'state': [2]}},
|
hostFilters = {'isnot': {'state': ['DOWN', 'UNREACHABLE']}},
|
||||||
hostAdditionnalFields = {},
|
hostAdditionnalFields = {},
|
||||||
responsePromise = $q.defer();
|
responsePromise = $q.defer();
|
||||||
|
|
||||||
@ -115,7 +132,7 @@ angular.module('bansho.live', [])
|
|||||||
|
|
||||||
var getHostProblems = function () {
|
var getHostProblems = function () {
|
||||||
var fields = ['state'],
|
var fields = ['state'],
|
||||||
filters = {'isnot': {'state': [0]}},
|
filters = {'isnot': {'state': ['UP']}},
|
||||||
apiName = 'hosts',
|
apiName = 'hosts',
|
||||||
additionnalFields = {};
|
additionnalFields = {};
|
||||||
|
|
||||||
@ -128,7 +145,7 @@ angular.module('bansho.live', [])
|
|||||||
// This service is used to count the number of service problems
|
// This service is used to count the number of service problems
|
||||||
var getServiceProblems = function () {
|
var getServiceProblems = function () {
|
||||||
var fields = ['state'],
|
var fields = ['state'],
|
||||||
filters = {'isnot': {'state': [0]}},
|
filters = {'isnot': {'state': ['OK']}},
|
||||||
apiName = 'services',
|
apiName = 'services',
|
||||||
additionnalFields = {};
|
additionnalFields = {};
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>{{data.0.host_name}}</li>
|
<li>{{data.0.host_name}}</li>
|
||||||
<li>{{data.0.description}}</li>
|
<li>{{data.0.description}}</li>
|
||||||
|
<li>{{data.0.state}}</li>
|
||||||
<li>{{data.0.plugin_output}}</li>
|
<li>{{data.0.plugin_output}}</li>
|
||||||
<li>{{data.0.backend}}</li>
|
<li>{{data.0.backend}}</li>
|
||||||
<li>{{data.0.status}}</li>
|
<li>{{data.0.status}}</li>
|
||||||
|
@ -5,9 +5,9 @@ angular.module('bansho.table.cell_host', ['bansho.table'])
|
|||||||
.controller('CellHostCtrl', ['$scope', function ($scope) {
|
.controller('CellHostCtrl', ['$scope', function ($scope) {
|
||||||
$scope.cell_name = 'host';
|
$scope.cell_name = 'host';
|
||||||
|
|
||||||
if ($scope.entry.host_state === 0) {
|
if ($scope.entry.host_state === 'UP') {
|
||||||
$scope.state = 'state--ok';
|
$scope.state = 'state--ok';
|
||||||
} else if ($scope.entry.host_state === 1) {
|
} else if ($scope.entry.host_state === 'WARNING') {
|
||||||
$scope.state = 'state--warning';
|
$scope.state = 'state--warning';
|
||||||
} else if ($scope.entry.host_state === '') {
|
} else if ($scope.entry.host_state === '') {
|
||||||
$scope.state = '';
|
$scope.state = '';
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
<td class="{{alert_level}}" ng-controller="CellHostStatusCtrl">
|
<td ng-controller="CellHostStatusCtrl">
|
||||||
<span class="data-table__data">{{entry.host_status}}</span>
|
<span class="data-table__data">{{entry.host_state}}</span>
|
||||||
</td>
|
</td>
|
||||||
|
@ -3,24 +3,7 @@
|
|||||||
angular.module('bansho.table.cell_host_status', ['bansho.table'])
|
angular.module('bansho.table.cell_host_status', ['bansho.table'])
|
||||||
|
|
||||||
.controller('CellHostStatusCtrl', ['$scope', function ($scope) {
|
.controller('CellHostStatusCtrl', ['$scope', function ($scope) {
|
||||||
$scope.entry.host_status = "";
|
angular.noop();
|
||||||
$scope.alert_level = "";
|
|
||||||
|
|
||||||
if ($scope.entry.last_check === 0) {
|
|
||||||
$scope.alert_level = "alert alert-info";
|
|
||||||
$scope.entry.host_status = "Pending";
|
|
||||||
} else if ($scope.entry.host_state === 0) {
|
|
||||||
$scope.alert_level = "alert alert-success";
|
|
||||||
$scope.entry.host_status = "Host UP";
|
|
||||||
} else {
|
|
||||||
$scope.alert_level = "alert alert-danger";
|
|
||||||
|
|
||||||
if ($scope.entry.parents.length === 0) {
|
|
||||||
$scope.entry.host_status = "Host down";
|
|
||||||
} else {
|
|
||||||
$scope.entry.host_status = "Network outage";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.run(['tableGlobalConfig', function (tableGlobalConfig) {
|
.run(['tableGlobalConfig', function (tableGlobalConfig) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<td class="data-table__service {{state}}" ng-controller="CellServiceCheckCtrl">
|
<td class="data-table__service {{state}}" ng-controller="CellServiceCheckCtrl">
|
||||||
<dl class="data-table__data">
|
<dl class="data-table__data">
|
||||||
<dt class="data-table__service__name">
|
<dt class="data-table__service__name">
|
||||||
<a href="#/view?view=service&host_name={{entry.host_name}}&description={{entry.description}}">{{entry.description}}</a>
|
<a href="#/view?view=service&host_name={{entry.host_name}}&description={{entry.service_description}}">{{entry.service_description}}</a>
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="data-table__service__summary">{{entry.plugin_output}}</dd>
|
<dd class="data-table__service__summary">{{entry.plugin_output}}</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
angular.module('bansho.table.cell_service_check', ['bansho.table'])
|
angular.module('bansho.table.cell_service_check', ['bansho.table'])
|
||||||
|
|
||||||
.controller('CellServiceCheckCtrl', ['$scope', function ($scope) {
|
.controller('CellServiceCheckCtrl', ['$scope', function ($scope) {
|
||||||
if ($scope.entry.state === 0) {
|
if ($scope.entry.state === 'OK') {
|
||||||
$scope.state = 'state--ok';
|
$scope.state = 'state--ok';
|
||||||
} else if ($scope.entry.state === 1) {
|
} else if ($scope.entry.state === 'WARNING') {
|
||||||
$scope.state = 'state--warning';
|
$scope.state = 'state--warning';
|
||||||
} else {
|
} else {
|
||||||
$scope.state = 'state--error';
|
$scope.state = 'state--error';
|
||||||
@ -13,5 +13,5 @@ angular.module('bansho.table.cell_service_check', ['bansho.table'])
|
|||||||
}])
|
}])
|
||||||
|
|
||||||
.run(['tableGlobalConfig', function (tableGlobalConfig) {
|
.run(['tableGlobalConfig', function (tableGlobalConfig) {
|
||||||
tableGlobalConfig.cellToFieldsMap.service_check = ['state', 'description', 'plugin_output'];
|
tableGlobalConfig.cellToFieldsMap.service_check = ['state', 'service_description', 'plugin_output'];
|
||||||
}]);
|
}]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user