sb.append("\n<server id='").append(status.name).append("'>\n");
sb.append("<hostname>").append(TServerLinkType.displayName(status.name)).append("</hostname>");
sb.append("<lastContact>").append(System.currentTimeMillis() - status.lastContact).append("</lastContact>\n");
sb.append("<osload>").append(status.osLoad).append("</osload>\n");
TableInfo summary = TableInfoUtil.summarizeTableStats(status);
sb.append("<compactions>\n");
sb.append("<major>").append("<running>").append(summary.majors.running).append("</running>").append("<queued>").append(summary.majors.queued)
.append("</queued>").append("</major>\n");
sb.append("<minor>").append("<running>").append(summary.minors.running).append("</running>").append("<queued>").append(summary.minors.queued)
.append("</queued>").append("</minor>\n");
sb.append("</compactions>\n");
sb.append("<tablets>").append(summary.tablets).append("</tablets>\n");
sb.append("<ingest>").append(summary.ingestRate).append("</ingest>\n");
sb.append("<query>").append(summary.queryRate).append("</query>\n");
sb.append("<ingestMB>").append(summary.ingestByteRate / 1000000.0).append("</ingestMB>\n");
sb.append("<queryMB>").append(summary.queryByteRate / 1000000.0).append("</queryMB>\n");
sb.append("<scans>").append(summary.scans.running + summary.scans.queued).append("</scans>");
sb.append("<scansessions>").append(Monitor.getLookupRate()).append("</scansessions>\n");
sb.append("<holdtime>").append(status.holdTime).append("</holdtime>\n");
totalIngest += summary.ingestRate;
totalQuery += summary.queryRate;
totalEntries += summary.recs;
sb.append("</server>\n");
}
sb.append("\n</servers>\n");
sb.append("\n<masterGoalState>" + Monitor.getMmi().goalState + "</masterGoalState>\n");
sb.append("\n<masterState>" + Monitor.getMmi().state + "</masterState>\n");
sb.append("\n<badTabletServers>\n");
for (Entry<String,Byte> entry : Monitor.getMmi().badTServers.entrySet()) {
sb.append(String.format("<badTabletServer id='%s' status='%s'/>\n", entry.getKey(), TabletServerState.getStateById(entry.getValue())));
}
sb.append("\n</badTabletServers>\n");
sb.append("\n<tabletServersShuttingDown>\n");
for (String server : Monitor.getMmi().serversShuttingDown) {
sb.append(String.format("<server id='%s'/>\n", server));
}
sb.append("\n</tabletServersShuttingDown>\n");
sb.append(String.format("\n<unassignedTablets>%d</unassignedTablets>\n", Monitor.getMmi().unassignedTablets));
sb.append("\n<deadTabletServers>\n");
for (DeadServer dead : Monitor.getMmi().deadTabletServers) {
sb.append(String.format("<deadTabletServer id='%s' lastChange='%d' status='%s'/>\n", dead.server, dead.lastStatus, dead.status));
}
sb.append("\n</deadTabletServers>\n");
sb.append("\n<deadLoggers>\n");
for (DeadServer dead : Monitor.getMmi().deadTabletServers) {
sb.append(String.format("<deadLogger id='%s' lastChange='%d' status='%s'/>\n", dead.server, dead.lastStatus, dead.status));
}
sb.append("\n</deadLoggers>\n");
sb.append("\n<tables>\n");
Instance instance = HdfsZooInstance.getInstance();
for (Entry<String,TableInfo> entry : tableStats.entrySet()) {
TableInfo tableInfo = entry.getValue();
sb.append("\n<table>\n");
String tableId = entry.getKey();
String tableName = "unknown";
String tableState = "unknown";