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<>();
    List<NodeStats> nodeStats = new ArrayList<>();
    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);
  }
예제 #2
0
 public ClusterStatsResponse(
     long timestamp,
     ClusterName clusterName,
     String clusterUUID,
     ClusterStatsNodeResponse[] nodes) {
   super(clusterName, null);
   this.timestamp = timestamp;
   this.clusterUUID = clusterUUID;
   nodesStats = new ClusterStatsNodes(nodes);
   indicesStats = new ClusterStatsIndices(nodes);
   for (ClusterStatsNodeResponse response : nodes) {
     // only the master node populates the status
     if (response.clusterStatus() != null) {
       status = response.clusterStatus();
       break;
     }
   }
 }
예제 #3
0
  public ClusterStatsNodes(ClusterStatsNodeResponse[] nodeResponses) {
    this.counts = new Counts();
    this.versions = new HashSet<Version>();
    this.os = new OsStats();
    this.jvm = new JvmStats();
    this.fs = new FsStats.Info();
    this.plugins = new HashSet<PluginInfo>();
    this.process = new ProcessStats();

    Set<InetAddress> seenAddresses = new HashSet<InetAddress>(nodeResponses.length);

    for (ClusterStatsNodeResponse nodeResponse : nodeResponses) {

      counts.addNodeInfo(nodeResponse.nodeInfo());
      versions.add(nodeResponse.nodeInfo().getVersion());
      process.addNodeStats(nodeResponse.nodeStats());
      jvm.addNodeInfoStats(nodeResponse.nodeInfo(), nodeResponse.nodeStats());
      plugins.addAll(nodeResponse.nodeInfo().getPlugins().getInfos());

      // now do the stats that should be deduped by hardware (implemented by ip deduping)
      TransportAddress publishAddress =
          nodeResponse.nodeInfo().getTransport().address().publishAddress();
      InetAddress inetAddress = null;
      if (publishAddress.uniqueAddressTypeId() == 1) {
        inetAddress = ((InetSocketTransportAddress) publishAddress).address().getAddress();
      }

      if (!seenAddresses.add(inetAddress)) {
        continue;
      }

      os.addNodeInfo(nodeResponse.nodeInfo());
      if (nodeResponse.nodeStats().getFs() != null) {
        fs.add(nodeResponse.nodeStats().getFs().total());
      }
    }
  }