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();
}
}
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;
}
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();
}
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));
}
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);
}
Aggregations