Search in sources :

Example 1 with RecoverPointStatisticsResponse

use of com.emc.storageos.recoverpoint.responses.RecoverPointStatisticsResponse in project coprhd-controller by CoprHD.

the class RecoverPointClient method getRPSystemStatistics.

/**
 * Get RP site statistics for use in collectStatisticsInformation
 *
 * @param RecoverPointVolumeProtectionInfo copyToModify - Volume info for the CG to add a journal volume to
 *
 * @param String journalWWNToDelete - WWN of the journal volume to delete
 *
 * @return RecoverPointStatisticsResponse
 *
 * @throws RecoverPointException
 */
public RecoverPointStatisticsResponse getRPSystemStatistics() throws RecoverPointException {
    logger.info("Collecting RecoverPoint System Statistics.");
    RecoverPointStatisticsResponse response = new RecoverPointStatisticsResponse();
    try {
        Map<Long, Double> siteAvgCPUUsageMap = new HashMap<Long, Double>();
        Map<Long, Long> siteInputAvgThroughput = new HashMap<Long, Long>();
        Map<Long, Long> siteOutputAvgThroughput = new HashMap<Long, Long>();
        Map<Long, Long> siteIncomingAvgWrites = new HashMap<Long, Long>();
        SystemStatistics systemStatistics = functionalAPI.getSystemStatistics();
        Set<ClusterUID> ClusterUIDList = new HashSet<ClusterUID>();
        List<RpaStatistics> rpaStatisticsList = systemStatistics.getRpaStatistics();
        for (RpaStatistics rpaStatistics : rpaStatisticsList) {
            ClusterUID siteID = rpaStatistics.getRpaUID().getClusterUID();
            boolean foundSite = false;
            for (ClusterUID siteListUID : ClusterUIDList) {
                if (siteID.getId() == siteListUID.getId()) {
                    foundSite = true;
                    break;
                }
            }
            if (!foundSite) {
                ClusterUIDList.add(siteID);
            }
        }
        for (ClusterUID ClusterUID : ClusterUIDList) {
            List<Double> rpaCPUList = new LinkedList<Double>();
            List<Long> rpaSiteInputAvgThroughputList = new LinkedList<Long>();
            List<Long> rpaSiteOutputAvgThroughputList = new LinkedList<Long>();
            List<Long> rpaSiteInputAvgIncomingWritesList = new LinkedList<Long>();
            for (RpaStatistics rpaStatistics : rpaStatisticsList) {
                if (rpaStatistics.getRpaUID().getClusterUID().getId() == ClusterUID.getId()) {
                    rpaCPUList.add(Double.valueOf(rpaStatistics.getCpuUsage()));
                    rpaSiteInputAvgThroughputList.add(rpaStatistics.getTraffic().getApplicationThroughputStatistics().getInThroughput());
                    for (ConnectionOutThroughput cot : rpaStatistics.getTraffic().getApplicationThroughputStatistics().getConnectionsOutThroughputs()) {
                        rpaSiteOutputAvgThroughputList.add(cot.getOutThroughput());
                    }
                    rpaSiteInputAvgIncomingWritesList.add(rpaStatistics.getTraffic().getApplicationIncomingWrites());
                }
            }
            Double cpuTotalUsage = 0.0;
            Long incomingWritesTotal = Long.valueOf(0);
            Long inputThoughputTotal = Long.valueOf(0);
            Long outputThoughputTotal = Long.valueOf(0);
            for (Double rpaCPUs : rpaCPUList) {
                cpuTotalUsage += rpaCPUs;
            }
            for (Long siteInputThroughput : rpaSiteInputAvgThroughputList) {
                inputThoughputTotal += siteInputThroughput;
            }
            for (Long siteOutputThroughput : rpaSiteOutputAvgThroughputList) {
                outputThoughputTotal += siteOutputThroughput;
            }
            for (Long incomingWrites : rpaSiteInputAvgIncomingWritesList) {
                incomingWritesTotal += incomingWrites;
            }
            logger.info("Average CPU usage for site: " + ClusterUID.getId() + " is " + cpuTotalUsage / rpaCPUList.size());
            logger.info("Average input throughput for site: " + ClusterUID.getId() + " is " + inputThoughputTotal / rpaCPUList.size() + " kb/s");
            logger.info("Average output throughput for site: " + ClusterUID.getId() + " is " + outputThoughputTotal / rpaCPUList.size() + " kb/s");
            logger.info("Average incoming writes for site: " + ClusterUID.getId() + " is " + incomingWritesTotal / rpaCPUList.size() + " writes/s");
            siteAvgCPUUsageMap.put(ClusterUID.getId(), cpuTotalUsage / rpaCPUList.size());
            siteInputAvgThroughput.put(ClusterUID.getId(), inputThoughputTotal / rpaCPUList.size());
            siteOutputAvgThroughput.put(ClusterUID.getId(), outputThoughputTotal / rpaCPUList.size());
            siteIncomingAvgWrites.put(ClusterUID.getId(), incomingWritesTotal / rpaCPUList.size());
        }
        response.setSiteCPUUsageMap(siteAvgCPUUsageMap);
        response.setSiteInputAvgIncomingWrites(siteIncomingAvgWrites);
        response.setSiteOutputAvgThroughput(siteOutputAvgThroughput);
        response.setSiteInputAvgThroughput(siteInputAvgThroughput);
        List<ProtectionSystemParameters> systemParameterList = new LinkedList<ProtectionSystemParameters>();
        MonitoredParametersStatus monitoredParametersStatus = functionalAPI.getMonitoredParametersStatus();
        List<MonitoredParameter> monitoredParameterList = monitoredParametersStatus.getParameters();
        for (MonitoredParameter monitoredParameter : monitoredParameterList) {
            ProtectionSystemParameters param = response.new ProtectionSystemParameters();
            param.parameterName = monitoredParameter.getKey().getParameterType().value();
            param.parameterLimit = monitoredParameter.getValue().getParameterWaterMarks().getLimit();
            param.currentParameterValue = monitoredParameter.getValue().getValue();
            if (monitoredParameter.getKey().getClusterUID() != null) {
                param.siteID = monitoredParameter.getKey().getClusterUID().getId();
            }
            systemParameterList.add(param);
        }
        response.setParamList(systemParameterList);
        for (ProtectionSystemParameters monitoredParameter : response.getParamList()) {
            logger.info("Key: " + monitoredParameter.parameterName);
            logger.info("Current Value: " + monitoredParameter.currentParameterValue);
            logger.info("Max Value: " + monitoredParameter.parameterLimit);
        }
        return response;
    } catch (FunctionalAPIActionFailedException_Exception e) {
        throw RecoverPointException.exceptions.failedToGetStatistics(e);
    } catch (FunctionalAPIInternalError_Exception e) {
        throw RecoverPointException.exceptions.failedToGetStatistics(e);
    } catch (Exception e) {
        throw RecoverPointException.exceptions.failedToGetStatistics(e);
    }
}
Also used : RpaStatistics(com.emc.fapiclient.ws.RpaStatistics) ProtectionSystemParameters(com.emc.storageos.recoverpoint.responses.RecoverPointStatisticsResponse.ProtectionSystemParameters) HashMap(java.util.HashMap) HashSet(java.util.HashSet) FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) ConnectionOutThroughput(com.emc.fapiclient.ws.ConnectionOutThroughput) MonitoredParameter(com.emc.fapiclient.ws.MonitoredParameter) LinkedList(java.util.LinkedList) FunctionalAPIValidationException_Exception(com.emc.fapiclient.ws.FunctionalAPIValidationException_Exception) FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) RecoverPointException(com.emc.storageos.recoverpoint.exceptions.RecoverPointException) RecoverPointStatisticsResponse(com.emc.storageos.recoverpoint.responses.RecoverPointStatisticsResponse) ClusterUID(com.emc.fapiclient.ws.ClusterUID) FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) SystemStatistics(com.emc.fapiclient.ws.SystemStatistics) MonitoredParametersStatus(com.emc.fapiclient.ws.MonitoredParametersStatus)

