use of org.opennms.netmgt.rrd.model.v1.RRDv1 in project opennms by OpenNMS.
the class RrdConvertUtilsIT method testJrobinParse.
/**
* Test JRobin parse.
*
* @throws Exception the exception
*/
@Test
public void testJrobinParse() throws Exception {
RRDv1 jrb = RrdConvertUtils.dumpJrb(new File("src/test/resources/tempA.jrb"));
Assert.assertNotNull(jrb);
}
use of org.opennms.netmgt.rrd.model.v1.RRDv1 in project opennms by OpenNMS.
the class RrdConvertUtilsIT method testConvertRrdIntoJrb.
/**
* Test convert RRD into JRB.
*
* @throws Exception the exception
*/
@Test
public void testConvertRrdIntoJrb() throws Exception {
RRDv3 rrd = JaxbUtils.unmarshal(RRDv3.class, new File("src/test/resources/rrd-dump.xml"));
RRDv1 jrb = RrdConvertUtils.convert(rrd);
Assert.assertNotNull(jrb);
}
use of org.opennms.netmgt.rrd.model.v1.RRDv1 in project opennms by OpenNMS.
the class JRobinConverter method consolidateRrdFile.
public void consolidateRrdFile(final File groupFile, final File outputFile) throws IOException, RrdException, ConverterException {
/*
final List<RrdDatabase> rrds = new ArrayList<>();
rrds.add(new RrdDatabase(new RrdDb(groupFile, true)));
for (final File individualFile : getMatchingGroupRrds(groupFile)) {
final RrdDb individualRrd = new RrdDb(individualFile, true);
rrds.add(new RrdDatabase(individualRrd));
}
final TimeSeriesDataSource dataSource = new AggregateTimeSeriesDataSource(rrds);
final RrdDb outputRrd = new RrdDb(outputFile);
final RrdDatabaseWriter writer = new RrdDatabaseWriter(outputRrd);
final long endTime = dataSource.getEndTime();
// 1 year
final long startTime = endTime - ONE_YEAR_IN_SECONDS;
for (long time = startTime; time <= endTime; time += dataSource.getNativeStep()) {
final RrdEntry entry = dataSource.getDataAt(time);
writer.write(entry);
}
dataSource.close();
outputRrd.close();
*/
final RRDv1 groupRrd = RrdConvertUtils.dumpJrb(groupFile);
LogUtils.debugf(this, "consolidateRrdFile: multi-metric RRD with %d data sources", groupRrd.getDataSources().size());
int i = 1;
for (AbstractDS ds : groupRrd.getDataSources()) {
LogUtils.debugf(this, "consolidateRrdFile: multi-metric data source %d: %s", i++, ds.getName());
}
final List<RRDv1> singleMetricFiles = new ArrayList<>();
for (final File individualFile : getMatchingGroupRrds(groupFile)) {
final RRDv1 singleRrd = RrdConvertUtils.dumpJrb(individualFile);
LogUtils.debugf(this, "consolidateRrdFile: adding single-metric RRD for data source %s", singleRrd.getDataSource(0).getName());
singleMetricFiles.add(singleRrd);
}
groupRrd.merge(singleMetricFiles);
RrdConvertUtils.restoreJrb(groupRrd, outputFile);
}
Aggregations