use of org.opennms.netmgt.collection.api.ServiceParameters in project opennms by OpenNMS.
the class CollectionResourceWrapperIT method createNodeResource.
private SnmpCollectionResource createNodeResource(SnmpCollectionAgent agent) {
MockDataCollectionConfig dataCollectionConfig = new MockDataCollectionConfig();
OnmsSnmpCollection collection = new OnmsSnmpCollection(agent, new ServiceParameters(new HashMap<String, Object>()), dataCollectionConfig, m_locationAwareSnmpClient);
NodeResourceType resourceType = new NodeResourceType(agent, collection);
return new NodeInfo(resourceType, agent);
}
use of org.opennms.netmgt.collection.api.ServiceParameters in project opennms by OpenNMS.
the class TcpOutputStrategyTest method persist.
public void persist(CollectionSet collectionSet, boolean forceStoreByGroup) {
ServiceParameters params = new ServiceParameters(Collections.emptyMap());
RrdRepository repo = new RrdRepository();
repo.setRrdBaseDir(tempFolder.getRoot());
Persister persister = persisterFactory.createPersister(params, repo, false, forceStoreByGroup, false);
collectionSet.visit(persister);
}
use of org.opennms.netmgt.collection.api.ServiceParameters in project opennms by OpenNMS.
the class CollectionSetDTO method buildCollectionResources.
private Set<CollectionResource> buildCollectionResources() {
final Set<CollectionResource> collectionResources = new LinkedHashSet<>();
for (CollectionResourceDTO entry : this.collectionResources) {
final Resource resource = entry.getResource();
final AbstractCollectionResource collectionResource = CollectionSetBuilder.toCollectionResource(resource, agent);
for (Attribute<?> attribute : entry.getAttributes()) {
final AttributeGroupType groupType = new AttributeGroupType(attribute.getGroup(), AttributeGroupType.IF_TYPE_ALL);
final AbstractCollectionAttributeType attributeType = new AbstractCollectionAttributeType(groupType) {
@Override
public AttributeType getType() {
return attribute.getType();
}
@Override
public String getName() {
return attribute.getName();
}
@Override
public void storeAttribute(CollectionAttribute collectionAttribute, Persister persister) {
if (AttributeType.STRING.equals(attribute.getType())) {
persister.persistStringAttribute(collectionAttribute);
} else {
persister.persistNumericAttribute(collectionAttribute);
}
}
@Override
public String toString() {
return attribute.toString();
}
};
collectionResource.addAttribute(new AbstractCollectionAttribute(attributeType, collectionResource) {
@Override
public String getMetricIdentifier() {
return attribute.getName();
}
@Override
public Number getNumericValue() {
return attribute.getNumericValue();
}
@Override
public String getStringValue() {
return attribute.getStringValue();
}
@Override
public boolean shouldPersist(ServiceParameters params) {
return !(Boolean.FALSE.equals(disableCounterPersistence) && AttributeType.COUNTER.equals(attribute.getType()));
}
@Override
public String toString() {
return String.format("Attribute[%s:%s]", getMetricIdentifier(), attribute.getValue());
}
});
}
collectionResources.add(collectionResource);
}
return collectionResources;
}
use of org.opennms.netmgt.collection.api.ServiceParameters in project opennms by OpenNMS.
the class ThresholdingVisitorIT method createGenericIndexResourceType.
private GenericIndexResourceType createGenericIndexResourceType(SnmpCollectionAgent agent, String resourceTypeName) {
org.opennms.netmgt.config.datacollection.ResourceType type = createIndexResourceType(agent, resourceTypeName);
MockDataCollectionConfig dataCollectionConfig = new MockDataCollectionConfig();
OnmsSnmpCollection collection = new OnmsSnmpCollection(agent, new ServiceParameters(new HashMap<String, Object>()), dataCollectionConfig, m_locationAwareSnmpClient);
return new GenericIndexResourceType(agent, collection, type);
}
use of org.opennms.netmgt.collection.api.ServiceParameters in project opennms by OpenNMS.
the class SnmpCollectorITCase method initializeAgent.
protected void initializeAgent() throws CollectionInitializationException {
ServiceParameters params = new ServiceParameters(new HashMap<String, Object>());
OnmsSnmpCollection snmpCollection = new OnmsSnmpCollection(m_agent, params, m_config, m_locationAwareSnmpClient);
m_collectionSet = snmpCollection.createCollectionSet(m_agent);
m_agent.validateAgent();
}
Aggregations