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;
}
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);
}
}
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;
}
Aggregations