Example 2 with RecoverPointStatisticsResponse

use of com.emc.storageos.recoverpoint.responses.RecoverPointStatisticsResponse in project coprhd-controller by CoprHD.

the class RPDeviceController method collectRPStatistics.

/**
 * Collects the RP statistics for the given <code>ProtectionSystem</code>.
 *
 * @param protectionSystem
 * @throws InternalException
 */
private void collectRPStatistics(ProtectionSystem protectionSystem) throws InternalException {
    RecoverPointClient rpClient = RPHelper.getRecoverPointClient(protectionSystem);
    Set<RPSite> rpSites = rpClient.getAssociatedRPSites();
    RecoverPointStatisticsResponse response = rpClient.getRPSystemStatistics();
    _rpStatsHelper.updateProtectionSystemMetrics(protectionSystem, rpSites, response, _dbClient);
}
Also used : RecoverPointClient(com.emc.storageos.recoverpoint.impl.RecoverPointClient) RPSite(com.emc.storageos.recoverpoint.objectmodel.RPSite) RecoverPointStatisticsResponse(com.emc.storageos.recoverpoint.responses.RecoverPointStatisticsResponse)

Example 3 with RecoverPointStatisticsResponse

use of com.emc.storageos.recoverpoint.responses.RecoverPointStatisticsResponse in project coprhd-controller by CoprHD.

the class RPCommunicationInterface method discoverRPSystem.

/**
 * For an RP configuration, get some basic discovery information
 *
 * @param protectionSystem RP system
 * @return command result object, object list [0] has List<SiteArrays>
 * @throws RecoverPointException
 */
