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