Search in sources :

Example 41 with RrdRepository

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

the class LatencyThresholdingSetIT method getRepository.

private RrdRepository getRepository() {
    RrdRepository repo = new RrdRepository();
    repo.setRrdBaseDir(m_fileAnticipator.getTempDir());
    return repo;
}
Also used : RrdRepository(org.opennms.netmgt.rrd.RrdRepository)

Example 42 with RrdRepository

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

the class XmlCollector method collect.

/* (non-Javadoc)
     * @see org.opennms.netmgt.collectd.ServiceCollector#collect(org.opennms.netmgt.collectd.CollectionAgent, org.opennms.netmgt.model.events.EventProxy, java.util.Map)
     */
@Override
public CollectionSet collect(CollectionAgent agent, Map<String, Object> parameters) throws CollectionException {
    final String rrdRepositoryPath = ParameterMap.getKeyedString(parameters, RRD_REPOSITORY_PATH_KEY, null);
    final XmlDataCollection collection = (XmlDataCollection) parameters.get(XML_DATACOLLECTION_KEY);
    final String serviceName = ParameterMap.getKeyedString(parameters, "SERVICE", "XML");
    final String handlerClass = ParameterMap.getKeyedString(parameters, "handler-class", "org.opennms.protocols.xml.collector.DefaultXmlCollectionHandler");
    final XmlCollectionHandlerKey key = new XmlCollectionHandlerKey(serviceName, handlerClass);
    try {
        // Filling XML CollectionSet
        RrdRepository rrdRepository = XmlDataCollectionConfig.buildRrdRepository(rrdRepositoryPath, collection);
        XmlCollectionHandler handler = m_handlers.get(key);
        handler.setRrdRepository(rrdRepository);
        return handler.collect(agent, collection, parameters);
    } catch (Exception e) {
        throw new CollectionException("Can't collect XML data because " + e.getMessage(), e);
    }
}
Also used : XmlDataCollection(org.opennms.protocols.xml.config.XmlDataCollection) CollectionException(org.opennms.netmgt.collection.api.CollectionException) RrdRepository(org.opennms.netmgt.rrd.RrdRepository) CollectionException(org.opennms.netmgt.collection.api.CollectionException) ExecutionException(java.util.concurrent.ExecutionException) CollectionInitializationException(org.opennms.netmgt.collection.api.CollectionInitializationException)

Example 43 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 44 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 45 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)

Aggregations

RrdRepository (org.opennms.netmgt.rrd.RrdRepository)54 File (java.io.File)27 ServiceParameters (org.opennms.netmgt.collection.api.ServiceParameters)19 HashMap (java.util.HashMap)11 Test (org.junit.Test)11 CollectionSetVisitor (org.opennms.netmgt.collection.api.CollectionSetVisitor)10 CollectionSet (org.opennms.netmgt.collection.api.CollectionSet)7 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 ExecutionException (java.util.concurrent.ExecutionException)4 AttributeGroupType (org.opennms.netmgt.collection.api.AttributeGroupType)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 CollectionResource (org.opennms.netmgt.collection.api.CollectionResource)3