Search in sources :

Example 1 with AbstractRrdBasedFetchStrategy

use of org.opennms.netmgt.measurements.impl.AbstractRrdBasedFetchStrategy in project opennms by OpenNMS.

the class CustomSpringConfiguration method createFetchStrategy.

@Bean(name = "measurementFetchStrategy")
public MeasurementFetchStrategy createFetchStrategy() {
    return new AbstractRrdBasedFetchStrategy() {

        @Override
        protected FetchResults fetchMeasurements(long start, long end, long step, int maxrows, Map<Source, String> rrdsBySource, Map<String, Object> constants) throws RrdException {
            final long[] timestamps = new long[] { start, end };
            final Map columnMap = new HashMap<>();
            if (!rrdsBySource.isEmpty()) {
                for (Source eachKey : rrdsBySource.keySet()) {
                    columnMap.put(eachKey.getLabel(), new double[] { 13, 17 });
                }
            }
            return new FetchResults(timestamps, columnMap, step, constants);
        }
    };
}
Also used : AbstractRrdBasedFetchStrategy(org.opennms.netmgt.measurements.impl.AbstractRrdBasedFetchStrategy) HashMap(java.util.HashMap) FetchResults(org.opennms.netmgt.measurements.api.FetchResults) HashMap(java.util.HashMap) Map(java.util.Map) Source(org.opennms.netmgt.measurements.model.Source) Bean(org.springframework.context.annotation.Bean)

Aggregations

HashMap (java.util.HashMap)1 Map (java.util.Map)1 FetchResults (org.opennms.netmgt.measurements.api.FetchResults)1 AbstractRrdBasedFetchStrategy (org.opennms.netmgt.measurements.impl.AbstractRrdBasedFetchStrategy)1 Source (org.opennms.netmgt.measurements.model.Source)1 Bean (org.springframework.context.annotation.Bean)1