Refine search
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()); if (getIndices() != null) { getIndices().toXContent(builder, params); if (getOs() != null) { getOs().toXContent(builder, params); if (getProcess() != null) { getProcess().toXContent(builder, params); if (getJvm() != null) { getJvm().toXContent(builder, params); if (getThreadPool() != null) { getThreadPool().toXContent(builder, params); if (getFs() != null) {
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; }
public static void toProtobuf(NodeStats stats, ProtobufSystemInfo.Section.Builder protobuf) { setAttribute(protobuf, "CPU Usage (%)", stats.getProcess().getCpu().getPercent()); setAttribute(protobuf, "Disk Available", byteCountToDisplaySize(stats.getFs().getTotal().getAvailable().getBytes())); setAttribute(protobuf, "Store Size", byteCountToDisplaySize(stats.getIndices().getStore().getSizeInBytes())); setAttribute(protobuf, "Open File Descriptors", stats.getProcess().getOpenFileDescriptors()); setAttribute(protobuf, "Max File Descriptors", stats.getProcess().getMaxFileDescriptors()); setAttribute(protobuf, "Spinning", stats.getFs().getTotal().getSpins()); setAttribute(protobuf, "JVM Heap Usage", formatPercent(stats.getJvm().getMem().getHeapUsedPercent())); setAttribute(protobuf, "JVM Heap Used", byteCountToDisplaySize(stats.getJvm().getMem().getHeapUsed().getBytes())); setAttribute(protobuf, "JVM Heap Max", byteCountToDisplaySize(stats.getJvm().getMem().getHeapMax().getBytes())); setAttribute(protobuf, "JVM Non Heap Used", byteCountToDisplaySize(stats.getJvm().getMem().getNonHeapUsed().getBytes())); setAttribute(protobuf, "JVM Threads", stats.getJvm().getThreads().getCount()); setAttribute(protobuf, "Field Data Memory", byteCountToDisplaySize(stats.getIndices().getFieldData().getMemorySizeInBytes())); setAttribute(protobuf, "Field Data Circuit Breaker Limit", byteCountToDisplaySize(stats.getBreaker().getStats(CircuitBreaker.FIELDDATA).getLimit())); setAttribute(protobuf, "Field Data Circuit Breaker Estimation", byteCountToDisplaySize(stats.getBreaker().getStats(CircuitBreaker.FIELDDATA).getEstimated())); setAttribute(protobuf, "Request Circuit Breaker Limit", byteCountToDisplaySize(stats.getBreaker().getStats(CircuitBreaker.REQUEST).getLimit())); setAttribute(protobuf, "Request Circuit Breaker Estimation", byteCountToDisplaySize(stats.getBreaker().getStats(CircuitBreaker.REQUEST).getEstimated())); setAttribute(protobuf, "Query Cache Memory", byteCountToDisplaySize(stats.getIndices().getQueryCache().getMemorySizeInBytes())); setAttribute(protobuf, "Request Cache Memory", byteCountToDisplaySize(stats.getIndices().getRequestCache().getMemorySizeInBytes())); }
@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; }
NodeInfo info = nodesInfo.getNodesMap().get(node.getId()); NodeStats stats = nodesStats.getNodesMap().get(node.getId()); JvmInfo jvmInfo = info == null ? null : info.getJvm(); JvmStats jvmStats = stats == null ? null : stats.getJvm(); FsInfo fsInfo = stats == null ? null : stats.getFs(); OsStats osStats = stats == null ? null : stats.getOs(); ProcessStats processStats = stats == null ? null : stats.getProcess(); NodeIndicesStats indicesStats = stats == null ? null : stats.getIndices(); table.addCell(node.getName()); CompletionStats completionStats = indicesStats == null ? null : stats.getIndices().getCompletion(); table.addCell(completionStats == null ? null : completionStats.getSize()); FieldDataStats fdStats = indicesStats == null ? null : stats.getIndices().getFieldData(); table.addCell(fdStats == null ? null : fdStats.getMemorySize()); table.addCell(fdStats == null ? null : fdStats.getEvictions()); table.addCell(refreshStats == null ? null : refreshStats.getListeners()); ScriptStats scriptStats = stats == null ? null : stats.getScriptStats(); table.addCell(scriptStats == null ? null : scriptStats.getCompilations()); table.addCell(scriptStats == null ? null : scriptStats.getCacheEvictions());
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 { if (!params.param("node_info_format", "default").equals("none")) { builder.field("name", getNode().name(), XContentBuilder.FieldCaseConversion.NONE); builder.field("transport_address", getNode().address().toString(), XContentBuilder.FieldCaseConversion.NONE); builder.field("host", getNode().getHostName(), XContentBuilder.FieldCaseConversion.NONE); builder.field("ip", getNode().getAddress(), XContentBuilder.FieldCaseConversion.NONE); if (!getNode().attributes().isEmpty()) { builder.startObject("attributes"); for (Map.Entry<String, String> attr : getNode().attributes().entrySet()) { builder.field(attr.getKey(), attr.getValue(), XContentBuilder.FieldCaseConversion.NONE); if (getIndices() != null) { getIndices().toXContent(builder, params); if (getOs() != null) { getOs().toXContent(builder, params); if (getProcess() != null) { getProcess().toXContent(builder, params); if (getJvm() != null) { getJvm().toXContent(builder, params); if (getThreadPool() != null) { getThreadPool().toXContent(builder, params); if (getFs() != null) { getFs().toXContent(builder, params);
for (final ThreadPoolStats.Stats threadPoolStats : nodeStats.getThreadPool()) { candidates.add(threadPoolStats.getName()); final NodeInfo info = nodesInfo.getNodesMap().get(node.getId()); final NodeStats stats = nodesStats.getNodesMap().get(node.getId()); poolThreadInfo = new HashMap<>(); ThreadPoolStats threadPoolStats = stats.getThreadPool(); for (ThreadPoolStats.Stats threadPoolStat : threadPoolStats) { poolThreadStats.put(threadPoolStat.getName(), threadPoolStat); for (ThreadPool.Info threadPoolInfo : info.getThreadPool()) { poolThreadInfo.put(threadPoolInfo.getName(), threadPoolInfo); table.addCell(node.getName()); table.addCell(node.getId()); table.addCell(node.getEphemeralId()); table.addCell(info == null ? null : info.getProcess().getId()); table.addCell(node.getHostName()); table.addCell(node.getHostAddress());
NodeInfo info = nodesInfo.getNodesMap().get(node.id()); NodeStats stats = nodesStats.getNodesMap().get(node.id()); JvmInfo jvmInfo = info == null ? null : info.getJvm(); JvmStats jvmStats = stats == null ? null : stats.getJvm(); FsInfo fsInfo = stats == null ? null : stats.getFs(); OsStats osStats = stats == null ? null : stats.getOs(); ProcessStats processStats = stats == null ? null : stats.getProcess(); NodeIndicesStats indicesStats = stats == null ? null : stats.getIndices(); table.addCell(node.name()); CompletionStats completionStats = indicesStats == null ? null : stats.getIndices().getCompletion(); table.addCell(completionStats == null ? null : completionStats.getSize()); FieldDataStats fdStats = indicesStats == null ? null : stats.getIndices().getFieldData(); table.addCell(fdStats == null ? null : fdStats.getMemorySize()); table.addCell(fdStats == null ? null : fdStats.getEvictions()); table.addCell(refreshStats == null ? null : refreshStats.getTotalTime()); ScriptStats scriptStats = stats == null ? null : stats.getScriptStats(); table.addCell(scriptStats == null ? null : scriptStats.getCompilations()); table.addCell(scriptStats == null ? null : scriptStats.getCacheEvictions());
ImmutableOpenMap.Builder<String, DiskUsage> newMostAvaiableUsages) { 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; FsInfo.Path mostAvailablePath = null; for (FsInfo.Path info : nodeStats.getFs()) { if (leastAvailablePath == null) { assert mostAvailablePath == null; String nodeId = nodeStats.getNode().getId(); String nodeName = nodeStats.getNode().getName(); if (logger.isTraceEnabled()) { logger.trace("node: [{}], most available: total disk: {}," +
private void sendNodeStats() { sendNodeFsStats(nodeStats.getFs()); sendNodeHttpStats(nodeStats.getHttp()); sendNodeJvmStats(nodeStats.getJvm()); sendNodeNetworkStats(nodeStats.getNetwork()); sendNodeOsStats(nodeStats.getOs()); sendNodeProcessStats(nodeStats.getProcess()); sendNodeTransportStats(nodeStats.getTransport()); sendNodeThreadPoolStats(nodeStats.getThreadPool()); }
ClusterStatsNodes(List<ClusterStatsNodeResponse> nodeResponses) { this.versions = new HashSet<>(); this.fs = new FsInfo.Path(); this.plugins = new HashSet<>(); Set<InetAddress> seenAddresses = new HashSet<>(nodeResponses.size()); List<NodeInfo> nodeInfos = new ArrayList<>(nodeResponses.size()); List<NodeStats> nodeStats = new ArrayList<>(nodeResponses.size()); for (ClusterStatsNodeResponse nodeResponse : nodeResponses) { nodeInfos.add(nodeResponse.nodeInfo()); nodeStats.add(nodeResponse.nodeStats()); this.versions.add(nodeResponse.nodeInfo().getVersion()); this.plugins.addAll(nodeResponse.nodeInfo().getPlugins().getPluginInfos()); // now do the stats that should be deduped by hardware (implemented by ip deduping) TransportAddress publishAddress = nodeResponse.nodeInfo().getTransport().address().publishAddress(); final InetAddress inetAddress = publishAddress.address().getAddress(); if (!seenAddresses.add(inetAddress)) { continue; } if (nodeResponse.nodeStats().getFs() != null) { this.fs.add(nodeResponse.nodeStats().getFs().getTotal()); } } this.counts = new Counts(nodeInfos); this.os = new OsStats(nodeInfos, nodeStats); this.process = new ProcessStats(nodeStats); this.jvm = new JvmStats(nodeInfos, nodeStats); this.networkTypes = new NetworkTypes(nodeInfos); }
ObjectLongHashMap<String> fields = ns.getIndices().getFieldData().getFields(); nodesFields.put(ns, fields); if (fields != null) { table.addCell(ns.getNode().id()); table.addCell(ns.getNode().getHostName()); table.addCell(ns.getNode().getHostAddress()); table.addCell(ns.getNode().getName()); table.addCell(ns.getIndices().getFieldData().getMemorySize()); ObjectLongMap<String> fields = statsEntry.getValue(); for (String fieldName : fieldNames) {
NodeInfo info = nodesInfo.getNodesMap().get(node.id()); NodeStats stats = nodesStats.getNodesMap().get(node.id()); table.startRow(); table.addCell(fullId ? node.id() : Strings.substring(node.getId(), 0, 4)); table.addCell(info == null ? null : info.getProcess().getId()); table.addCell(node.getHostName()); table.addCell(node.getHostAddress()); poolThreadInfo = new HashMap<>(14); ThreadPoolStats threadPoolStats = stats.getThreadPool(); for (ThreadPoolStats.Stats threadPoolStat : threadPoolStats) { poolThreadStats.put(threadPoolStat.getName(), threadPoolStat); for (ThreadPool.Info threadPoolInfo : info.getThreadPool()) { poolThreadInfo.put(threadPoolInfo.getName(), threadPoolInfo);
DiscoveryNode node = nodeStats.getNode(); int shardCount = allocs.getOrDefault(node.id(), 0); ByteSizeValue total = nodeStats.getFs().getTotal().getTotal(); ByteSizeValue avail = nodeStats.getFs().getTotal().getAvailable(); table.addCell(nodeStats.getIndices().getStore().getSize()); table.addCell(used < 0 ? null : new ByteSizeValue(used)); table.addCell(avail.bytes() < 0 ? null : avail); table.addCell(total.bytes() < 0 ? null : total); table.addCell(diskPercent < 0 ? null : diskPercent); table.addCell(node.getHostName()); table.addCell(node.getHostAddress()); table.addCell(node.name()); table.endRow();
static void fillDiskUsagePerNode(ESLogger logger, NodeStats[] nodeStatsArray, Map<String, DiskUsage> newLeastAvaiableUsages, Map<String, DiskUsage> newMostAvaiableUsages) { for (NodeStats nodeStats : nodeStatsArray) { if (nodeStats.getFs() == null) { logger.warn("Unable to retrieve node FS stats for {}", nodeStats.getNode().name()); } else { FsInfo.Path leastAvailablePath = null; FsInfo.Path mostAvailablePath = null; for (FsInfo.Path info : nodeStats.getFs()) { if (leastAvailablePath == null) { assert mostAvailablePath == null; String nodeId = nodeStats.getNode().id(); String nodeName = nodeStats.getNode().getName(); if (logger.isTraceEnabled()) { logger.trace("node: [{}], most available: total disk: {}, available disk: {} / least available: total disk: {}, available disk: {}",
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; }
public void memStatus() throws IOException { NodeStats[] nodeStats = client.admin().cluster().prepareNodesStats() .setJvm(true).setIndices(true).setTransport(true) .execute().actionGet().getNodes(); log("==== MEMORY ===="); log("Committed heap size: [0]=" + nodeStats[0].getJvm().getMem().getHeapCommitted() + ", [1]=" + nodeStats[1].getJvm().getMem().getHeapCommitted()); log("Used heap size: [0]=" + nodeStats[0].getJvm().getMem().getHeapUsed() + ", [1]=" + nodeStats[1].getJvm().getMem().getHeapUsed()); log("FieldData cache size: [0]=" + nodeStats[0].getIndices().getFieldData().getMemorySize() + ", [1]=" + nodeStats[1].getIndices().getFieldData().getMemorySize()); log("Query cache size: [0]=" + nodeStats[0].getIndices().getQueryCache().getMemorySize() + ", [1]=" + nodeStats[1].getIndices().getQueryCache().getMemorySize()); log(""); log("==== NETWORK ===="); log("Transport: [0]=" + nodeStats[0].getTransport().toXContent(jsonBuilder(), ToXContent.EMPTY_PARAMS).string() + ", [1]=" + nodeStats[1].getTransport().toXContent(jsonBuilder(), ToXContent.EMPTY_PARAMS).string()); log(""); }
@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; }