use of com.emc.vipr.model.sys.healthmonitor.ProcModels.MemoryStats in project coprhd-controller by CoprHD.
the class SystemHealth method healthDetails.
private static Map<String, Object> healthDetails(NodeStats nodeStats, NodeHealth nodeHealth) {
MemoryStats memoryStats = nodeStats.getMemoryStats();
DataDiskStats dataDiskStats = nodeStats.getDataDiskStats();
Capacity rootCapacity = new Capacity();
Capacity dataCapacity = new Capacity();
Capacity memoryCapacity = new Capacity();
if (memoryStats != null) {
long freeMem = memoryStats.getMemFree() + memoryStats.getMemBuffers() + memoryStats.getMemCached();
memoryCapacity = new Capacity((memoryStats.getMemTotal() - freeMem), memoryStats.getMemTotal());
}
if (dataDiskStats != null) {
rootCapacity = new Capacity(dataDiskStats.getRootUsedKB(), dataDiskStats.getRootUsedKB() + dataDiskStats.getRootAvailKB());
dataCapacity = new Capacity(dataDiskStats.getDataUsedKB(), dataDiskStats.getDataUsedKB() + dataDiskStats.getDataAvailKB());
}
List<ServiceHealth> serviceHealthList = nodeHealth.getServiceHealthList();
Map<String, Integer> statusCount = getStatusCount(serviceHealthList);
Map<String, Object> nodeDetails = Maps.newHashMap();
nodeDetails.put("serviceCount", serviceHealthList.size());
nodeDetails.put("cpuLoad", nodeStats.getLoadAvgStats());
nodeDetails.put("memoryCapacity", memoryCapacity);
nodeDetails.put("rootCapacity", rootCapacity);
nodeDetails.put("dataCapacity", dataCapacity);
nodeDetails.put("statusCount", statusCount);
return nodeDetails;
}
Aggregations