Search in sources :

Example 1 with RequestParams

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

Aggregations

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 NodeStats (com.emc.vipr.model.sys.healthmonitor.NodeStats)1 RequestParams (com.emc.vipr.model.sys.healthmonitor.RequestParams)1 StatsRestRep (com.emc.vipr.model.sys.healthmonitor.StatsRestRep)1