use of com.vmware.flowgate.openmanage.datamodel.Plugin in project flowgate by vmware.
the class OpenManageJobTest method getCommonResult.
private CommonResult<Plugin> getCommonResult() {
Plugin plugin1 = new Plugin();
plugin1.setEnabled(true);
plugin1.setInstalled(true);
plugin1.setName(OpenManageJobService.PowerManager);
plugin1.setId("powerManagerplugin");
List<Plugin> plugins = new ArrayList<Plugin>();
plugins.add(plugin1);
CommonResult<Plugin> commonResult = new CommonResult<Plugin>();
commonResult.setValue(plugins);
return commonResult;
}
use of com.vmware.flowgate.openmanage.datamodel.Plugin in project flowgate by vmware.
the class OpenManageJobService method getMetricDatas.
/**
*Example of Temperature
* "@odata.context": "/api/$metadata#DeviceService.TemperatureResponseModel",
* "@odata.type": "#DeviceService.TemperatureResponseModel",
* "@odata.id": "/api/DeviceService/Devices(10074)/Temperature",
* "peakTemperatureUnit": "celsius",
* "avgTemperatureUnit": "celsius",
* "DateFormat": "CIM",
* "instantaneousTemperatureUnit": "celsius",
* "startTime": "20210201050207.000000-360",
* "avgTemperatureTimeStamp": "20210202093523.806515-360",
* "avgTemperature": "21",
* "instantaneousTemperature": "23",
* "peakTemperature": "27",
* "peakTemperatureTimeStamp": "20210201050207.000000-360"
* @param integration
* @param client
* @return
*/
public List<RealTimeData> getMetricDatas(FacilitySoftwareConfig integration, OpenManageAPIClient client) {
List<RealTimeData> metricDatas = new ArrayList<RealTimeData>();
Map<String, String> assetIdAndOpenmanageDeviceIdMap = getMappedAssetIDMap(integration.getId());
if (assetIdAndOpenmanageDeviceIdMap.isEmpty()) {
return metricDatas;
}
Plugin powerManage = null;
CommonResult<Plugin> plugins = client.getCommonResult(Plugin.class);
for (Plugin plugin : plugins.getValue()) {
if (PowerManager.equals(plugin.getName()) && plugin.isInstalled() && plugin.isEnabled()) {
powerManage = plugin;
break;
}
}
for (Map.Entry<String, String> map : assetIdAndOpenmanageDeviceIdMap.entrySet()) {
String deviceId = map.getValue();
String assetId = map.getKey();
Map<String, ValueUnit> metricNameAndValueUnitMap = getMetricsData(deviceId, client, powerManage);
RealTimeData metricData = null;
if (!metricNameAndValueUnitMap.isEmpty()) {
metricData = new RealTimeData();
List<ValueUnit> valueUnits = new ArrayList<ValueUnit>(metricNameAndValueUnitMap.values());
long currentTime = valueUnits.get(0).getTime();
metricData.setAssetID(assetId);
metricData.setTime(currentTime);
metricData.setValues(valueUnits);
metricData.setId(assetId + currentTime);
metricDatas.add(metricData);
}
}
return metricDatas;
}
Aggregations