Search in sources :

Example 1 with Plugin

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;
}
Also used : ArrayList(java.util.ArrayList) CommonResult(com.vmware.flowgate.openmanage.datamodel.CommonResult) Plugin(com.vmware.flowgate.openmanage.datamodel.Plugin)

Example 2 with Plugin

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;
}
Also used : RealTimeData(com.vmware.flowgate.common.model.RealTimeData) ArrayList(java.util.ArrayList) ValueUnit(com.vmware.flowgate.common.model.ValueUnit) Map(java.util.Map) HashMap(java.util.HashMap) Plugin(com.vmware.flowgate.openmanage.datamodel.Plugin)

Aggregations

Plugin (com.vmware.flowgate.openmanage.datamodel.Plugin)2 ArrayList (java.util.ArrayList)2 RealTimeData (com.vmware.flowgate.common.model.RealTimeData)1 ValueUnit (com.vmware.flowgate.common.model.ValueUnit)1 CommonResult (com.vmware.flowgate.openmanage.datamodel.CommonResult)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1