use of com.emc.vipr.model.sys.healthmonitor.NodeHealth in project coprhd-controller by CoprHD.
the class HealthMonitorService method getNodeHealth.
/**
* Method that returns node and it services health.
*
* @return NodeHealth
*/
protected NodeHealth getNodeHealth(String nodeId, String nodeName, String nodeIP, List<String> availableServices) {
try {
_log.info("List of available services: {}", availableServices);
String nodeStatus = Status.GOOD.toString();
List<ServiceHealth> serviceHealthList = NodeHealthExtractor.getServiceHealth(NodeStatsExtractor.getServiceStats(availableServices), _coordinatorClientExt.getCoordinatorClient(), nodeId);
for (ServiceHealth serviceHealth : serviceHealthList) {
if (Status.UNAVAILABLE.toString().equals(serviceHealth.getStatus()) || Status.DEGRADED.toString().equals(serviceHealth.getStatus())) {
nodeStatus = Status.DEGRADED.toString();
break;
}
}
return new NodeHealth(nodeId, nodeName, nodeIP, nodeStatus, serviceHealthList);
} catch (Exception e) {
_log.error("Internal error occurred while getting node health. {}", e);
_log.debug(ExceptionUtils.getStackTrace(e));
throw APIException.internalServerErrors.getObjectError("health for node " + nodeId, e);
}
}
use of com.emc.vipr.model.sys.healthmonitor.NodeHealth in project coprhd-controller by CoprHD.
the class HealthMonitorServiceTest method testNodeHealthWithInvalidServices.
@Test
public void testNodeHealthWithInvalidServices() {
List<String> invalidServices = new ArrayList<String>() {
{
add("syssvc");
add("mysvc");
}
};
NodeHealth nodeHealth = getNodeHealth(NODE_ID, NODE_ID, NODE_IP, invalidServices);
Assert.assertNotNull(nodeHealth);
Assert.assertTrue(Status.DEGRADED.toString().equals(nodeHealth.getStatus()));
}
use of com.emc.vipr.model.sys.healthmonitor.NodeHealth in project coprhd-controller by CoprHD.
the class HealthMonitorServiceTest method testNodeHealth.
@Test
public void testNodeHealth() {
NodeHealth nodeHealth = getNodeHealth(NODE_ID, NODE_ID, NODE_IP, AVAILABLE_SERVICES);
Assert.assertNotNull(nodeHealth);
Assert.assertEquals(NODE_ID, nodeHealth.getNodeId());
Assert.assertEquals(NODE_IP, nodeHealth.getIp());
Assert.assertNotNull(nodeHealth.getStatus());
Assert.assertNotNull(nodeHealth.getServiceHealthList());
// Test service list order
Assert.assertEquals(AVAILABLE_SERVICES.get(0), nodeHealth.getServiceHealthList().get(0).getServiceName());
}
use of com.emc.vipr.model.sys.healthmonitor.NodeHealth in project coprhd-controller by CoprHD.
the class SystemHealth method details.
public static void details(String nodeId) {
NodeStats nodeStats = MonitorUtils.getNodeStats(nodeId);
NodeHealth nodeHealth = MonitorUtils.getNodeHealth(nodeId);
if (nodeStats != null && nodeHealth != null) {
angularRenderArgs().put("nodeType", getNodeType(nodeId));
angularRenderArgs().put("diskStats", nodeStats.getDiskStatsList());
angularRenderArgs().put("nodeStatus", nodeHealth.getStatus());
angularRenderArgs().put("nodeIp", nodeStats.getIp());
renderArgs.put("healthDetails", healthDetails(nodeStats, nodeHealth));
angularRenderArgs().put("nodeId", nodeId);
angularRenderArgs().put("nodeName", nodeHealth.getNodeName());
render(nodeId);
} else {
flash.error(Messages.get("system.node.error", nodeId));
String nodeError = nodeId;
try {
nodeError = nodeHealth.getNodeName();
} catch (NullPointerException e) {
Logger.warn("Could not determine node name.");
}
flash.error(Messages.get("system.node.error", nodeError));
systemHealth();
}
}
use of com.emc.vipr.model.sys.healthmonitor.NodeHealth in project coprhd-controller by CoprHD.
the class SystemHealth method services.
public static void services(String nodeId) {
NodeHealth nodeHealth = MonitorUtils.getNodeHealth(nodeId);
if (nodeHealth != null) {
List<ServiceHealth> serviceHealthList = nodeHealth.getServiceHealthList();
if (!serviceHealthList.isEmpty()) {
renderArgs.put("dataTable", new NodeServicesDataTable());
angularRenderArgs().put("nodeStatus", nodeHealth.getStatus());
angularRenderArgs().put("serviceCount", serviceHealthList.size());
angularRenderArgs().put("statusCount", getStatusCount(serviceHealthList));
angularRenderArgs().put("nodeId", nodeId);
angularRenderArgs().put("nodeName", nodeHealth.getNodeName());
render(nodeId);
} else {
flash.error(Messages.get("system.node.services.error", nodeHealth.getNodeName()));
}
} else {
Logger.warn("Could not determine node name.");
flash.error(Messages.get("system.node.error", nodeId));
}
systemHealth();
}
Aggregations