use of org.opennms.nrtg.api.model.DefaultCollectionJob in project opennms by OpenNMS.
the class TcaProtocolCollectorTest method setup.
@Before
public void setup() throws Exception {
SnmpPeerFactory.setInstance(m_snmpPeerFactory);
localhost = InetAddress.getByName("127.0.0.1");
snmpAgentConfig = SnmpPeerFactory.getInstance().getAgentConfig(localhost);
collectionJob = new DefaultCollectionJob();
collectionJob.setProtocolConfiguration(snmpAgentConfig.toProtocolConfigString());
destinations = new HashSet<String>();
destinations.add("test");
}
use of org.opennms.nrtg.api.model.DefaultCollectionJob in project opennms by OpenNMS.
the class PooledJobPublisher method createTestJob.
private CollectionJob createTestJob() {
if (this.job == null) {
TreeSet<String> destinationSet = new TreeSet<String>();
destinationSet.add("NrtResults");
CollectionJob snmpJob = new DefaultCollectionJob();
snmpJob.addMetric(".1.3.6.1.4.1.2021.9.1.9.1", destinationSet, "DummyName");
// snmpJob.addMetric(".1.3.6.1.2.1.2.2.1.10.1", destinationSet);
// snmpJob.addMetric(".1.3.6.1.2.1.2.2.1.10.2", destinationSet);
// snmpJob.addMetric(".1.3.6.1.2.1.2.2.1.10.4", destinationSet);
// snmpJob.addMetric(".1.3.6.1.2.1.2.2.1.10.5", destinationSet);
// snmpJob.addMetric(".1.3.6.1.2.1.2.2.1.10.6", destinationSet);
// snmpJob.addMetric(".1.3.6.1.2.1.2.2.1.10.7", destinationSet);
// snmpJob.addMetric(".1.3.6.1.2.1.2.2.1.10.8", destinationSet);
// snmpJob.addMetric(".1.3.6.1.2.1.2.2.1.10.9", destinationSet);
// snmpJob.addMetric(".1.3.6.1.2.1.2.2.1.10.10", destinationSet);
// snmpJob.addMetric(".1.3.6.1.2.1.2.2.1.10.11", destinationSet);
// destinationSet.add("NrtPersister");
// snmpJob.addMetric(".1.3.6.1.2.1.2.2.1.10.11", destinationSet);
snmpJob.setNetInterface("127.0.0.1");
snmpJob.setService("SNMP");
this.job = snmpJob;
}
return this.job;
}
use of org.opennms.nrtg.api.model.DefaultCollectionJob in project opennms by OpenNMS.
the class NrtController method createCollectionJobs.
private List<CollectionJob> createCollectionJobs(OnmsResource reportResource, PrefabGraph prefabGraph, String nrtCollectionTaskId) {
List<CollectionJob> collectionJobs = new ArrayList<CollectionJob>();
OnmsResource nodeResource = reportResource.getParent();
OnmsNode node = m_nodeDao.get(nodeResource.getName());
Integer nodeId = node.getId();
Date createTimestamp = new Date();
//What protocols are involved?
//For each protocol build a new CollectionJob
Set<RrdGraphAttribute> relevantRrdGraphAttributes = getRequiredRrdGraphAttributes(reportResource, prefabGraph);
Map<String, String> rrdGraphAttributesMetaData = getMetaDataForReport(relevantRrdGraphAttributes);
Map<String, List<MetricTuple>> metricsByProtocol = getMetricIdsByProtocol(rrdGraphAttributesMetaData);
//Destinations for MeasurementSets
Set<String> resultDestinations = new HashSet<String>();
resultDestinations.add(nrtCollectionTaskId);
for (final Map.Entry<String, List<MetricTuple>> entry : metricsByProtocol.entrySet()) {
final String protocol = entry.getKey();
final List<MetricTuple> tuples = entry.getValue();
final CollectionJob collectionJob = new DefaultCollectionJob();
collectionJob.setService(protocol);
collectionJob.setNodeId(nodeId);
collectionJob.setCreationTimestamp(createTimestamp);
for (final MetricTuple metricTuple : tuples) {
collectionJob.addMetric(metricTuple.getMetricId(), resultDestinations, metricTuple.getOnmsLogicMetricId());
}
//I know....
if (protocol.equals("SNMP") || protocol.equals("TCA")) {
collectionJob.setNetInterface(protocol);
OnmsMonitoringLocation location = node.getLocation();
String locationName = (location == null) ? null : location.getLocationName();
final SnmpAgentConfig snmpAgentConfig = m_snmpAgentConfigFactory.getAgentConfig(node.getPrimaryInterface().getIpAddress(), locationName);
collectionJob.setProtocolConfiguration(snmpAgentConfig.toProtocolConfigString());
collectionJob.setNetInterface(node.getPrimaryInterface().getIpAddress().getHostAddress());
collectionJobs.add(collectionJob);
} else {
logger.error("Protocol '{}' is not supported yet. CollectionJob will be ignorred.", protocol);
}
}
return collectionJobs;
}
use of org.opennms.nrtg.api.model.DefaultCollectionJob in project opennms by OpenNMS.
the class SnmpProtocolCollectorTest method setup.
@Before
public void setup() throws Exception {
SnmpPeerFactory.setInstance(m_snmpPeerFactory);
localhost = InetAddress.getByName("127.0.0.1");
snmpAgentConfig = SnmpPeerFactory.getInstance().getAgentConfig(localhost);
collectionJob = new DefaultCollectionJob();
collectionJob.setProtocolConfiguration(snmpAgentConfig.toProtocolConfigString());
destinations = new HashSet<String>();
destinations.add("test");
}
Aggregations