Search in sources :

Example 1 with DefaultCollectdInstrumentation

use of org.opennms.netmgt.collection.core.DefaultCollectdInstrumentation in project opennms by OpenNMS.

the class CollectorTestUtils method createCollectionSpec.

public static CollectionSpecification createCollectionSpec(String svcName, ServiceCollector svcCollector, String collectionName) {
    Package pkg = new Package();
    Filter filter = new Filter();
    filter.setContent("IPADDR IPLIKE *.*.*.*");
    pkg.setFilter(filter);
    Service service = new Service();
    service.setName(svcName);
    Parameter collectionParm = new Parameter();
    collectionParm.setKey("collection");
    collectionParm.setValue(collectionName);
    service.addParameter(collectionParm);
    pkg.addService(service);
    CollectionSpecification spec = new CollectionSpecification(pkg, svcName, svcCollector, new DefaultCollectdInstrumentation(), createLocationAwareCollectorClient());
    return spec;
}
Also used : Filter(org.opennms.netmgt.config.collectd.Filter) CollectionSpecification(org.opennms.netmgt.collection.core.CollectionSpecification) Service(org.opennms.netmgt.config.collectd.Service) Parameter(org.opennms.netmgt.config.collectd.Parameter) Package(org.opennms.netmgt.config.collectd.Package) DefaultCollectdInstrumentation(org.opennms.netmgt.collection.core.DefaultCollectdInstrumentation)

Example 2 with DefaultCollectdInstrumentation

use of org.opennms.netmgt.collection.core.DefaultCollectdInstrumentation in project opennms by OpenNMS.

the class HttpCollectorIT method doTestNMS4886.

public final void doTestNMS4886(String svcName) throws Exception {
    HttpCollector collector = new HttpCollector();
    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put("http-collection", "default");
    parameters.put("port", "10342");
    collector.initialize();
    Package pkg = new Package();
    Filter filter = new Filter();
    filter.setContent("IPADDR IPLIKE *.*.*.*");
    pkg.setFilter(filter);
    Service service = new Service();
    service.setName(svcName);
    Parameter collectionParm = new Parameter();
    collectionParm.setKey("http-collection");
    collectionParm.setValue("default");
    service.addParameter(collectionParm);
    Parameter portParm = new Parameter();
    portParm.setKey("port");
    portParm.setValue("10342");
    service.addParameter(portParm);
    pkg.addService(service);
    CollectionSpecification collectionSpecification = new CollectionSpecification(pkg, svcName, collector, new DefaultCollectdInstrumentation(), CollectorTestUtils.createLocationAwareCollectorClient());
    CollectionSet collectionSet = collectionSpecification.collect(m_collectionAgent);
    assertEquals("collection status", CollectionStatus.SUCCEEDED, collectionSet.getStatus());
    CollectorTestUtils.persistCollectionSet(m_rrdStrategy, m_resourceStorageDao, collectionSpecification, collectionSet);
}
Also used : HashMap(java.util.HashMap) Filter(org.opennms.netmgt.config.collectd.Filter) CollectionSpecification(org.opennms.netmgt.collection.core.CollectionSpecification) Service(org.opennms.netmgt.config.collectd.Service) Parameter(org.opennms.netmgt.config.collectd.Parameter) Package(org.opennms.netmgt.config.collectd.Package) DefaultCollectdInstrumentation(org.opennms.netmgt.collection.core.DefaultCollectdInstrumentation) CollectionSet(org.opennms.netmgt.collection.api.CollectionSet)

Aggregations

CollectionSpecification (org.opennms.netmgt.collection.core.CollectionSpecification)2 DefaultCollectdInstrumentation (org.opennms.netmgt.collection.core.DefaultCollectdInstrumentation)2 Filter (org.opennms.netmgt.config.collectd.Filter)2 Package (org.opennms.netmgt.config.collectd.Package)2 Parameter (org.opennms.netmgt.config.collectd.Parameter)2 Service (org.opennms.netmgt.config.collectd.Service)2 HashMap (java.util.HashMap)1 CollectionSet (org.opennms.netmgt.collection.api.CollectionSet)1