Search in sources :

Example 6 with NodesStatsRequest

use of org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest in project elasticsearch by elastic.

the class RestNodesAction method doCatRequest.

@Override
public RestChannelConsumer doCatRequest(final RestRequest request, final NodeClient client) {
    final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
    clusterStateRequest.clear().nodes(true);
    clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
    clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));
    final boolean fullId = request.paramAsBoolean("full_id", false);
    return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {

        @Override
        public void processResponse(final ClusterStateResponse clusterStateResponse) {
            NodesInfoRequest nodesInfoRequest = new NodesInfoRequest();
            nodesInfoRequest.clear().jvm(true).os(true).process(true).http(true);
            client.admin().cluster().nodesInfo(nodesInfoRequest, new RestActionListener<NodesInfoResponse>(channel) {

                @Override
                public void processResponse(final NodesInfoResponse nodesInfoResponse) {
                    NodesStatsRequest nodesStatsRequest = new NodesStatsRequest();
                    nodesStatsRequest.clear().jvm(true).os(true).fs(true).indices(true).process(true).script(true);
                    client.admin().cluster().nodesStats(nodesStatsRequest, new RestResponseListener<NodesStatsResponse>(channel) {

                        @Override
                        public RestResponse buildResponse(NodesStatsResponse nodesStatsResponse) throws Exception {
                            return RestTable.buildResponse(buildTable(fullId, request, clusterStateResponse, nodesInfoResponse, nodesStatsResponse), channel);
                        }
                    });
                }
            });
        }
    });
}
Also used : FieldDataStats(org.elasticsearch.index.fielddata.FieldDataStats) GET(org.elasticsearch.rest.RestRequest.Method.GET) FlushStats(org.elasticsearch.index.flush.FlushStats) Table(org.elasticsearch.common.Table) SegmentsStats(org.elasticsearch.index.engine.SegmentsStats) Strings(org.elasticsearch.common.Strings) DiscoveryNode(org.elasticsearch.cluster.node.DiscoveryNode) Settings(org.elasticsearch.common.settings.Settings) IndexingStats(org.elasticsearch.index.shard.IndexingStats) Locale(java.util.Locale) NodesStatsResponse(org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse) RestRequest(org.elasticsearch.rest.RestRequest) NodeClient(org.elasticsearch.client.node.NodeClient) NodeStats(org.elasticsearch.action.admin.cluster.node.stats.NodeStats) RestResponseListener(org.elasticsearch.rest.action.RestResponseListener) CompletionStats(org.elasticsearch.search.suggest.completion.CompletionStats) NodeIndicesStats(org.elasticsearch.indices.NodeIndicesStats) ScriptStats(org.elasticsearch.script.ScriptStats) MergeStats(org.elasticsearch.index.merge.MergeStats) JvmInfo(org.elasticsearch.monitor.jvm.JvmInfo) DiscoveryNodes(org.elasticsearch.cluster.node.DiscoveryNodes) FsInfo(org.elasticsearch.monitor.fs.FsInfo) RestResponse(org.elasticsearch.rest.RestResponse) OsStats(org.elasticsearch.monitor.os.OsStats) RestController(org.elasticsearch.rest.RestController) QueryCacheStats(org.elasticsearch.index.cache.query.QueryCacheStats) Collectors(java.util.stream.Collectors) NodesStatsRequest(org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest) ClusterStateResponse(org.elasticsearch.action.admin.cluster.state.ClusterStateResponse) RequestCacheStats(org.elasticsearch.index.cache.request.RequestCacheStats) JvmStats(org.elasticsearch.monitor.jvm.JvmStats) RefreshStats(org.elasticsearch.index.refresh.RefreshStats) NodesInfoRequest(org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest) TransportAddress(org.elasticsearch.common.transport.TransportAddress) ProcessStats(org.elasticsearch.monitor.process.ProcessStats) ClusterStateRequest(org.elasticsearch.action.admin.cluster.state.ClusterStateRequest) HttpInfo(org.elasticsearch.http.HttpInfo) GetStats(org.elasticsearch.index.get.GetStats) SearchStats(org.elasticsearch.index.search.stats.SearchStats) NodesInfoResponse(org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse) NodeInfo(org.elasticsearch.action.admin.cluster.node.info.NodeInfo) NetworkAddress(org.elasticsearch.common.network.NetworkAddress) RestActionListener(org.elasticsearch.rest.action.RestActionListener) NodesInfoResponse(org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse) ClusterStateResponse(org.elasticsearch.action.admin.cluster.state.ClusterStateResponse) RestResponse(org.elasticsearch.rest.RestResponse) ClusterStateRequest(org.elasticsearch.action.admin.cluster.state.ClusterStateRequest) RestActionListener(org.elasticsearch.rest.action.RestActionListener) NodesStatsRequest(org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest) NodesStatsResponse(org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse) NodesInfoRequest(org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest)

Example 7 with NodesStatsRequest

use of org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest in project elasticsearch by elastic.

the class NodeServiceTests method testHttpServerDisabled.

public void testHttpServerDisabled() {
    // test for a bug where if HTTP stats were requested but HTTP was disabled, NodeService would hit a NullPointerException
    NodesStatsResponse response = client().admin().cluster().nodesStats(new NodesStatsRequest().http(true)).actionGet();
    assertThat(response.getNodes(), hasSize(1));
}
Also used : NodesStatsResponse(org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse) NodesStatsRequest(org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest)

Example 8 with NodesStatsRequest

use of org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest in project elasticsearch by elastic.

the class InternalClusterInfoService method updateNodeStats.

/**
     * Retrieve the latest nodes stats, calling the listener when complete
     * @return a latch that can be used to wait for the nodes stats to complete if desired
     */
protected CountDownLatch updateNodeStats(final ActionListener<NodesStatsResponse> listener) {
    final CountDownLatch latch = new CountDownLatch(1);
    final NodesStatsRequest nodesStatsRequest = new NodesStatsRequest("data:true");
    nodesStatsRequest.clear();
    nodesStatsRequest.fs(true);
    nodesStatsRequest.timeout(fetchTimeout);
    client.admin().cluster().nodesStats(nodesStatsRequest, new LatchedActionListener<>(listener, latch));
    return latch;
}
Also used : NodesStatsRequest(org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest) CountDownLatch(java.util.concurrent.CountDownLatch)

Aggregations

NodesStatsRequest (org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest)8 NodeStats (org.elasticsearch.action.admin.cluster.node.stats.NodeStats)5 NodesStatsResponse (org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse)5 NodeClient (org.elasticsearch.client.node.NodeClient)5 Settings (org.elasticsearch.common.settings.Settings)5 RestController (org.elasticsearch.rest.RestController)5 RestRequest (org.elasticsearch.rest.RestRequest)5 GET (org.elasticsearch.rest.RestRequest.Method.GET)5 Table (org.elasticsearch.common.Table)4 ClusterStateRequest (org.elasticsearch.action.admin.cluster.state.ClusterStateRequest)3 ClusterStateResponse (org.elasticsearch.action.admin.cluster.state.ClusterStateResponse)3 DiscoveryNode (org.elasticsearch.cluster.node.DiscoveryNode)3 Strings (org.elasticsearch.common.Strings)3 RestResponse (org.elasticsearch.rest.RestResponse)3 RestResponseListener (org.elasticsearch.rest.action.RestResponseListener)3 Collections (java.util.Collections)2 HashMap (java.util.HashMap)2 Locale (java.util.Locale)2 Map (java.util.Map)2 Set (java.util.Set)2