public BiosCommandResult discoverRPSystem(ProtectionSystem protectionSystem) throws RecoverPointException {
    _log.info("discoverRPSystem {} - start", protectionSystem.getId());
    RecoverPointClient rp = RPHelper.getRecoverPointClient(protectionSystem);
    Set<RPSite> rpSites = rp.getAssociatedRPSites();
    // If there are no associated RP Sites for the this IP, throw an exception.
    if (rpSites == null || rpSites.isEmpty()) {
        throw DeviceControllerExceptions.recoverpoint.noAssociatedRPSitesFound(protectionSystem.getIpAddress());
    }
    RPSite firstRpSite = rpSites.iterator().next();
    // Update the protection system metrics
    RecoverPointStatisticsResponse response = rp.getRPSystemStatistics();
    _rpStatsHelper.updateProtectionSystemMetrics(protectionSystem, rpSites, response, _dbClient);
    _log.info("discoverRPSystem {} - complete", protectionSystem.getId());
    BiosCommandResult result = new BiosCommandResult();
    result.setCommandSuccess(true);
    result.setCommandStatus(Operation.Status.ready.name());
    List<Object> returnList = new ArrayList<Object>();
    String serialNumber = firstRpSite.getSiteGUID();
    // Don't include the site id at the end of the serial number for the RP System serial number.
    protectionSystem.setInstallationId(serialNumber.substring(0, serialNumber.lastIndexOf(":")));
    protectionSystem.setNativeGuid(NativeGUIDGenerator.generateNativeGuid(ProtectionSystem._RP, protectionSystem.getInstallationId()));
    // Clear out the existing cluster management IPs so they can
    // be re-populated below.
    _log.info("Clear out existing management IPs. The list will be repopulated...");
    protectionSystem.getClusterManagementIPs().clear();
    // Keep a map of the site names
    StringMap rpSiteNamesMap = new StringMap();
    for (RPSite rpSite : rpSites) {
        if (!rpSite.getSiteManagementIPv4().equals(protectionSystem.getIpAddress()) && !protectionSystem.getClusterManagementIPs().contains(rpSite.getSiteManagementIPv4())) {
            // Add cluster management IP if it's not the one we registered with, the one
            // we register is stored in ProtectionSystem.getIpAddress() and is the default
            // ip to use.
            _log.info(String.format("Adding management ip [%s] for cluster [%s] " + "to valid cluster management ip addresses.", rpSite.getSiteManagementIPv4(), rpSite.getSiteName()));
            protectionSystem.getClusterManagementIPs().add(rpSite.getSiteManagementIPv4());
        }
        rpSiteNamesMap.put(rpSite.getInternalSiteName(), rpSite.getSiteName());
    }
    protectionSystem.setRpSiteNames(rpSiteNamesMap);
    // Set the version, but verify that it is supported. If it's not an exception will be
    // thrown.
    protectionSystem.setMajorVersion(firstRpSite.getSiteVersion());
    this.verifyMinimumSupportedFirmwareVersion(protectionSystem);
    returnList.add(protectionSystem);
    result.setObjectList(returnList);
    return result;
}
Also used : StringMap(com.emc.storageos.db.client.model.StringMap) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) RecoverPointClient(com.emc.storageos.recoverpoint.impl.RecoverPointClient) ArrayList(java.util.ArrayList) RPSite(com.emc.storageos.recoverpoint.objectmodel.RPSite) DiscoveredDataObject(com.emc.storageos.db.client.model.DiscoveredDataObject) RecoverPointStatisticsResponse(com.emc.storageos.recoverpoint.responses.RecoverPointStatisticsResponse)

Aggregations

RecoverPointStatisticsResponse (com.emc.storageos.recoverpoint.responses.RecoverPointStatisticsResponse)3 RecoverPointClient (com.emc.storageos.recoverpoint.impl.RecoverPointClient)2 RPSite (com.emc.storageos.recoverpoint.objectmodel.RPSite)2 ClusterUID (com.emc.fapiclient.ws.ClusterUID)1 ConnectionOutThroughput (com.emc.fapiclient.ws.ConnectionOutThroughput)1 FunctionalAPIActionFailedException_Exception (com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception)1 FunctionalAPIInternalError_Exception (com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception)1 FunctionalAPIValidationException_Exception (com.emc.fapiclient.ws.FunctionalAPIValidationException_Exception)1 MonitoredParameter (com.emc.fapiclient.ws.MonitoredParameter)1 MonitoredParametersStatus (com.emc.fapiclient.ws.MonitoredParametersStatus)1 RpaStatistics (com.emc.fapiclient.ws.RpaStatistics)1 SystemStatistics (com.emc.fapiclient.ws.SystemStatistics)1 DiscoveredDataObject (com.emc.storageos.db.client.model.DiscoveredDataObject)1 StringMap (com.emc.storageos.db.client.model.StringMap)1 RecoverPointException (com.emc.storageos.recoverpoint.exceptions.RecoverPointException)1 ProtectionSystemParameters (com.emc.storageos.recoverpoint.responses.RecoverPointStatisticsResponse.ProtectionSystemParameters)1 BiosCommandResult (com.emc.storageos.volumecontroller.impl.BiosCommandResult)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1