Esempio n. 1
0
  public static String getLiveSystemOverview() {
    // get the start time
    long t = SystemStatsCollector.getStartTime();
    Date date = new Date(t);
    long duration = System.currentTimeMillis() - t;
    long minutes = duration / 60000;
    long hours = minutes / 60;
    minutes -= hours * 60;
    long days = hours / 24;
    hours -= days * 24;
    String starttime = String.format("%s (%dd %dh %dm)", date.toString(), days, hours, minutes);

    // handle the basic info page below this
    SiteTracker st = VoltDB.instance().getSiteTrackerForSnapshot();

    // get the cluster info
    String clusterinfo = st.getAllHosts().size() + " hosts ";
    clusterinfo += " with " + st.getAllSites().size() + " sites ";
    clusterinfo += " (" + st.getAllSites().size() / st.getAllHosts().size();
    clusterinfo += " per host)";

    StringBuilder sb = new StringBuilder();
    sb.append("<table class='table table-condensed'>\n");
    sb.append(
        "<tr><td>Mode                     </td><td>"
            + VoltDB.instance().getMode().toString()
            + "</td><td>\n");
    sb.append(
        "<tr><td>VoltDB Version           </td><td>"
            + VoltDB.instance().getVersionString()
            + "</td><td>\n");
    sb.append(
        "<tr><td>Buildstring              </td><td>"
            + VoltDB.instance().getBuildString()
            + "</td><td>\n");
    sb.append("<tr><td>Cluster Composition      </td><td>" + clusterinfo + "</td><td>\n");
    sb.append("<tr><td>Running Since            </td><td>" + starttime + "</td><td>\n");

    sb.append("</table>\n");

    return sb.toString();
  }