Search in sources :

Example 1 with PropertyContent

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);
    }
}
Also used : BeanWrapper(org.springframework.beans.BeanWrapper) PropertyContent(com.vmware.ops.api.model.property.PropertyContent)

Example 2 with PropertyContent

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);
    }
}
Also used : PropertyContents(com.vmware.ops.api.model.property.PropertyContents) StatContent(com.vmware.ops.api.model.stat.StatContent) StatContents(com.vmware.ops.api.model.stat.StatContents) PropertyContent(com.vmware.ops.api.model.property.PropertyContent) UUID(java.util.UUID) ResourceDto(com.vmware.ops.api.model.resource.ResourceDto)

Example 3 with PropertyContent

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);
    }
}
Also used : PropertyContents(com.vmware.ops.api.model.property.PropertyContents) PropertyContent(com.vmware.ops.api.model.property.PropertyContent)

Aggregations

PropertyContent (com.vmware.ops.api.model.property.PropertyContent)3 PropertyContents (com.vmware.ops.api.model.property.PropertyContents)2 ResourceDto (com.vmware.ops.api.model.resource.ResourceDto)1 StatContent (com.vmware.ops.api.model.stat.StatContent)1 StatContents (com.vmware.ops.api.model.stat.StatContents)1 UUID (java.util.UUID)1 BeanWrapper (org.springframework.beans.BeanWrapper)1