Search in sources :

Example 1 with WsmanDatacollectionConfig

use of org.opennms.netmgt.config.wsman.WsmanDatacollectionConfig in project opennms by OpenNMS.

the class WsManCollector method getRrdRepository.

@Override
public RrdRepository getRrdRepository(String collectionName) {
    LOG.debug("getRrdRepository({})", collectionName);
    WsmanDatacollectionConfig config = m_wsManDataCollectionConfigDao.getConfig();
    Collection collection = m_wsManDataCollectionConfigDao.getCollectionByName(collectionName);
    if (collection == null) {
        throw new IllegalArgumentException("No configuration found for collection with name: " + collectionName);
    }
    RrdRepository rrdRepository = new RrdRepository();
    rrdRepository.setStep(collection.getRrd().getStep());
    rrdRepository.setHeartBeat(2 * rrdRepository.getStep());
    rrdRepository.setRraList(collection.getRrd().getRra());
    rrdRepository.setRrdBaseDir(new File(config.getRrdRepository()));
    LOG.debug("Using RRD repository: {} for collection: {}", rrdRepository, collectionName);
    return rrdRepository;
}
Also used : WsmanDatacollectionConfig(org.opennms.netmgt.config.wsman.WsmanDatacollectionConfig) Collection(org.opennms.netmgt.config.wsman.Collection) RrdRepository(org.opennms.netmgt.rrd.RrdRepository) File(java.io.File)

Example 2 with WsmanDatacollectionConfig

use of org.opennms.netmgt.config.wsman.WsmanDatacollectionConfig in project opennms by OpenNMS.

the class WSManCollectorComplianceTest method getRequiredBeans.

public Map<String, Object> getRequiredBeans() {
    OnmsNode node = mock(OnmsNode.class, RETURNS_DEEP_STUBS);
    NodeDao nodeDao = mock(NodeDao.class);
    when(nodeDao.get(anyInt())).thenReturn(node);
    Definition agentConfig = new Definition();
    WSManConfigDao wsManConfigDao = mock(WSManConfigDao.class);
    when(wsManConfigDao.getAgentConfig(InetAddrUtils.getLocalHostAddress())).thenReturn(agentConfig);
    WsmanDatacollectionConfig config = new WsmanDatacollectionConfig();
    config.setRrdRepository("target");
    Collection collection = new Collection();
    collection.setRrd(new Rrd());
    WSManDataCollectionConfigDao wsManDataCollectionConfigDao = mock(WSManDataCollectionConfigDao.class);
    when(wsManDataCollectionConfigDao.getCollectionByName(COLLECTION)).thenReturn(collection);
    when(wsManDataCollectionConfigDao.getConfig()).thenReturn(config);
    return new ImmutableMap.Builder<String, Object>().put("nodeDao", nodeDao).put("wsManConfigDao", wsManConfigDao).put("wsManDataCollectionConfigDao", wsManDataCollectionConfigDao).build();
}
Also used : NodeDao(org.opennms.netmgt.dao.api.NodeDao) OnmsNode(org.opennms.netmgt.model.OnmsNode) WsmanDatacollectionConfig(org.opennms.netmgt.config.wsman.WsmanDatacollectionConfig) Rrd(org.opennms.netmgt.config.wsman.Rrd) Definition(org.opennms.netmgt.config.wsman.Definition) Collection(org.opennms.netmgt.config.wsman.Collection) WSManConfigDao(org.opennms.netmgt.dao.WSManConfigDao) WSManDataCollectionConfigDao(org.opennms.netmgt.dao.WSManDataCollectionConfigDao)

Aggregations

Collection (org.opennms.netmgt.config.wsman.Collection)2 WsmanDatacollectionConfig (org.opennms.netmgt.config.wsman.WsmanDatacollectionConfig)2 File (java.io.File)1 Definition (org.opennms.netmgt.config.wsman.Definition)1 Rrd (org.opennms.netmgt.config.wsman.Rrd)1 WSManConfigDao (org.opennms.netmgt.dao.WSManConfigDao)1 WSManDataCollectionConfigDao (org.opennms.netmgt.dao.WSManDataCollectionConfigDao)1 NodeDao (org.opennms.netmgt.dao.api.NodeDao)1 OnmsNode (org.opennms.netmgt.model.OnmsNode)1 RrdRepository (org.opennms.netmgt.rrd.RrdRepository)1