use of com.emc.storageos.recoverpoint.responses.RecoverPointStatisticsResponse.ProtectionSystemParameters 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);
}
}
Aggregations