Search in sources :

Example 1 with NodeHealth

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);
    }
}
Also used : ServiceHealth(com.emc.vipr.model.sys.healthmonitor.ServiceHealth) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) NodeHealth(com.emc.vipr.model.sys.healthmonitor.NodeHealth)

Example 2 with NodeHealth

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()));
}
Also used : ArrayList(java.util.ArrayList) NodeHealth(com.emc.vipr.model.sys.healthmonitor.NodeHealth) Test(org.junit.Test)

Example 3 with NodeHealth

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());
}
Also used : NodeHealth(com.emc.vipr.model.sys.healthmonitor.NodeHealth) Test(org.junit.Test)

Example 4 with NodeHealth

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();
    }
}
Also used : NodeStats(com.emc.vipr.model.sys.healthmonitor.NodeStats) NodeHealth(com.emc.vipr.model.sys.healthmonitor.NodeHealth)

Example 5 with NodeHealth

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();
}
Also used : NodeServicesDataTable(models.datatable.NodeServicesDataTable) ServiceHealth(com.emc.vipr.model.sys.healthmonitor.ServiceHealth) NodeHealth(com.emc.vipr.model.sys.healthmonitor.NodeHealth)

Aggregations

NodeHealth (com.emc.vipr.model.sys.healthmonitor.NodeHealth)15 ViPRSystemClient (com.emc.vipr.client.ViPRSystemClient)3 NodeStats (com.emc.vipr.model.sys.healthmonitor.NodeStats)3 ClusterInfo (com.emc.vipr.model.sys.ClusterInfo)2 ServiceHealth (com.emc.vipr.model.sys.healthmonitor.ServiceHealth)2 Restrictions (controllers.deadbolt.Restrictions)2 NodesDataTable (models.datatable.NodesDataTable)2 Test (org.junit.Test)2 DualInetAddress (com.emc.storageos.coordinator.client.service.impl.DualInetAddress)1 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)1 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)1 NodeInfo (com.emc.storageos.systemservices.impl.resource.util.NodeInfo)1 LogMessageProcessor (com.emc.vipr.client.system.LogMessageProcessor)1 HealthRestRep (com.emc.vipr.model.sys.healthmonitor.HealthRestRep)1 LogMessage (com.emc.vipr.model.sys.logging.LogMessage)1 RecoveryPrecheckStatus (com.emc.vipr.model.sys.recovery.RecoveryPrecheckStatus)1 RecoveryStatus (com.emc.vipr.model.sys.recovery.RecoveryStatus)1 JsonObject (com.google.gson.JsonObject)1 ArrayList (java.util.ArrayList)1 MinorityNodeRecoveryJob (jobs.MinorityNodeRecoveryJob)1