Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (c) 2014 Spotify AB.
   *
   * Licensed to the Apache Software Foundation (ASF) under one
   * or more contributor license agreements.  See the NOTICE file
   * distributed with this work for additional information
   * regarding copyright ownership.  The ASF licenses this file
   * to you under the Apache License, Version 2.0 (the
   * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
  *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */
 
 package com.spotify.helios.common.descriptors;
 
 
Represents the Agent system information. A typical JSON representation might look like:
 {
   "architecture" : "amd64",
   "cpus" : 24,
   "dockerHost" : "unix:///var/run/docker.sock",
   "dockerCertPath" : null,
   "dockerVersion" : {
     "apiVersion" : "1.12",
     "arch" : "amd64",
     "gitCommit" : "688b5cf-dirty",
     "goVersion" : "go1.2.1",
     "kernelVersion" : "3.13.0-19-generic",
     "os" : "linux",
     "version" : "1.0.0"
   },
   "hostname" : "agenthostname",
   "loadAvg" : 0.28,
   "memoryFreeBytes" : 26494124032,
   "memoryTotalBytes" : 33421123584,
   "osName" : "Linux",
   "osVersion" : "3.13.0-19-generic",
   "swapFreeBytes" : 10737414144,
   "swapTotalBytes" : 10737414144,
   "uname" : "Linux agenthostname 3.13.0-19-generic #40-Ubuntu SMP Mon Mar 24 02:36:06 UTC ..."
 },
 
 
 @JsonIgnoreProperties(ignoreUnknown = true)
 public class HostInfo extends Descriptor {
 
   private final String hostname;
   private final String uname;
   private final String architecture;
   private final String osName;
   private final String osVersion;
   private final int cpus;
   private final double loadAvg;
   private final long memoryTotalBytes;
   private final long memoryFreeBytes;
   private final long swapTotalBytes;
   private final long swapFreeBytes;
   private final DockerVersion dockerVersion;
   private final String dockerHost;
   private final String dockerCertPath;

  

Parameters:
hostname The hostname of the agent.
uname The output of the uname command.
architecture The architecture of the Agent.
osName The name of the operating system on the Agent.
osVersion The version of the operating system (or kernel version).
cpus The number of CPUS on the machine.
loadAvg The current load average on the host.
memoryTotalBytes Total memory on the host.
memoryFreeBytes Total memory free on the host.
swapTotalBytes Total swap bytes.
swapFreeBytes Total free swap bytes.
dockerVersion Docker version.
dockerHost The docker host address.
dockerCertPath The docker certificate path.
 
   public HostInfo(@JsonProperty("hostname"final String hostname,
                   @JsonProperty("uname"final String uname,
                   @JsonProperty("architecture"final String architecture,
                   @JsonProperty("osName"final String osName,
                   @JsonProperty("osVersion"final String osVersion,
                   @JsonProperty("cpus"final int cpus,
                  @JsonProperty("loadAvg"final double loadAvg,
                  @JsonProperty("memoryTotalBytes"final long memoryTotalBytes,
                  @JsonProperty("memoryFreeBytes"final long memoryFreeBytes,
                  @JsonProperty("swapTotalBytes"final long swapTotalBytes,
                  @JsonProperty("swapFreeBytes"final long swapFreeBytes,
                  @JsonProperty("dockerVersion"final DockerVersion dockerVersion,
                  @JsonProperty("dockerHost"final String dockerHost,
                  @JsonProperty("dockerCertPath"final String dockerCertPath) {
    this. = hostname;
    this. = uname;
    this. = architecture;
    this. = osName;
    this. = osVersion;
    this. = cpus;
    this. = loadAvg;
    this. = memoryTotalBytes;
    this. = memoryFreeBytes;
    this. = swapTotalBytes;
    this. = swapFreeBytes;
    this. = dockerVersion;
    this. = dockerHost;
    this. = dockerCertPath;
  }
  public HostInfo(final Builder builder) {
    this. = builder.hostname;
    this. = builder.uname;
    this. = builder.architecture;
    this. = builder.osName;
    this. = builder.osVersion;
    this. = builder.cpus;
    this. = builder.loadAvg;
    this. = builder.memoryTotalBytes;
    this. = builder.memoryFreeBytes;
    this. = builder.swapTotalBytes;
    this. = builder.swapFreeBytes;
    this. = builder.dockerVersion;
    this. = builder.dockerHost;
    this. = builder.dockerCertPath;
  }
  public String getHostname() {
    return ;
  }
  public String getUname() {
    return ;
  }
  public String getArchitecture() {
    return ;
  }
  public String getOsName() {
    return ;
  }
  public String getOsVersion() {
    return ;
  }
  public int getCpus() {
    return ;
  }
  public double getLoadAvg() {
    return ;
  }
  public long getMemoryTotalBytes() {
    return ;
  }
  public long getMemoryFreeBytes() {
    return ;
  }
  public long getSwapTotalBytes() {
    return ;
  }
  public long getSwapFreeBytes() {
    return ;
  }
    return ;
  }
  public String getDockerHost() {
    return ;
  }
  public String getDockerCertPath() {
    return ;
  }
  public static Builder newBuilder() {
    return new Builder();
  }
  public static class Builder {
    private String hostname;
    private String uname;
    private String architecture;
    private String osName;
    private String osVersion;
    private int cpus;
    private double loadAvg;
    private long memoryTotalBytes;
    private long memoryFreeBytes;
    private long swapTotalBytes;
    private long swapFreeBytes;
    private DockerVersion dockerVersion;
    private String dockerHost;
    private String dockerCertPath;
    public Builder setHostname(final String hostname) {
      this. = hostname;
      return this;
    }
    public Builder setUname(final String uname) {
      this. = uname;
      return this;
    }
    public Builder setArchitecture(final String architecture) {
      this. = architecture;
      return this;
    }
    public Builder setOsName(final String osName) {
      this. = osName;
      return this;
    }
    public Builder setOsVersion(final String osVersion) {
      this. = osVersion;
      return this;
    }
    public Builder setCpus(final int cpus) {
      this. = cpus;
      return this;
    }
    public Builder setLoadAvg(final double loadAvg) {
      this. = loadAvg;
      return this;
    }
    public Builder setMemoryTotalBytes(final long memoryTotalBytes) {
      this. = memoryTotalBytes;
      return this;
    }
    public Builder setMemoryFreeBytes(final long memoryFreeBytes) {
      this. = memoryFreeBytes;
      return this;
    }
    public Builder setSwapTotalBytes(final long swapTotalBytes) {
      this. = swapTotalBytes;
      return this;
    }
    public Builder setSwapFreeBytes(final long swapFreeBytes) {
      this. = swapFreeBytes;
      return this;
    }
    public Builder setDockerVersion(final DockerVersion dockerVersion) {
      this. = dockerVersion;
      return this;
    }
    public Builder setDockerHost(final String dockerHost) {
      this. = dockerHost;
      return this;
    }
    public Builder setDockerCertPath(final String dockerCertPath) {
      this. = dockerCertPath;
      return this;
    }
    public HostInfo build() {
      return new HostInfo(this);
    }
  }
  public String toString() {
    return Objects.toStringHelper(this)
        .add("hostname")
        .add("uname")
        .add("architecture")
        .add("osName")
        .add("osVersion")
        .add("cpus")
        .add("loadAvg")
        .add("memoryTotalBytes")
        .add("memoryFreeBytes")
        .add("swapTotalBytes")
        .add("swapFreeBytes")
        .add("dockerVersion")
        .add("dockerHost")
        .add("dockerCertPath")
        .toString();
  }
New to GrepCode? Check out our FAQ X