use of com.emc.storageos.db.client.model.Stat in project coprhd-controller by CoprHD.
the class FEPortStatsProcessor method processResult.
@SuppressWarnings("unchecked")
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws SMIPluginException {
try {
CIMArgument<?>[] outputArguments = (CIMArgument<?>[]) resultObj;
DbClient dbClient = (DbClient) keyMap.get(Constants.dbClient);
AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
List<Stat> metricsObjList = (List<Stat>) keyMap.get(Constants._Stats);
List<String> metricSequence = (List<String>) keyMap.get(Constants.STORAGEOS_FEPORT_MANIFEST);
String[] feportsMetricValues = ((String[]) outputArguments[0].getValue())[0].split("\n");
List<StoragePort> systemPorts = ControllerUtils.getSystemPortsOfSystem(dbClient, profile.getSystemId());
_logger.debug("FEPort metricNames Sequence {}", metricSequence);
// process the results.
if (null != metricSequence && !metricSequence.isEmpty()) {
// Step2: For each feport metric record
for (String fePortMetricValue : feportsMetricValues) {
if (fePortMetricValue.isEmpty()) {
_logger.debug("Empty FEPort stats returned as part of Statistics Response");
continue;
}
String[] metrics = fePortMetricValue.split(Constants.SEMI_COLON);
// Step 3: For each port in db for a given system.
for (StoragePort port : systemPorts) {
// Step 4: if port in db is null just continue.
if (null == port) {
continue;
} else if (!port.getInactive() && metrics[0].endsWith(port.getPortName())) {
// Step 5: Check whether provider returned port
// exists in db or not. if port exists in db,
// then create a PortStat object for it.
_logger.debug("found FEPort in db for {}", port.getPortName());
createPortStatMetric(metricSequence, port, keyMap, metricsObjList, metrics);
}
}
}
//
// compute port metric to trigger if any port allocation qualification changed. If there is
// changes, run vpool matcher
//
portMetricsProcessor.triggerVpoolMatcherIfPortAllocationQualificationChanged(profile.getSystemId(), systemPorts);
//
// compute storage system's average of port metrics. Then, persist it into storage system object.
//
portMetricsProcessor.computeStorageSystemAvgPortMetrics(profile.getSystemId());
// Compute port group's port metrics for vmax only
portMetricsProcessor.computePortGroupMetrics(profile.getSystemId());
} else {
_logger.error("failed processing FEPOrt Metric values as metric sequence is null.");
}
} catch (Exception e) {
_logger.error("Failed while extracting stats for FEPorts: ", e);
}
resultObj = null;
}
use of com.emc.storageos.db.client.model.Stat in project coprhd-controller by CoprHD.
the class SPProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
final Iterator<?> it = (Iterator<?>) resultObj;
while (it.hasNext()) {
try {
final CIMInstance allocatedfrompool = (CIMInstance) it.next();
CIMObjectPath path = (CIMObjectPath) allocatedfrompool.getProperty("Dependent").getValue();
if (path.getObjectName().contains(_volume)) {
String key = createKeyfromPath(path);
// this check means, validating whether this Volume is
// managed by Bourne
Stat metrics = (Stat) getMetrics(keyMap, key);
_logger.debug("Processing Volume to extract Allocated Capacity: {}", key);
// Allocated Capacity =
// CIM_AllocatedFromStoragePool.SpaceConsumed (in bytes)
metrics.setAllocatedCapacity(Long.parseLong(allocatedfrompool.getProperty(_spaceConsumed).getValue().toString()));
}
} catch (Exception e) {
if (!(e instanceof BaseCollectionException)) {
_logger.error(" Allocated Capacity : ", e);
}
}
}
resultObj = null;
}
use of com.emc.storageos.db.client.model.Stat in project coprhd-controller by CoprHD.
the class VNXStoragePortStatsProcessor method preparePortStatInfo.
/**
* Prepare the Port stat information
*
* @param nativeId
* @param resourceId
* @param iops
* @param timeSample
* @return ipPortStat
*/
private Stat preparePortStatInfo(String nativeId, URI resourceId, long iops, long timeSample) {
Stat ipPortStat = new Stat();
ipPortStat.setServiceType(Constants._File);
ipPortStat.setTimeCollected(timeSample);
ipPortStat.setResourceId(resourceId);
ipPortStat.setNativeGuid(nativeId);
ipPortStat.setTotalIOs(iops);
return ipPortStat;
}
use of com.emc.storageos.db.client.model.Stat in project coprhd-controller by CoprHD.
the class VNXStoragePortStatsProcessor method processPortStatsInfo.
/**
* Process the Port metrics which are received from XMLAPI server.
*
* @param interPortMap
* @param stringMapPortIOs
* @param storageSystem
* @param dbClient
* @param sampleTime
* @return list of Port stats
*/
private List<Stat> processPortStatsInfo(Map<String, List<String>> interPortMap, Map<String, BigInteger> stringMapPortIOs, StorageSystem storageSystem, DbClient dbClient, Long sampleTime) {
// get the interfaces and corresponding port
List<Stat> stat = new ArrayList<Stat>();
Stat fePortStat = null;
for (Entry<String, List<String>> entry : interPortMap.entrySet()) {
String interfaceIP = entry.getKey();
List<String> portList = entry.getValue();
// get the port information
String portNativeGuid = NativeGUIDGenerator.generateNativeGuid(storageSystem, interfaceIP, NativeGUIDGenerator.PORT);
StoragePort storagePort = findExistingPort(portNativeGuid, dbClient);
_logger.info("interface {} and port details {}", interfaceIP, storagePort.getPortName());
// calculate traffic per interface- total traffic all ports/no of ports
BigInteger iovalue = new BigInteger("0");
for (String physicalName : portList) {
iovalue = iovalue.add(stringMapPortIOs.get(physicalName));
}
// get Average port IO by adding and dividing the number.
Long iopes = iovalue.longValue() / portList.size();
Long kbytes = iopes / 1024;
_logger.info("processIPPortMetrics input data iops{} and time details {} iopes", iopes.toString(), sampleTime.toString());
// set Ethernet port speed to 1Gbps
storagePort.setPortSpeed(1L);
// send port metrics processor to store the content
portMetricsProcessor.processIPPortMetrics(kbytes, iopes, storagePort, sampleTime);
// finally add above value to stat object
fePortStat = preparePortStatInfo(portNativeGuid, storagePort.getId(), iopes, sampleTime);
stat.add(fePortStat);
}
return stat;
}
use of com.emc.storageos.db.client.model.Stat in project coprhd-controller by CoprHD.
the class VNXVolumeStatsProcessor method injectBWInOut.
/**
* Inject bwIn & bwOut in stat object.
*
* @param fileShareId : FileshareId to update.
* @param keyMap : KeyMap
* @param volItem : VolItem contains the bytesRead/bytesWrite values.
* @param statsList : Stat List to update.
*/
private void injectBWInOut(String fileShareId, Map<String, Object> keyMap, Item volItem, List<Stat> statsList) {
Iterator<Stat> statsItr = statsList.iterator();
while (statsItr.hasNext()) {
Stat stat = statsItr.next();
if (null != fileShareId && fetchNativeId(stat.getNativeGuid()).equals(fileShareId)) {
stat.setBandwidthOut(volItem.getBytesRead().longValue());
stat.setBandwidthIn(volItem.getBytesWritten().longValue());
break;
}
}
}
Aggregations