private static NodeInfo toNodeInfo(NodeStats stat) { String nodeName = stat.getNode().getName(); NodeInfo info = new NodeInfo(nodeName); info.setHost(stat.getHostname()); ProtobufSystemInfo.Section.Builder section = ProtobufSystemInfo.Section.newBuilder(); section.setName("Search State"); EsStateSection.toProtobuf(stat, section); info.addSection(section.build()); return info; }
@Nullable public String getHostname() { return getNode().getHostName(); }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject("nodes"); for (NodeStats nodeStats : getNodes()) { builder.startObject(nodeStats.getNode().getId()); builder.field("timestamp", nodeStats.getTimestamp()); nodeStats.toXContent(builder, params); builder.endObject(); } builder.endObject(); return builder; }
private Table buildTable(final RestRequest request, final NodesStatsResponse nodeStatses) { Table table = getTableWithHeader(request); for (NodeStats nodeStats: nodeStatses.getNodes()) { if (nodeStats.getIndices().getFieldData().getFields() != null) { for (ObjectLongCursor<String> cursor : nodeStats.getIndices().getFieldData().getFields()) { table.startRow(); table.addCell(nodeStats.getNode().getId()); table.addCell(nodeStats.getNode().getHostName()); table.addCell(nodeStats.getNode().getHostAddress()); table.addCell(nodeStats.getNode().getName()); table.addCell(cursor.key); table.addCell(new ByteSizeValue(cursor.value)); table.endRow(); } } } return table; } }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.field("name", getNode().getName()); builder.field("transport_address", getNode().getAddress().toString()); builder.field("host", getNode().getHostName()); builder.field("ip", getNode().getAddress()); for (DiscoveryNode.Role role : getNode().getRoles()) { builder.value(role.getRoleName()); if (!getNode().getAttributes().isEmpty()) { builder.startObject("attributes"); for (Map.Entry<String, String> attrEntry : getNode().getAttributes().entrySet()) { builder.field(attrEntry.getKey(), attrEntry.getValue());
for (NodeStats nodeStats : nodeStatsArray) { if (nodeStats.getFs() == null) { logger.warn("Unable to retrieve node FS stats for {}", nodeStats.getNode().getName()); } else { FsInfo.Path leastAvailablePath = null; String nodeId = nodeStats.getNode().getId(); String nodeName = nodeStats.getNode().getName(); if (logger.isTraceEnabled()) { logger.trace("node: [{}], most available: total disk: {}," +
@Nullable public String getHostname() { return getNode().getHostName(); }
@Nullable public String getHostname() { return getNode().getHostName(); }
@Nullable public String getHostname() { return getNode().getHostName(); }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject("nodes"); for (NodeStats nodeStats : getNodes()) { builder.startObject(nodeStats.getNode().getId()); builder.field("timestamp", nodeStats.getTimestamp()); nodeStats.toXContent(builder, params); builder.endObject(); } builder.endObject(); return builder; }
@Nullable public String getHostname() { return getNode().getHostName(); }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject("nodes"); for (NodeStats nodeStats : getNodes()) { builder.startObject(nodeStats.getNode().getId()); builder.field("timestamp", nodeStats.getTimestamp()); nodeStats.toXContent(builder, params); builder.endObject(); } builder.endObject(); return builder; }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject("nodes"); for (NodeStats nodeStats : getNodes()) { builder.startObject(nodeStats.getNode().getId()); builder.field("timestamp", nodeStats.getTimestamp()); nodeStats.toXContent(builder, params); builder.endObject(); } builder.endObject(); return builder; }
final NodesStatsResponse response = client.admin().cluster().prepareNodesStats().setThreadPool(true).execute().actionGet(); final NodeStats[] nodeStats2 = response.getNodes(); for (NodeStats nodeStats3 : nodeStats2) { ThreadPoolStats stats = nodeStats3.getThreadPool(); if (stats != null) for (ThreadPoolStats.Stats threadPoolStat : stats) { System.out.println("node `" + nodeStats3.getNode().getName() + "`" + " has pool `" + threadPoolStat.getName() + "` with current queue size " + threadPoolStat.getQueue()); } }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.field("cluster_name", getClusterName().value()); builder.startObject("nodes"); for (NodeStats nodeStats : this) { builder.startObject(nodeStats.getNode().id(), XContentBuilder.FieldCaseConversion.NONE); builder.field("timestamp", nodeStats.getTimestamp()); nodeStats.toXContent(builder, params); builder.endObject(); } builder.endObject(); return builder; }
private Map<String, String> getNodesStats(NodesStatsResponse nodesStatsResponse) { Map<String, String> nodeStatsMap = new HashMap<>(); for (NodeStats stat : nodesStatsResponse.getNodes()) { try (XContentBuilder nodesStatsBuilder = XContentFactory.jsonBuilder()) { nodesStatsBuilder.humanReadable(true).prettyPrint().startObject(); stat.toXContent(nodesStatsBuilder, ToXContent.EMPTY_PARAMS); nodesStatsBuilder.endObject(); nodeStatsMap.put(stat.getNode().getName(), nodesStatsBuilder.string()); } catch (IOException e) { Exceptions.handle(e); } } return nodeStatsMap; }
private Table buildTable(final RestRequest request, final NodesStatsResponse nodeStatses) { Table table = getTableWithHeader(request); for (NodeStats nodeStats: nodeStatses.getNodes()) { if (nodeStats.getIndices().getFieldData().getFields() != null) { for (ObjectLongCursor<String> cursor : nodeStats.getIndices().getFieldData().getFields()) { table.startRow(); table.addCell(nodeStats.getNode().getId()); table.addCell(nodeStats.getNode().getHostName()); table.addCell(nodeStats.getNode().getHostAddress()); table.addCell(nodeStats.getNode().getName()); table.addCell(cursor.key); table.addCell(new ByteSizeValue(cursor.value)); table.endRow(); } } } return table; } }
private Table buildTable(final RestRequest request, final NodesStatsResponse nodeStatses) { Table table = getTableWithHeader(request); for (NodeStats nodeStats: nodeStatses.getNodes()) { if (nodeStats.getIndices().getFieldData().getFields() != null) { for (ObjectLongCursor<String> cursor : nodeStats.getIndices().getFieldData().getFields()) { table.startRow(); table.addCell(nodeStats.getNode().getId()); table.addCell(nodeStats.getNode().getHostName()); table.addCell(nodeStats.getNode().getHostAddress()); table.addCell(nodeStats.getNode().getName()); table.addCell(cursor.key); table.addCell(new ByteSizeValue(cursor.value)); table.endRow(); } } } return table; } }
DiscoveryNode node = nodeStats.getNode();
private static NodeInfo toNodeInfo(NodeStats stat) { String nodeName = stat.getNode().getName(); NodeInfo info = new NodeInfo(nodeName); info.setHost(stat.getHostname()); ProtobufSystemInfo.Section.Builder section = ProtobufSystemInfo.Section.newBuilder(); section.setName("Search State"); EsStateSection.toProtobuf(stat, section); info.addSection(section.build()); return info; }