Skip to content
This repository was archived by the owner on Mar 5, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
/nbproject/
85 changes: 84 additions & 1 deletion _site/dist/kopf.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ kopf.config(function($routeProvider, $locationProvider) {
when('/hotthreads', {
templateUrl: 'partials/hotthreads.html',
controller: 'HotThreadsController'
}).
when('/stats', {
templateUrl: 'partials/stats.html',
controller: 'statsController'
}).
otherwise({redirectTo: '/cluster'});
});
Expand Down Expand Up @@ -2230,6 +2234,41 @@ kopf.controller('SnapshotController', ['$scope', 'ConfirmDialogService',
}
]);

kopf.controller('statsController', ['$scope', 'ElasticService',
function ($scope, ElasticService) {

$scope.nodes = [];
$scope.indieces = [];
$scope.all_stats = [];

$scope.$watch(
function () {
return ElasticService.cluster;
},
function (current, previous) {
$scope.refresh();
},
true
);

$scope.initializeController = function () {
$scope.nodes = ElasticService.getNodes();
$scope.indices = ElasticService.getIndices();
};

$scope.refresh = function () {
$scope.nodes = ElasticService.getNodes();
$scope.indices = ElasticService.getIndices();
$scope.all_stats = [];

for (i = 0; i < $scope.nodes.length; i++) {
$scope.all_stats.push(
new Stats($scope.nodes[i], $scope.indices[i]));
}
};
}
]);

