ConcurrentSkipListMap<String,MachineInfo> machines = DuccMachinesData.getInstance().getMachines();
Iterator<String> iterator = machines.keySet().iterator();
while(iterator.hasNext()) {
row = new JsonArray();
String key = iterator.next();
MachineInfo machineInfo = machines.get(key);
Properties properties = DuccDaemonRuntimeProperties.getInstance().getAgent(machineInfo.getName());
// Status
StringBuffer status = new StringBuffer();
String machineStatus = machineInfo.getStatus();
if(machineStatus.equals("down")) {
//status.append("<span class=\"health_red\""+">");
status.append(DuccHandlerUtils.down());
//status.append("</span>");
}
else if(machineStatus.equals("up")) {
//status.append("<span class=\"health_green\""+">");
status.append(DuccHandlerUtils.up());
//status.append("</span>");
}
else {
status.append(DuccHandlerUtils.unknown());
}
row.add(new JsonPrimitive(status.toString()));
// Daemon Name
String daemonName = "Agent";
row.add(new JsonPrimitive(daemonName));
// Boot Time
String bootTime = getTimeStamp(DuccCookies.getDateStyle(request),getPropertiesValue(properties,DuccDaemonRuntimeProperties.keyBootTime,""));
row.add(new JsonPrimitive(bootTime));
// Host IP
String hostIP = getPropertiesValue(properties,DuccDaemonRuntimeProperties.keyNodeIpAddress,"");
row.add(new JsonPrimitive(hostIP));
// Host Name
String hostName = machineInfo.getName();
row.add(new JsonPrimitive(hostName));
// PID
String pid = getPropertiesValue(properties,DuccDaemonRuntimeProperties.keyPid,"");
row.add(new JsonPrimitive(pid));
// Publication Size (last)
String publicationSizeLast = machineInfo.getPublicationSizeLast();
row.add(new JsonPrimitive(publicationSizeLast));
// Publication Size (max)
String publicationSizeMax = machineInfo.getPublicationSizeMax();
row.add(new JsonPrimitive(publicationSizeMax));
// Heartbeat (last)
String heartbeatLast = machineInfo.getHeartbeatLast();
row.add(new JsonPrimitive(heartbeatLast));
// Heartbeat (max)
long heartbeatMax = machineInfo.getHeartbeatMax();
if(heartbeatMax > 0) {
row.add(new JsonPrimitive(heartbeatMax));
}
else {
row.add(new JsonPrimitive(""));
}
// Heartbeat (max) TOD
String fmtHeartbeatMaxTOD = "";
long heartbeatMaxTOD = machineInfo.getHeartbeatMaxTOD();
if(heartbeatMaxTOD > 0) {
fmtHeartbeatMaxTOD = TimeStamp.simpleFormat(""+heartbeatMaxTOD);
try {
fmtHeartbeatMaxTOD = getTimeStamp(DuccCookies.getDateStyle(request),fmtHeartbeatMaxTOD);
}