use of com.emc.vipr.model.sys.healthmonitor.NodeStats 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.NodeStats in project coprhd-controller by CoprHD.
the class HealthMonitorService method getStats.
/**
* Get statistics of virtual machine and its active services
* Virtual machine stats include memory usage, I/O for each device,
* load average numbers
* Service stats include service memory usage, command that invoked it,
* file descriptors count and other stats (uptime, start time, thread count).
* <p/>
* If interval value is passed it will return differential disk stats: difference between first report (contains stats for the time
* since system startup) and second report (stats collected during the interval since the first report).
*
* @brief Show disk, memory, service statistics of all virtual machines
* @param nodeIds node ids for which stats are collected.
* @param nodeNames node names for which stats are collected.
* @param interval Specifies amount of time in seconds for differential stats.
* @prereq none
* @return Stats response
*/
@GET
@Path("/stats")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR, Role.SECURITY_ADMIN })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public StatsRestRep getStats(@QueryParam("node_id") List<String> nodeIds, @QueryParam("interval") int interval, @QueryParam("node_name") List<String> nodeNames) {
nodeIds = _coordinatorClientExt.combineNodeNamesWithNodeIds(nodeNames, nodeIds);
_log.info("Retrieving stats for nodes. Requested node ids: {}", nodeIds);
StatsRestRep statsRestRep = new StatsRestRep();
List<NodeInfo> nodeInfoList = ClusterNodesUtil.getClusterNodeInfo(nodeIds);
// Validate 'interval'
if (interval < 0) {
throw APIException.badRequests.parameterIsNotValid("interval");
}
RequestParams requestParams = new RequestParams(interval);
Map<String, NodeStats> nodesData = NodeDataCollector.getDataFromNodes(nodeInfoList, INTERNAL_NODE_STATS_URI, Action.POST, requestParams, NodeStats.class, null);
statsRestRep.getNodeStatsList().addAll(nodesData.values());
return statsRestRep;
}
use of com.emc.vipr.model.sys.healthmonitor.NodeStats in project coprhd-controller by CoprHD.
the class HealthMonitorServiceTest method testNodeStats.
@Test
public void testNodeStats() {
NodeStats nodeStats = getNodeStats(NODE_ID, NODE_NAME, NODE_IP, 0, AVAILABLE_SERVICES);
verifyNodeStats(nodeStats);
}
use of com.emc.vipr.model.sys.healthmonitor.NodeStats in project coprhd-controller by CoprHD.
the class HealthMonitorServiceTest method testNodeStatsWithInterval.
@Test
public void testNodeStatsWithInterval() {
NodeStats nodeStats = getNodeStats(NODE_ID, NODE_NAME, NODE_IP, 10, AVAILABLE_SERVICES);
verifyNodeStats(nodeStats);
}
use of com.emc.vipr.model.sys.healthmonitor.NodeStats in project coprhd-controller by CoprHD.
the class HealthMonitorServiceTest method testNodeStatsWithNoAvailableServices.
@Test
public void testNodeStatsWithNoAvailableServices() {
NodeStats nodeStats = getNodeStats(NODE_ID, NODE_NAME, NODE_IP, 0, null);
Assert.assertTrue(nodeStats.getDiskStatsList() != null && !nodeStats.getDiskStatsList().isEmpty());
Assert.assertTrue(nodeStats.getServiceStatsList() != null && !nodeStats.getServiceStatsList().isEmpty());
// service stats
for (ServiceStats serviceStats : nodeStats.getServiceStatsList()) {
Assert.assertTrue(serviceStats.getServiceName() != null && !serviceStats.getServiceName().isEmpty());
}
// Node stats
Assert.assertEquals(NODE_ID, nodeStats.getNodeId());
Assert.assertEquals(NODE_NAME, nodeStats.getNodeName());
Assert.assertEquals(NODE_IP, nodeStats.getIp());
Assert.assertNotNull(nodeStats.getMemoryStats().getMemFree());
// disk stats
for (DiskStats diskStats : nodeStats.getDiskStatsList()) {
Assert.assertNotNull(diskStats.getDiskId());
}
}
Aggregations