use of com.vmware.ops.api.model.property.PropertyContent in project flowgate by vmware.
the class VROAsyncJob method packagingPropertyContent.
private void packagingPropertyContent(Asset asset, PropertyContents contents) {
long currenttime = System.currentTimeMillis();
BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(asset);
for (String key : methodPropertyMapping.keySet()) {
PropertyContent content = new PropertyContent();
content.setStatKey(methodPropertyMapping.get(key));
content.setValues(new String[] { String.valueOf(wrapper.getPropertyValue(key)) });
content.setTimestamps(new long[] { currenttime });
contents.addPropertyContent(content);
}
}
use of com.vmware.ops.api.model.property.PropertyContent in project flowgate by vmware.
the class MetricClient method checkPredefinedMetricsandProperties.
public void checkPredefinedMetricsandProperties() {
List<String> metrics = Arrays.asList(VROConsts.ENVRIONMENT_PDU_AMPS_METRIC, VROConsts.ENVRIONMENT_PDU_VOLTS_METRIC, VROConsts.ENVRIONMENT_PDU_AMPS_LOAD_METRIC, VROConsts.ENVRIONMENT_PDU_POWER_LOAD_METRIC, VROConsts.ENVRIONMENT_PDU_POWER_METRIC, VROConsts.ENVRIONMENT_HOSTSENSOR_TEMPERATURE_METRIC, VROConsts.ENVRIONMENT_FRONT_TEMPERATURE_METRIC, VROConsts.ENVRIONMENT_FRONT_HUMIDITY_METRIC, VROConsts.ENVRIONMENT_BACK_HUMIDITY_METRIC, VROConsts.ENVRIONMENT_BACK_TEMPERATURE_METRIC);
List<ResourceDto> hostResources = getHostSystemsResources();
long timestampAnchor = 1428487200;
for (ResourceDto rd : hostResources) {
UUID id = rd.getIdentifier();
StatContents contents = new StatContents();
for (String metric : metrics) {
StatContent content = new StatContent();
content.setStatKey(metric);
content.setData(new double[] { 18.0 });
//
content.setTimestamps(new long[] { timestampAnchor });
contents.addStatContent(content);
}
addStats(null, id, contents, false);
PropertyContents pContents = new PropertyContents();
for (String property : properties) {
PropertyContent propertyContent = new PropertyContent();
propertyContent.setStatKey(property);
propertyContent.setTimestamps(new long[] { timestampAnchor });
propertyContent.setValues(new String[] { "unknown" });
pContents.addPropertyContent(propertyContent);
}
addProperties(null, id, pContents);
}
}
use of com.vmware.ops.api.model.property.PropertyContent in project flowgate by vmware.
the class MetricClient method addProperties.
/**
* Push stat data for the specified Stat Keys
*
* @param adapterSourceId
* the ID of the adapter kind that will push the stats, may be null which defaults to
* SuiteAPI adapter
* @param resourceUUID
* vRealize Operations Manager UUID of the Resource
* @param statKey
* Name of the Stat Key
* @param timestamps
* Array of long values as timestamps
* @param data
* Array of double values as data
*/
public void addProperties(String adapterSourceId, UUID resourceUUID, String statKey, long[] timestamps, double[] data, String[] values) {
PropertyContents contents = new PropertyContents();
PropertyContent content = new PropertyContent();
content.setStatKey(statKey);
content.setData(data);
content.setValues(values);
content.setTimestamps(timestamps);
contents.getPropertyContents().add(content);
if (adapterSourceId == null) {
resourcesClient.addProperties(resourceUUID, contents);
} else {
resourcesClient.addProperties(adapterSourceId, resourceUUID, contents);
}
}
Aggregations