Search in sources :

Example 6 with NodeHealth

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

the class SystemHealth method nodeReboot.

@Restrictions({ @Restrict("SYSTEM_ADMIN"), @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void nodeReboot(@Required String nodeId) {
    NodeHealth nodeHealth = MonitorUtils.getNodeHealth(nodeId);
    String node = nodeId;
    try {
        node = MonitorUtils.getNodeHealth(nodeId).getNodeName();
    } catch (NullPointerException e) {
        Logger.warn("Could not determine node name.");
    }
    if (nodeHealth != null && nodeHealth.getStatus().equals("Good")) {
        new RebootNodeJob(getSysClient(), nodeId).in(3);
        flash.success(Messages.get("adminDashboard.nodeRebooting", node));
        Maintenance.maintenance(Common.reverseRoute(SystemHealth.class, "systemHealth"));
    } else {
        flash.error(Messages.get("systemHealth.message.reboot.unavailable", node));
        systemHealth();
    }
}
Also used : RebootNodeJob(jobs.RebootNodeJob) NodeHealth(com.emc.vipr.model.sys.healthmonitor.NodeHealth) Restrictions(controllers.deadbolt.Restrictions)

Example 7 with NodeHealth

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

the class HealthMonitorService method getHealth.

/**
 * Gets health of node and its services.
 * <p/>
 * Node health status: Good - when node is reachable and all its services are GOOD Unavailable - when node is not reachable Degraded -
 * when node is reachable and any of its service is Unavailable/Degraded Node/syssvc Unavailable - when node is down or syssvc is not
 * Unavailable on the node
 * <p/>
 * Service health status: Good - when a service is up and running Unavailable - when a service is not running but is registered in
 * coordinator Restarted - when service is restarting
 *
 * @brief Show service health of all virtual machines
 * @param nodeIds node ids for which health stats are collected.
 * @param nodeNames node names for which health stats are collected.
 * @prereq none
 * @return Health response.
 */
@GET
@Path("/health")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR, Role.SECURITY_ADMIN })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public HealthRestRep getHealth(@QueryParam("node_id") List<String> nodeIds, @QueryParam("node_name") List<String> nodeNames) {
    HealthRestRep healthRestRep = new HealthRestRep();
    List<NodeHealth> nodehealthList = healthRestRep.getNodeHealthList();
    nodeIds = _coordinatorClientExt.combineNodeNamesWithNodeIds(nodeNames, nodeIds);
    // Collecting data from all nodes
    List<NodeInfo> nodeInfoList = ClusterNodesUtil.getClusterNodeInfo(nodeIds);
    Map<String, NodeHealth> nodesData = NodeDataCollector.getDataFromNodes(nodeInfoList, INTERNAL_NODE_HEALTH_URI, Action.GET, null, NodeHealth.class, null);
    nodehealthList.addAll(nodesData.values());
    String thisNodeId = _coordinatorClientExt.getMyNodeId();
    if (thisNodeId.equals("standalone")) {
        return healthRestRep;
    }
    Map<String, DualInetAddress> ipLookupTable = _coordinatorClientExt.getCoordinatorClient().getInetAddessLookupMap().getControllerNodeIPLookupMap();
    // get all nodes if the input param is empty
    if (nodeIds == null || nodeIds.isEmpty()) {
        int clusterNodeCount = _coordinatorClientExt.getNodeCount();
        nodeIds = new ArrayList<>();
        for (int i = 1; i <= clusterNodeCount; i++) {
            String nodeId = "vipr" + i;
            nodeIds.add(nodeId);
        }
    }
    // Adding health for nodes that are not returned
    for (String nodeId : nodeIds) {
        DualInetAddress ip = ipLookupTable.get(nodeId);
        if (!nodesData.containsKey(nodeId)) {
            String nodeName = _coordinatorClientExt.getPropertyInfo().getProperty("node_" + nodeId.replace("vipr", "") + "_name");
            nodehealthList.add(new NodeHealth(nodeId, nodeName, ip.toString(), Status.NODE_OR_SYSSVC_UNAVAILABLE.toString()));
        }
    }
    return healthRestRep;
}
Also used : NodeInfo(com.emc.storageos.systemservices.impl.resource.util.NodeInfo) HealthRestRep(com.emc.vipr.model.sys.healthmonitor.HealthRestRep) DualInetAddress(com.emc.storageos.coordinator.client.service.impl.DualInetAddress) NodeHealth(com.emc.vipr.model.sys.healthmonitor.NodeHealth) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 8 with NodeHealth

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

the class SystemHealth method systemHealth.

public static void systemHealth() {
    final ViPRSystemClient client = BourneUtil.getSysClient();
    List<NodeHealth> nodeHealthList = MonitorUtils.getNodeHealth(client);
    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 (NodeHealth nodeHealth : nodeHealthList) {
        Integer count = statusCount.get(nodeHealth.getStatus());
        statusCount.put(nodeHealth.getStatus(), (count == null) ? 1 : ++count);
    }
    renderArgs.put("allServices", getAllServiceNames(nodeHealthList));
    angularRenderArgs().put("clusterInfo", AdminDashboardUtils.getClusterInfo());
    renderArgs.put("dataTable", new NodesDataTable());
    angularRenderArgs().put("nodeCount", nodeHealthList.size());
    angularRenderArgs().put("statusCount", statusCount);
    render();
}
Also used : ViPRSystemClient(com.emc.vipr.client.ViPRSystemClient) NodesDataTable(models.datatable.NodesDataTable) NodeHealth(com.emc.vipr.model.sys.healthmonitor.NodeHealth)

Example 9 with NodeHealth

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

the class SystemHealth method listNodesJson.

public static void listNodesJson() {
    List<NodesDataTable.Nodes> dataTableNodes = Lists.newArrayList();
    for (NodeHealth node : MonitorUtils.getNodeHealth()) {
        String type = getNodeType(node.getNodeId());
        dataTableNodes.add(new NodesDataTable.Nodes(node, type));
    }
    renderJSON(DataTablesSupport.createSource(dataTableNodes, params));
}
Also used : NodesDataTable(models.datatable.NodesDataTable) NodeHealth(com.emc.vipr.model.sys.healthmonitor.NodeHealth)

Example 10 with NodeHealth

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

the class SystemHealth method nodeDetails.

public static void nodeDetails(String nodeId) {
    NodeStats nodeStats = MonitorUtils.getNodeStats(nodeId);
    NodeHealth nodeHealth = MonitorUtils.getNodeHealth(nodeId);
    if (nodeStats != null && nodeHealth != null) {
        renderArgs.put("healthDetails", healthDetails(nodeStats, nodeHealth));
    }
    render(nodeId);
}
Also used : NodeStats(com.emc.vipr.model.sys.healthmonitor.NodeStats) 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