Search in sources :

Example 16 with RrdRepository

use of org.opennms.netmgt.rrd.RrdRepository in project opennms by OpenNMS.

the class RrdPersistOperationBuilderTest method testCommitWithNoDeclaredAttributes.

@Test
public void testCommitWithNoDeclaredAttributes() throws Exception {
    RrdRepository repository = createRrdRepository();
    SnmpCollectionAgent agent = getCollectionAgent();
    MockDataCollectionConfig dataCollectionConfig = new MockDataCollectionConfig();
    OnmsSnmpCollection collection = new OnmsSnmpCollection(agent, new ServiceParameters(new HashMap<String, Object>()), dataCollectionConfig, m_locationAwareSnmpClient);
    NodeResourceType resourceType = new NodeResourceType(agent, collection);
    CollectionResource resource = new NodeInfo(resourceType, agent);
    RrdPersistOperationBuilder builder = new RrdPersistOperationBuilder(m_rrdStrategy, repository, resource, "rrdName", false);
    builder.commit();
}
Also used : CollectionResource(org.opennms.netmgt.collection.api.CollectionResource) RrdPersistOperationBuilder(org.opennms.netmgt.collection.persistence.rrd.RrdPersistOperationBuilder) HashMap(java.util.HashMap) MockDataCollectionConfig(org.opennms.netmgt.mock.MockDataCollectionConfig) ServiceParameters(org.opennms.netmgt.collection.api.ServiceParameters) RrdRepository(org.opennms.netmgt.rrd.RrdRepository) Test(org.junit.Test)

Example 17 with RrdRepository

use of org.opennms.netmgt.rrd.RrdRepository in project opennms by OpenNMS.

the class SnmpAttributeTest method createRrdRepository.

private RrdRepository createRrdRepository() throws IOException {
    RrdRepository repository = new RrdRepository();
    repository.setRrdBaseDir(getSnmpRrdDirectory());
    repository.setHeartBeat(600);
    repository.setStep(300);
    repository.setRraList(Collections.singletonList("RRA:AVERAGE:0.5:1:100"));
    return repository;
}
Also used : RrdRepository(org.opennms.netmgt.rrd.RrdRepository)

Example 18 with RrdRepository

use of org.opennms.netmgt.rrd.RrdRepository in project opennms by OpenNMS.

the class CollectableServiceTest method createRrdRepository.

private RrdRepository createRrdRepository() throws IOException {
    RrdRepository repository = new RrdRepository();
    repository.setRrdBaseDir(getSnmpRrdDirectory());
    repository.setHeartBeat(600);
    repository.setStep(300);
    repository.setRraList(Collections.singletonList("RRA:AVERAGE:0.5:1:100"));
    return repository;
}
Also used : RrdRepository(org.opennms.netmgt.rrd.RrdRepository)

Example 19 with RrdRepository

use of org.opennms.netmgt.rrd.RrdRepository in project opennms by OpenNMS.

the class CollectorTestUtils method persistCollectionSet.

public static void persistCollectionSet(RrdStrategy<?, ?> rrdStrategy, ResourceStorageDao resourceStorageDao, CollectionSpecification spec, CollectionSet collectionSet) {
    RrdRepository repository = spec.getRrdRepository("default");
    System.err.println("repository = " + repository);
    ServiceParameters params = spec.getServiceParameters();
    System.err.println("service parameters = " + params);
    RrdPersisterFactory persisterFactory = new RrdPersisterFactory();
    persisterFactory.setRrdStrategy(rrdStrategy);
    persisterFactory.setResourceStorageDao(resourceStorageDao);
    CollectionSetVisitor persister = persisterFactory.createPersister(params, repository);
    System.err.println("persister = " + persister);
    collectionSet.visit(persister);
}
Also used : CollectionSetVisitor(org.opennms.netmgt.collection.api.CollectionSetVisitor) RrdPersisterFactory(org.opennms.netmgt.collection.persistence.rrd.RrdPersisterFactory) ServiceParameters(org.opennms.netmgt.collection.api.ServiceParameters) RrdRepository(org.opennms.netmgt.rrd.RrdRepository)

Example 20 with RrdRepository

use of org.opennms.netmgt.rrd.RrdRepository in project opennms by OpenNMS.

the class VmwareDatacollectionConfigDaoJaxb 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