Search in sources :

Example 6 with ClusterAdminClient

use of org.elasticsearch.client.ClusterAdminClient in project graylog2-server by Graylog2.

the class Cluster method getNodesStats.

public Map<String, NodeStats> getNodesStats(String... nodesIds) {
    final ClusterAdminClient clusterAdminClient = c.admin().cluster();
    final NodesStatsRequest request = clusterAdminClient.prepareNodesStats(nodesIds).request();
    final ImmutableMap.Builder<String, NodeStats> builder = ImmutableMap.builder();
    for (NodeStats nodeStats : clusterAdminClient.nodesStats(request).actionGet().getNodes()) {
        builder.put(nodeStats.getNode().id(), nodeStats);
    }
    return builder.build();
}
Also used : NodesStatsRequest(org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest) NodeStats(org.elasticsearch.action.admin.cluster.node.stats.NodeStats) ClusterAdminClient(org.elasticsearch.client.ClusterAdminClient) ImmutableMap(com.google.common.collect.ImmutableMap)

Example 7 with ClusterAdminClient

use of org.elasticsearch.client.ClusterAdminClient in project graylog2-server by Graylog2.

the class Cluster method getAllNodes.

public Map<String, NodeInfo> getAllNodes() {
    final ClusterAdminClient clusterAdminClient = c.admin().cluster();
    final NodesInfoRequest request = clusterAdminClient.prepareNodesInfo().all().request();
    final ImmutableMap.Builder<String, NodeInfo> builder = ImmutableMap.builder();
    for (NodeInfo nodeInfo : clusterAdminClient.nodesInfo(request).actionGet().getNodes()) {
        builder.put(nodeInfo.getNode().id(), nodeInfo);
    }
    return builder.build();
}
Also used : ClusterAdminClient(org.elasticsearch.client.ClusterAdminClient) NodeInfo(org.elasticsearch.action.admin.cluster.node.info.NodeInfo) NodesInfoRequest(org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest) ImmutableMap(com.google.common.collect.ImmutableMap)

Aggregations

ClusterAdminClient (org.elasticsearch.client.ClusterAdminClient)7 PutRepositoryResponse (org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse)3 ImmutableMap (com.google.common.collect.ImmutableMap)2 SnapshotMissingException (org.elasticsearch.snapshots.SnapshotMissingException)2 StorageException (com.microsoft.azure.storage.StorageException)1 URISyntaxException (java.net.URISyntaxException)1 ClusterHealthRequest (org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest)1 ClusterHealthResponse (org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse)1 NodeInfo (org.elasticsearch.action.admin.cluster.node.info.NodeInfo)1 NodesInfoRequest (org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest)1 NodeStats (org.elasticsearch.action.admin.cluster.node.stats.NodeStats)1 NodesStatsRequest (org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest)1 CreateSnapshotResponse (org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse)1 ClusterStatsNodes (org.elasticsearch.action.admin.cluster.stats.ClusterStatsNodes)1 ClusterStatsRequest (org.elasticsearch.action.admin.cluster.stats.ClusterStatsRequest)1 ClusterStatsResponse (org.elasticsearch.action.admin.cluster.stats.ClusterStatsResponse)1 PendingClusterTasksRequest (org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequest)1 PendingClusterTasksResponse (org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksResponse)1 AzureStorageService (org.elasticsearch.cloud.azure.storage.AzureStorageService)1 AzureStorageServiceImpl (org.elasticsearch.cloud.azure.storage.AzureStorageServiceImpl)1