use of org.elasticsearch.action.admin.cluster.stats.ClusterStatsNodes in project graylog2-server by Graylog2.
the class ElasticsearchProbe method elasticsearchStats.
public ElasticsearchStats elasticsearchStats() {
final ClusterAdminClient adminClient = client.admin().cluster();
final ClusterStatsResponse clusterStatsResponse = adminClient.clusterStats(new ClusterStatsRequest()).actionGet();
final String clusterName = clusterStatsResponse.getClusterNameAsString();
final ClusterStatsNodes clusterNodesStats = clusterStatsResponse.getNodesStats();
final NodesStats nodesStats = NodesStats.create(clusterNodesStats.getCounts().getTotal(), clusterNodesStats.getCounts().getMasterOnly(), clusterNodesStats.getCounts().getDataOnly(), clusterNodesStats.getCounts().getMasterData(), clusterNodesStats.getCounts().getClient());
final IndicesStats indicesStats = IndicesStats.create(clusterStatsResponse.getIndicesStats().getIndexCount(), clusterStatsResponse.getIndicesStats().getStore().sizeInBytes(), clusterStatsResponse.getIndicesStats().getFieldData().getMemorySizeInBytes());
final PendingClusterTasksResponse pendingClusterTasksResponse = adminClient.pendingClusterTasks(new PendingClusterTasksRequest()).actionGet();
final int pendingTasksSize = pendingClusterTasksResponse.pendingTasks().size();
final List<Long> pendingTasksTimeInQueue = Lists.newArrayListWithCapacity(pendingTasksSize);
for (PendingClusterTask pendingClusterTask : pendingClusterTasksResponse) {
pendingTasksTimeInQueue.add(pendingClusterTask.getTimeInQueueInMillis());
}
final ClusterHealthResponse clusterHealthResponse = adminClient.health(new ClusterHealthRequest(indexSetRegistry.getIndexWildcards())).actionGet();
final ClusterHealth clusterHealth = ClusterHealth.create(clusterHealthResponse.getNumberOfNodes(), clusterHealthResponse.getNumberOfDataNodes(), clusterHealthResponse.getActiveShards(), clusterHealthResponse.getRelocatingShards(), clusterHealthResponse.getActivePrimaryShards(), clusterHealthResponse.getInitializingShards(), clusterHealthResponse.getUnassignedShards(), clusterHealthResponse.isTimedOut(), pendingTasksSize, pendingTasksTimeInQueue);
return ElasticsearchStats.create(clusterName, clusterHealthResponse.getStatus(), clusterHealth, nodesStats, indicesStats);
}
use of org.elasticsearch.action.admin.cluster.stats.ClusterStatsNodes in project yacy_grid_mcp by yacy.
the class ElasticsearchClient method getClusterStatsNodes.
public ClusterStatsNodes getClusterStatsNodes() {
ClusterStatsRequest clusterStatsRequest = new ClusterStatsRequestBuilder(elasticsearchClient.admin().cluster(), ClusterStatsAction.INSTANCE).request();
ClusterStatsResponse clusterStatsResponse = elasticsearchClient.admin().cluster().clusterStats(clusterStatsRequest).actionGet();
ClusterStatsNodes clusterStatsNodes = clusterStatsResponse.getNodesStats();
return clusterStatsNodes;
}
use of org.elasticsearch.action.admin.cluster.stats.ClusterStatsNodes in project yacy_grid_mcp by yacy.
the class ElasticsearchClient method getStats.
/**
* Retrieve a statistic object from the connected elasticsearch cluster
*
* @return cluster stats from connected cluster
*/
public ClusterStatsNodes getStats() {
final ClusterStatsRequest clusterStatsRequest = new ClusterStatsRequestBuilder(elasticsearchClient.admin().cluster(), ClusterStatsAction.INSTANCE).request();
final ClusterStatsResponse clusterStatsResponse = elasticsearchClient.admin().cluster().clusterStats(clusterStatsRequest).actionGet();
final ClusterStatsNodes clusterStatsNodes = clusterStatsResponse.getNodesStats();
return clusterStatsNodes;
}
Aggregations