Search in sources :

Example 46 with RrdRepository

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

the class VmwareCimCollectorComplianceTest method getRequiredBeans.

@Override
public Map<String, Object> getRequiredBeans() {
    OnmsNode node = mock(OnmsNode.class, RETURNS_DEEP_STUBS);
    NodeDao nodeDao = mock(NodeDao.class);
    when(nodeDao.get(anyInt())).thenReturn(node);
    when(node.getAssetRecord().getVmwareManagementServer()).thenReturn("mdx");
    when(node.getAssetRecord().getVmwareManagedEntityType()).thenReturn("tsx");
    when(node.getForeignId()).thenReturn("rsx");
    VmwareCimCollection collection = new VmwareCimCollection();
    VmwareCimDatacollectionConfigDao vmwareCimDatacollectionConfigDao = mock(VmwareCimDatacollectionConfigDao.class);
    when(vmwareCimDatacollectionConfigDao.getVmwareCimCollection(COLLECTION)).thenReturn(collection);
    when(vmwareCimDatacollectionConfigDao.getRrdRepository(COLLECTION)).thenReturn(new RrdRepository());
    VmwareServer vmwareServer = new VmwareServer();
    vmwareServer.setHostname(InetAddrUtils.getLocalHostAddress().getCanonicalHostName());
    Map<String, VmwareServer> serverMap = new ImmutableMap.Builder<String, VmwareServer>().put("mdx", vmwareServer).build();
    VmwareConfigDao vmwareConfigDao = mock(VmwareConfigDao.class);
    when(vmwareConfigDao.getServerMap()).thenReturn(serverMap);
    return new ImmutableMap.Builder<String, Object>().put("nodeDao", nodeDao).put("vmwareCimDatacollectionConfigDao", vmwareCimDatacollectionConfigDao).put("vmwareConfigDao", vmwareConfigDao).build();
}
Also used : NodeDao(org.opennms.netmgt.dao.api.NodeDao) VmwareConfigDao(org.opennms.netmgt.dao.VmwareConfigDao) OnmsNode(org.opennms.netmgt.model.OnmsNode) VmwareCimDatacollectionConfigDao(org.opennms.netmgt.dao.VmwareCimDatacollectionConfigDao) VmwareServer(org.opennms.netmgt.config.vmware.VmwareServer) VmwareCimCollection(org.opennms.netmgt.config.vmware.cim.VmwareCimCollection) RrdRepository(org.opennms.netmgt.rrd.RrdRepository)

Example 47 with RrdRepository

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

the class JdbcDataCollectionConfig method buildRrdRepository.

public RrdRepository buildRrdRepository(String collectionName) {
    JdbcRrd rrd = getDataCollectionByName(collectionName).getJdbcRrd();
    RrdRepository repo = new RrdRepository();
    repo.setRrdBaseDir(new File(getRrdRepository()));
    repo.setRraList(rrd.getJdbcRras());
    repo.setStep(rrd.getStep());
    repo.setHeartBeat((2 * rrd.getStep()));
    return repo;
}
Also used : RrdRepository(org.opennms.netmgt.rrd.RrdRepository) File(java.io.File)

Example 48 with RrdRepository

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

the class MockDataCollectionConfig method getRrdRepository.

@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)

Example 49 with RrdRepository

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

the class JMXDataCollectionConfigDao method getRrdRepository.

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)

Example 50 with RrdRepository

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

the class LatencyStoringServiceMonitorAdaptor method applyThresholds.

private void applyThresholds(String rrdPath, MonitoredService service, String dsName, Map<String, Number> entries) {
    try {
        if (m_thresholdingSet == null) {
            RrdRepository repository = new RrdRepository();
            repository.setRrdBaseDir(new File(rrdPath));
            m_thresholdingSet = new LatencyThresholdingSet(service.getNodeId(), service.getIpAddr(), service.getSvcName(), service.getNodeLocation(), repository, m_resourceStorageDao);
        }
        LinkedHashMap<String, Double> attributes = new LinkedHashMap<String, Double>();
        for (String ds : entries.keySet()) {
            Number sampleValue = entries.get(ds);
            if (sampleValue == null) {
                attributes.put(ds, Double.NaN);
            } else {
                attributes.put(ds, sampleValue.doubleValue());
            }
        }
        if (m_thresholdingSet.isNodeInOutage()) {
            LOG.info("applyThresholds: the threshold processing will be skipped because the service {} is on a scheduled outage.", service);
        } else if (m_thresholdingSet.hasThresholds(attributes)) {
            List<Event> events = m_thresholdingSet.applyThresholds(dsName, attributes);
            if (events.size() > 0) {
                ThresholdingEventProxy proxy = new ThresholdingEventProxy();
                proxy.add(events);
                proxy.sendAllEvents();
            }
        }
    } catch (Throwable e) {
        LOG.error("Failed to threshold on {} for {} because of an exception", service, dsName, e);
    }
}
Also used : ThresholdingEventProxy(org.opennms.netmgt.threshd.ThresholdingEventProxy) LatencyThresholdingSet(org.opennms.netmgt.threshd.LatencyThresholdingSet) List(java.util.List) RrdRepository(org.opennms.netmgt.rrd.RrdRepository) File(java.io.File) LinkedHashMap(java.util.LinkedHashMap)

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