use of org.opennms.netmgt.rrd.RrdRepository in project opennms by OpenNMS.
the class TcpOutputStrategyTest method persist.
public void persist(CollectionSet collectionSet, boolean forceStoreByGroup) {
ServiceParameters params = new ServiceParameters(Collections.emptyMap());
RrdRepository repo = new RrdRepository();
repo.setRrdBaseDir(tempFolder.getRoot());
Persister persister = persisterFactory.createPersister(params, repo, false, forceStoreByGroup, false);
collectionSet.visit(persister);
}
use of org.opennms.netmgt.rrd.RrdRepository in project opennms by OpenNMS.
the class TcaCollectorComplianceIT method getRequiredBeans.
@Override
public Map<String, Object> getRequiredBeans() {
TcaDataCollectionConfig config = mock(TcaDataCollectionConfig.class);
RrdRepository rrdRepository = new RrdRepository();
rrdRepository.setRrdBaseDir(new File("target"));
when(config.buildRrdRepository(COLLECTION)).thenReturn(rrdRepository);
TcaDataCollectionConfigDao tcaDataCollectionConfigDao = mock(TcaDataCollectionConfigDao.class);
when(tcaDataCollectionConfigDao.getConfig()).thenReturn(config);
ResourceStorageDao resourceStorageDao = mock(ResourceStorageDao.class);
ResourceTypesDao resourceTypesDao = mock(ResourceTypesDao.class);
ResourceType resourceType = TcaCollectorIT.getJuniperTcaEntryResourceType();
when(resourceTypesDao.getResourceTypeByName(TcaCollectionHandler.RESOURCE_TYPE_NAME)).thenReturn(resourceType);
return new ImmutableMap.Builder<String, Object>().put("tcaDataCollectionConfigDao", tcaDataCollectionConfigDao).put("resourceStorageDao", resourceStorageDao).put("resourceTypesDao", resourceTypesDao).put("locationAwareSnmpClient", m_client).build();
}
use of org.opennms.netmgt.rrd.RrdRepository in project opennms by OpenNMS.
the class DefaultDataCollectionConfigDao method getRrdRepository.
@Override
public RrdRepository getRrdRepository(final String collectionName) {
final RrdRepository repo = new RrdRepository();
repo.setRrdBaseDir(new File(getRrdPath()));
repo.setRraList(getRRAList(collectionName));
repo.setStep(getStep(collectionName));
repo.setHeartBeat((2 * getStep(collectionName)));
return repo;
}
use of org.opennms.netmgt.rrd.RrdRepository in project opennms by OpenNMS.
the class EvaluateStatsIT method testPersister.
/**
* Test persister.
*
* @throws Exception the exception
*/
@Test
public void testPersister() throws Exception {
RrdRepository repo = new RrdRepository();
repo.setRrdBaseDir(new File("/tmp"));
EvaluateGroupPersister persister = new EvaluateGroupPersister(stats, new ServiceParameters(new HashMap<String, Object>()), repo);
MockCollectionAgent agent = new MockCollectionAgent(1, "node.local", "Test", "001", InetAddressUtils.addr("127.0.0.1"));
CollectionSetBuilder builder = new CollectionSetBuilder(agent);
NodeLevelResource node = new NodeLevelResource(agent.getNodeId());
InterfaceLevelResource eth0 = new InterfaceLevelResource(node, "eth0");
builder.withNumericAttribute(eth0, "mib2-interfaces", "ifInErrors", 0.0, AttributeType.COUNTER);
builder.withNumericAttribute(eth0, "mib2-interfaces", "ifOutErrors", 0.0, AttributeType.COUNTER);
builder.withNumericAttribute(eth0, "mib2-X-interfaces", "ifHCInOctets", 100.0, AttributeType.COUNTER);
builder.withNumericAttribute(eth0, "mib2-X-interfaces", "ifHCOutOctets", 100.0, AttributeType.COUNTER);
builder.withStringAttribute(eth0, "mib2-X-interfaces", "ifHighSpeed", "1000");
InterfaceLevelResource eth1 = new InterfaceLevelResource(node, "eth1");
builder.withNumericAttribute(eth1, "mib2-interfaces", "ifInErrors", 0.0, AttributeType.COUNTER);
builder.withNumericAttribute(eth1, "mib2-interfaces", "ifOutErrors", 0.0, AttributeType.COUNTER);
builder.withNumericAttribute(eth1, "mib2-X-interfaces", "ifHCInOctets", 100.0, AttributeType.COUNTER);
builder.withNumericAttribute(eth1, "mib2-X-interfaces", "ifHCOutOctets", 100.0, AttributeType.COUNTER);
builder.withStringAttribute(eth1, "mib2-X-interfaces", "ifHighSpeed", "1000");
builder.build().visit(persister);
stats.dumpCache();
Assert.assertEquals(1, registry.getGauges().get("evaluate.nodes").getValue());
Assert.assertEquals(2, registry.getGauges().get("evaluate.resources").getValue());
Assert.assertEquals(4, registry.getGauges().get("evaluate.groups").getValue());
Assert.assertEquals(8, registry.getGauges().get("evaluate.numeric-attributes").getValue());
Assert.assertEquals(2, registry.getGauges().get("evaluate.string-attributes").getValue());
Assert.assertEquals(8, registry.getMeters().get("evaluate.samples").getCount());
}
use of org.opennms.netmgt.rrd.RrdRepository in project opennms by OpenNMS.
the class VmwareCimDatacollectionConfigDaoJaxb method getRrdRepository.
/**
* Returns the Rrd repository for a given collection name.
*
* @param collectionName the collection's name
* @return the repository
*/
@Override
public RrdRepository getRrdRepository(String collectionName) {
RrdRepository repo = new RrdRepository();
repo.setRrdBaseDir(new File(getRrdPath()));
repo.setRraList(getRRAList(collectionName));
repo.setStep(getStep(collectionName));
repo.setHeartBeat((2 * getStep(collectionName)));
return repo;
}
Aggregations