Search in sources :

Example 1 with ServiceHealth

use of com.emc.vipr.model.sys.healthmonitor.ServiceHealth 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 ServiceHealth

use of com.emc.vipr.model.sys.healthmonitor.ServiceHealth 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)

Example 3 with ServiceHealth

use of com.emc.vipr.model.sys.healthmonitor.ServiceHealth in project coprhd-controller by CoprHD.

the class SystemHealth method listServicesJson.

public static void listServicesJson(String nodeId) {
    List<ServiceStats> serviceStatsList = MonitorUtils.getNodeStats(nodeId).getServiceStatsList();
    List<ServiceHealth> serviceHealthList = MonitorUtils.getNodeHealth(nodeId).getServiceHealthList();
    List<NodeServicesDataTable.Services> servicesList = Lists.newArrayList();
    for (ServiceStats service : serviceStatsList) {
        for (ServiceHealth health : serviceHealthList) {
            if (service.getServiceName().equals(health.getServiceName())) {
                servicesList.add(new NodeServicesDataTable.Services(nodeId, health, service));
            }
        }
    }
    renderJSON(DataTablesSupport.createSource(servicesList, params));
}
Also used : ServiceStats(com.emc.vipr.model.sys.healthmonitor.ServiceStats) NodeServicesDataTable(models.datatable.NodeServicesDataTable) ServiceHealth(com.emc.vipr.model.sys.healthmonitor.ServiceHealth)

Example 4 with ServiceHealth

use of com.emc.vipr.model.sys.healthmonitor.ServiceHealth in project coprhd-controller by CoprHD.

the class SystemHealth method getStatusCount.

private static Map<String, Integer> getStatusCount(List<ServiceHealth> serviceList) {
    Map<String, Integer> statusCount = Maps.newHashMap();
    // Initialize Map so with a "Good" status to have 0 services so when we display, if no other service is "Good" it will still display
    // that in UI.
    statusCount.put(Status.GOOD.toString(), 0);
    for (ServiceHealth service : serviceList) {
        Integer count = statusCount.get(service.getStatus());
        statusCount.put(service.getStatus(), (count == null) ? 1 : ++count);
    }
    return statusCount;
}
Also used : ServiceHealth(com.emc.vipr.model.sys.healthmonitor.ServiceHealth)

Example 5 with ServiceHealth

use of com.emc.vipr.model.sys.healthmonitor.ServiceHealth 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;
}
Also used : ServiceHealth(com.emc.vipr.model.sys.healthmonitor.ServiceHealth) JsonObject(com.google.gson.JsonObject) DataDiskStats(com.emc.vipr.model.sys.healthmonitor.DataDiskStats) MemoryStats(com.emc.vipr.model.sys.healthmonitor.ProcModels.MemoryStats)

Aggregations

ServiceHealth (com.emc.vipr.model.sys.healthmonitor.ServiceHealth)5 NodeHealth (com.emc.vipr.model.sys.healthmonitor.NodeHealth)2 NodeServicesDataTable (models.datatable.NodeServicesDataTable)2 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)1 DataDiskStats (com.emc.vipr.model.sys.healthmonitor.DataDiskStats)1 MemoryStats (com.emc.vipr.model.sys.healthmonitor.ProcModels.MemoryStats)1 ServiceStats (com.emc.vipr.model.sys.healthmonitor.ServiceStats)1 JsonObject (com.google.gson.JsonObject)1