Search in sources :

Example 1 with NodeStats

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

Example 2 with NodeStats

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;
}
Also used : NodeStats(com.emc.vipr.model.sys.healthmonitor.NodeStats) StatsRestRep(com.emc.vipr.model.sys.healthmonitor.StatsRestRep) NodeInfo(com.emc.storageos.systemservices.impl.resource.util.NodeInfo) RequestParams(com.emc.vipr.model.sys.healthmonitor.RequestParams) DiagRequestParams(com.emc.vipr.model.sys.healthmonitor.DiagRequestParams) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 3 with NodeStats

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

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

Example 5 with 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());
    }
}
Also used : NodeStats(com.emc.vipr.model.sys.healthmonitor.NodeStats) DiskStats(com.emc.vipr.model.sys.healthmonitor.DiskStats) ServiceStats(com.emc.vipr.model.sys.healthmonitor.ServiceStats) Test(org.junit.Test)

Aggregations

NodeStats (com.emc.vipr.model.sys.healthmonitor.NodeStats)7 NodeHealth (com.emc.vipr.model.sys.healthmonitor.NodeHealth)3 Test (org.junit.Test)3 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)1 NodeInfo (com.emc.storageos.systemservices.impl.resource.util.NodeInfo)1 DiagRequestParams (com.emc.vipr.model.sys.healthmonitor.DiagRequestParams)1 DiskStats (com.emc.vipr.model.sys.healthmonitor.DiskStats)1 RequestParams (com.emc.vipr.model.sys.healthmonitor.RequestParams)1 ServiceStats (com.emc.vipr.model.sys.healthmonitor.ServiceStats)1 StatsRestRep (com.emc.vipr.model.sys.healthmonitor.StatsRestRep)1 JsonObject (com.google.gson.JsonObject)1