Search in sources :

Example 26 with RrdRepository

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);
}
Also used : ServiceParameters(org.opennms.netmgt.collection.api.ServiceParameters) Persister(org.opennms.netmgt.collection.api.Persister) RrdRepository(org.opennms.netmgt.rrd.RrdRepository)

Example 27 with RrdRepository

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();
}
Also used : ResourceStorageDao(org.opennms.netmgt.dao.api.ResourceStorageDao) TcaDataCollectionConfigDao(org.opennms.netmgt.collectd.tca.dao.TcaDataCollectionConfigDao) ResourceTypesDao(org.opennms.netmgt.config.api.ResourceTypesDao) ResourceType(org.opennms.netmgt.config.datacollection.ResourceType) RrdRepository(org.opennms.netmgt.rrd.RrdRepository) File(java.io.File) TcaDataCollectionConfig(org.opennms.netmgt.collectd.tca.config.TcaDataCollectionConfig) ImmutableMap(com.google.common.collect.ImmutableMap)

Example 28 with RrdRepository

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;
}
Also used : RrdRepository(org.opennms.netmgt.rrd.RrdRepository) File(java.io.File)

Example 29 with RrdRepository

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());
}
Also used : CollectionSetBuilder(org.opennms.netmgt.collection.support.builder.CollectionSetBuilder) HashMap(java.util.HashMap) MockCollectionAgent(org.opennms.core.collection.test.MockCollectionAgent) InterfaceLevelResource(org.opennms.netmgt.collection.support.builder.InterfaceLevelResource) ServiceParameters(org.opennms.netmgt.collection.api.ServiceParameters) RrdRepository(org.opennms.netmgt.rrd.RrdRepository) NodeLevelResource(org.opennms.netmgt.collection.support.builder.NodeLevelResource) File(java.io.File) Test(org.junit.Test)

Example 30 with RrdRepository

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;
}
Also used : RrdRepository(org.opennms.netmgt.rrd.RrdRepository) File(java.io.File)

Aggregations

RrdRepository (org.opennms.netmgt.rrd.RrdRepository)51 File (java.io.File)26 ServiceParameters (org.opennms.netmgt.collection.api.ServiceParameters)17 HashMap (java.util.HashMap)11 Test (org.junit.Test)11 CollectionSetVisitor (org.opennms.netmgt.collection.api.CollectionSetVisitor)9 CollectionSet (org.opennms.netmgt.collection.api.CollectionSet)6 XmlDataCollection (org.opennms.protocols.xml.config.XmlDataCollection)6 Datasource (org.jrobin.core.Datasource)5 RrdDb (org.jrobin.core.RrdDb)5 JUnitHttpServer (org.opennms.core.test.http.annotations.JUnitHttpServer)5 MockDataCollectionConfig (org.opennms.netmgt.mock.MockDataCollectionConfig)5 XmlDataCollectionConfig (org.opennms.protocols.xml.config.XmlDataCollectionConfig)5 AttributeGroupType (org.opennms.netmgt.collection.api.AttributeGroupType)4 CollectionResource (org.opennms.netmgt.collection.api.CollectionResource)4 RrdPersistOperationBuilder (org.opennms.netmgt.collection.persistence.rrd.RrdPersistOperationBuilder)4 MibObject (org.opennms.netmgt.config.datacollection.MibObject)4 SnmpInstId (org.opennms.netmgt.snmp.SnmpInstId)4 SnmpResult (org.opennms.netmgt.snmp.SnmpResult)4 XmlRrd (org.opennms.protocols.xml.config.XmlRrd)4