Class ServiceCollectorImpl<T extends org.opennms.integration.api.v1.collectors.ServiceCollector>
- java.lang.Object
-
- org.opennms.features.apilayer.collectors.ServiceCollectorImpl<T>
-
- All Implemented Interfaces:
ServiceCollector
public class ServiceCollectorImpl<T extends org.opennms.integration.api.v1.collectors.ServiceCollector> extends Object implements ServiceCollector
-
-
Constructor Summary
Constructors Constructor Description ServiceCollectorImpl(org.opennms.integration.api.v1.collectors.ServiceCollectorFactory<T> serviceCollectorFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CollectionSet
collect(CollectionAgent agent, Map<String,Object> parameters)
Invokes a collection on the object.String
getEffectiveLocation(String location)
Allows the collector to override the location at which it should be run.RrdRepository
getRrdRepository(String collectionName)
Retrieve theRrdRepository
configuration for the given collection.Map<String,Object>
getRuntimeAttributes(CollectionAgent agent, Map<String,Object> parameters)
Invoked before every call to#collect(CollectionAgent, EventProxy, Map)
in order to retrieve state/runtime information required for perform the collection.void
initialize()
Initialize the collector.Map<String,String>
marshalParameters(Map<String,Object> parameters)
Marshal the parameter values to strings, which is necessary for passing the parameters over the wire for the RPC call.Map<String,Object>
unmarshalParameters(Map<String,String> parameters)
Unmarshal the parameter values from strings.void
validateAgent(CollectionAgent agent, Map<String,Object> parameters)
Validate whether or not this collector should be scheduled to run against the given agent.
-
-
-
Constructor Detail
-
ServiceCollectorImpl
public ServiceCollectorImpl(org.opennms.integration.api.v1.collectors.ServiceCollectorFactory<T> serviceCollectorFactory)
-
-
Method Detail
-
initialize
public void initialize() throws CollectionInitializationException
Description copied from interface:ServiceCollector
Initialize the collector. This call will be invoked in OpenNMS before any other calls to the collector are made. This function may be invoked several times during the lifetime or the collector.- Specified by:
initialize
in interfaceServiceCollector
- Throws:
CollectionInitializationException
-
validateAgent
public void validateAgent(CollectionAgent agent, Map<String,Object> parameters) throws CollectionInitializationException
Description copied from interface:ServiceCollector
Validate whether or not this collector should be scheduled to run against the given agent. If the collector cannot, or should not be a run against a given agent, aCollectionInitializationException
must be thrown. In the case of the SNMP collector, this is used to prevent collect from scheduling interfaces other than the those marked as primary on a given node.- Specified by:
validateAgent
in interfaceServiceCollector
- Throws:
CollectionInitializationException
-
collect
public CollectionSet collect(CollectionAgent agent, Map<String,Object> parameters) throws CollectionException
Description copied from interface:ServiceCollector
Invokes a collection on the object. This call will be performed in both OpenNMS and Minion.- Specified by:
collect
in interfaceServiceCollector
- Parameters:
agent
- aorg.opennms.netmgt.collectd.CollectionAgent
object.parameters
- aMap
object.- Returns:
- a
org.opennms.netmgt.config.collector.CollectionSet
object. - Throws:
CollectionException
-
getRrdRepository
public RrdRepository getRrdRepository(String collectionName)
Description copied from interface:ServiceCollector
Retrieve theRrdRepository
configuration for the given collection. This call will always be performed in OpenNMS.- Specified by:
getRrdRepository
in interfaceServiceCollector
- Parameters:
collectionName
- aString
object.- Returns:
- a
RrdRepository
object.
-
getRuntimeAttributes
public Map<String,Object> getRuntimeAttributes(CollectionAgent agent, Map<String,Object> parameters)
Description copied from interface:ServiceCollector
Invoked before every call to#collect(CollectionAgent, EventProxy, Map)
in order to retrieve state/runtime information required for perform the collection. This call will always be performed in OpenNMS.- Specified by:
getRuntimeAttributes
in interfaceServiceCollector
- Parameters:
agent
- Includes details about to the agent from which we wish to collect.parameters
- Includes the service parameters defined in collectd-configuration.xml.- Returns:
- Additional attributes, which should be added to the parameter map before calling
#collect(CollectionAgent, EventProxy, Map)
.
-
getEffectiveLocation
public String getEffectiveLocation(String location)
Description copied from interface:ServiceCollector
Allows the collector to override the location at which it should be run. This call will always be performed in OpenNMS.- Specified by:
getEffectiveLocation
in interfaceServiceCollector
- Parameters:
location
- location associated with the service to be monitored- Returns:
- a possibly updated location
-
marshalParameters
public Map<String,String> marshalParameters(Map<String,Object> parameters)
Description copied from interface:ServiceCollector
Marshal the parameter values to strings, which is necessary for passing the parameters over the wire for the RPC call. We delegate this task to theServiceCollector
instead of handling it elsewhere since the API, and RPC module do not have access to the model objects used by the collector. This will only be called in OpenNMS when the collector is to be executed remotely.- Specified by:
marshalParameters
in interfaceServiceCollector
- Returns:
-
unmarshalParameters
public Map<String,Object> unmarshalParameters(Map<String,String> parameters)
Description copied from interface:ServiceCollector
Unmarshal the parameter values from strings. This call will always be performed in Minion.- Specified by:
unmarshalParameters
in interfaceServiceCollector
- Returns:
-
-