kopf.controller('WarmersController', [
'$scope', 'ConfirmDialogService', 'AlertService', 'AceEditorService',
'ElasticService',
Expand Down Expand Up @@ -3480,6 +3519,50 @@ function Snapshot(info) {
this.shards = info.shards;
}

function Stats(node, indice) {
var n_stats = node.stats;
var n_indices = n_stats.indices;

this.node_name = node.name;

this.store_size = n_indices.store.size_in_bytes;
this.documents = n_indices.docs.count;
this.documents_deleted = n_indices.docs.deleted / n_indices.docs.count;
this.merge_size = n_indices.merges.total_size_in_bytes;
this.merge_time = n_indices.merges.total_time_in_millis;
this.file_descriptors = n_stats.process.open_file_descriptors;
this.disk_space_used = node.disk_used_percent;
this.disk_space_free = Math.round((n_stats.fs.total.free_in_bytes / Math.pow(1024, 3)) * 100) / 100;

this.indexing = {
index: n_indices.indexing.index_time_in_millis / n_indices.indexing.index_total,
delete: n_indices.indexing.delete_time_in_millis / n_indices.indexing.delete_total
};
this.search = {
query: node.stats.indices.search.query_time_in_millis / node.stats.indices.search.query_total,
fetch: node.stats.indices.search.fetch_time_in_millis / node.stats.indices.search.fetch_total
};
this.get = {
total: node.stats.indices.get.time_in_millis / node.stats.indices.get.total,
exists: node.stats.indices.get.exists_time_in_millis / node.stats.indices.get.exists_total,
missing: node.stats.indices.get.missing_time_in_millis / node.stats.indices.get.missing_total
};
this.refresh = node.stats.indices.refresh.total_time_in_millis / node.stats.indices.refresh.total;
this.flush = node.stats.indices.flush.total_time_in_millis / node.stats.indices.flush.total;

this.field_size = node.stats.indices.fielddata.memory_size_in_bytes;
this.field_evictions = node.stats.indices.fielddata.evictions;

this.total_memory = (node.stats.os.mem.actual_used_in_bytes + node.stats.os.mem.actual_free_in_bytes) / Math.pow(1024, 3);
this.heap_size = Math.round((node.stats.jvm.mem.heap_committed_in_bytes / (Math.pow(1024, 3))) * 100) / 100;
this.heap_porcent_ram = node.stats.jvm.mem.heap_committed_in_bytes / (node.stats.os.mem.actual_used_in_bytes + node.stats.os.mem.actual_free_in_bytes);
this.heap_usage_porcent = Math.round((node.stats.jvm.mem.heap_used_in_bytes / node.stats.jvm.mem.heap_committed_in_bytes) * 1000) / 10;
this.swap_space = Math.round((node.stats.os.swap.used_in_bytes / Math.pow(1024, 2)) * 100000) / 100000;

}
;


/** TYPES **/
function Token(token, startOffset, endOffset, position) {
this.token = token;
Expand Down Expand Up @@ -5314,7 +5397,7 @@ kopf.factory('ElasticService', ['$http', '$q', '$timeout', '$location',
$http.get(host + '/_cluster/state/master_node,routing_table,blocks/',
params),
$http.get(host + '/_stats/docs,store', params),
$http.get(host + '/_nodes/stats/jvm,fs,os,process', params),
$http.get(host + '/_nodes/stats?all=1', params),
$http.get(host + '/_cluster/settings', params),
$http.get(host + '/_aliases', params),
$http.get(host + '/_cluster/health', params),
Expand Down
1 change: 1 addition & 0 deletions _site/partials/nav_bar.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<li ng-navbar-section target="cluster" text="cluster" icon="fa-sitemap"></li>
<li ng-navbar-section target="nodes" text="nodes" icon="fa-server"></li>
<li ng-navbar-section target="rest" text="rest" icon="fa-edit"></li>
<li ng-navbar-section target="stats" text="Stats" icon="fa-line-chart"></li>
<li class="">
<a target="_self" href="#" data-toggle="dropdown" class="dropdown-toggle">
<i class="fa fa-fw fa-magic"></i> more <i class="fa fa-fw fa-caret-down"></i>
Expand Down
75 changes: 75 additions & 0 deletions _site/partials/stats.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<h1>Stats</h1>

<div class="row-fluid">
<table class="table table-bordered table-condensed table-rounded overview">
<thead>
<tr><th colspan="{{ all_stats.length + 1}}">FILE SYSTEM</th></tr>
</thead>
<tbody>
<tr><th>NODE</th><th ng-repeat="stats in all_stats">{{stats.node_name}}</th></tr>
<tr><th>Store Size</th><td ng-repeat="stats in all_stats">{{stats.store_size}}</td></tr>
<tr><th>Documents</th><td ng-repeat="stats in all_stats">{{stats.documents}}</td></tr>
<tr><th>Documents Deleted</th><td ng-repeat="stats in all_stats">{{stats.documents_deleted}}</td></tr>
<tr><th>Merge Size</th><td ng-repeat="stats in all_stats">{{stats.merge_size}}</td></tr>
<tr><th>Merge Time</th><td ng-repeat="stats in all_stats">{{stats.merge_time}}</td></tr>
<tr><th>File Descriptors</th><td ng-repeat="stats in all_stats">{{stats.file_descriptors}}</td></tr>
<tr><th>Disk space used</th><td ng-repeat="stats in all_stats">{{stats.disk_space_used}} %</td></tr>
<tr><th>Disk space free</th><td ng-repeat="stats in all_stats">{{stats.disk_space_free}} GB</td></tr>
</tbody>
<tfoot></tfoot>
</table>
</div>

<div class="row-fluid">
<table class="table table-bordered table-condensed table-rounded overview">
<thead>
<tr><th colspan="{{ all_stats.length + 1}}">INDEX ACTIVITY</th></tr>
</thead>
<tbody>
<tr><th>NODE</th><th ng-repeat="stats in all_stats">{{stats.node_name}}</th></tr>
<tr><th>Indexing - Index</th><td ng-repeat="stats in all_stats">{{ stats.indexing.index}}</td></tr>
<tr><th>Indexing - Delete</th><td ng-repeat="stats in all_stats">{{ stats.indexing.delete}}</td></tr>
<tr><th>Search - Query</th><td ng-repeat="stats in all_stats">{{stats.search.query}}</td></tr>
<tr><th>Search - Fetch</th><td ng-repeat="stats in all_stats">{{stats.search.fetch}}</td></tr>
<tr><th>Get - Total</th><td ng-repeat="stats in all_stats">{{stats.get.total}}</td></tr>
<tr><th>Get - Exists</th><td ng-repeat="stats in all_stats">{{stats.get.exists}}</td></tr>
<tr><th>Get - Missing</th><td ng-repeat="stats in all_stats">{{stats.get.missing}}</td></tr>
<tr><th>Refresh</th><td ng-repeat="stats in all_stats">{{stats.refresh}}</td></tr>
<tr><th>Flush</th><td ng-repeat="stats in all_stats">{{stats.flush}}</td></tr>
</tbody>
<tfoot></tfoot>
</table>
</div>

<div class="row-fluid">
<table class="table table-bordered table-condensed table-rounded overview">
<thead>
<tr><th colspan="{{ all_stats.length + 1}}">CACHE ACTIVITY</th></tr>
</thead>
<tbody>
<tr><th>NODE</th><th ng-repeat="stats in all_stats">{{stats.node_name}}</th></tr>
<tr><th>Field Size</th><td ng-repeat="stats in all_stats">{{stats.field_size}}</td></tr>
<tr><th>Field Evictions</th><td ng-repeat="stats in all_stats">{{stats.field_evictions}}</td></tr>
</tbody>
<tfoot></tfoot>
</table>
</div>

<div class="row-fluid">
<table class="table table-bordered table-condensed table-rounded overview">
<thead>
<tr><th colspan="{{ all_stats.length + 1}}">MEMORY</th></tr>
</thead>
<tbody>
<tr><th>NODE</th><th ng-repeat="stats in all_stats">{{node.name}}</th></tr>
<tr><th>Total Memory</th><td ng-repeat="stats in all_stats">{{stats.total_memory}} GB</td></tr>
<tr><th>Heap Size</th><td ng-repeat="stats in all_stats">{{stats.heap_size}} GB</td></tr>
<tr><th>Heap % of RAM</th><td ng-repeat="stats in all_stats">{{stats.heap_porcent_ram}} %</td></tr>
<tr><th>% Heap Used</th><td ng-repeat="stats in all_stats">{{stats.heap_usage_porcent}} %</td></tr>
<tr><th>Swap Space</th><td ng-repeat="stats in all_stats">{{stats.swap_space}} MB</td></tr>
</tbody>
<tfoot></tfoot>
</table>
</div>

<!-- <td class="navbar-cluster-status-green" -->
34 changes: 34 additions & 0 deletions src/kopf/controllers/stats.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
kopf.controller('statsController', ['$scope', 'ElasticService',
function ($scope, ElasticService) {

$scope.nodes = [];
$scope.indieces = [];
$scope.all_stats = [];

$scope.$watch(
function () {
return ElasticService.cluster;
},
function (current, previous) {
$scope.refresh();
},
true
);

$scope.initializeController = function () {
$scope.nodes = ElasticService.getNodes();
$scope.indices = ElasticService.getIndices();
};

$scope.refresh = function () {
$scope.nodes = ElasticService.getNodes();
$scope.indices = ElasticService.getIndices();
$scope.all_stats = [];

for (i = 0; i < $scope.nodes.length; i++) {
$scope.all_stats.push(
new Stats($scope.nodes[i], $scope.indices[i]));
}
};
}
]);
43 changes: 43 additions & 0 deletions src/kopf/elastic/stats.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
function Stats(node, indice) {
var n_stats = node.stats;
var n_indices = n_stats.indices;

this.node_name = node.name;

this.store_size = n_indices.store.size_in_bytes;
this.documents = n_indices.docs.count;
this.documents_deleted = n_indices.docs.deleted / n_indices.docs.count;
this.merge_size = n_indices.merges.total_size_in_bytes;
this.merge_time = n_indices.merges.total_time_in_millis;
this.file_descriptors = n_stats.process.open_file_descriptors;
this.disk_space_used = node.disk_used_percent;
this.disk_space_free = Math.round((n_stats.fs.total.free_in_bytes / Math.pow(1024, 3)) * 100) / 100;

this.indexing = {
index: n_indices.indexing.index_time_in_millis / n_indices.indexing.index_total,
delete: n_indices.indexing.delete_time_in_millis / n_indices.indexing.delete_total
};
this.search = {
query: node.stats.indices.search.query_time_in_millis / node.stats.indices.search.query_total,
fetch: node.stats.indices.search.fetch_time_in_millis / node.stats.indices.search.fetch_total
};
this.get = {
total: node.stats.indices.get.time_in_millis / node.stats.indices.get.total,
exists: node.stats.indices.get.exists_time_in_millis / node.stats.indices.get.exists_total,
missing: node.stats.indices.get.missing_time_in_millis / node.stats.indices.get.missing_total
};
this.refresh = node.stats.indices.refresh.total_time_in_millis / node.stats.indices.refresh.total;
this.flush = node.stats.indices.flush.total_time_in_millis / node.stats.indices.flush.total;

this.field_size = node.stats.indices.fielddata.memory_size_in_bytes;
this.field_evictions = node.stats.indices.fielddata.evictions;

this.total_memory = (node.stats.os.mem.actual_used_in_bytes + node.stats.os.mem.actual_free_in_bytes) / Math.pow(1024, 3);
this.heap_size = Math.round((node.stats.jvm.mem.heap_committed_in_bytes / (Math.pow(1024, 3))) * 100) / 100;
this.heap_porcent_ram = node.stats.jvm.mem.heap_committed_in_bytes / (node.stats.os.mem.actual_used_in_bytes + node.stats.os.mem.actual_free_in_bytes);
this.heap_usage_porcent = Math.round((node.stats.jvm.mem.heap_used_in_bytes / node.stats.jvm.mem.heap_committed_in_bytes) * 1000) / 10;
this.swap_space = Math.round((node.stats.os.swap.used_in_bytes / Math.pow(1024, 2)) * 100000) / 100000;

}
;

4 changes: 4 additions & 0 deletions src/kopf/kopf.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ kopf.config(function($routeProvider, $locationProvider) {
when('/hotthreads', {
templateUrl: 'partials/hotthreads.html',
controller: 'HotThreadsController'
}).
when('/stats', {
templateUrl: 'partials/stats.html',
controller: 'statsController'
}).
otherwise({redirectTo: '/cluster'});
});
2 changes: 1 addition & 1 deletion src/kopf/services/elastic.js
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ kopf.factory('ElasticService', ['$http', '$q', '$timeout', '$location',
$http.get(host + '/_cluster/state/master_node,routing_table,blocks/',
params),
$http.get(host + '/_stats/docs,store', params),
$http.get(host + '/_nodes/stats/jvm,fs,os,process', params),
$http.get(host + '/_nodes/stats?all=1', params),
$http.get(host + '/_cluster/settings', params),
$http.get(host + '/_aliases', params),
$http.get(host + '/_cluster/health', params),
Expand Down