Interface ServiceCollector
-
- All Known Implementing Classes:
AbstractRemoteServiceCollector,AbstractServiceCollector,AbstractSnmpCollector,HttpCollector,JdbcCollector,JMXCollector,Jsr160Collector,NSClientCollector,PrometheusCollector,ServiceCollectorImpl,SnmpCollector,SnmpCollectorNG,TcaCollector,VmwareCimCollector,VmwareCollector,WmiCollector,WsManCollector,XmlCollector,XmpCollector
public interface ServiceCollectorUsed to collect metrics from aCollectionAgentin both OpenNMS and Minion. The order of the calls made to this interface depend on whether we are running in OpenNMS or Minion. In OpenNMS when collecting in OpenNMS: * initialize() * getEffectiveLocation() * getRuntimeAttributes() * collect() * getRrdRepository() In OpenNMS when collection in Minion: * initialize() * getEffectiveLocation() * getRuntimeAttributes() * marshalParameters() * (RPC Invocation of collect()) * getRrdRepository() In Minion: * unmarshalParameters() * collect()- Author:
- Mike, jwhite
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CollectionSetcollect(CollectionAgent agent, Map<String,Object> parameters)Invokes a collection on the object.StringgetEffectiveLocation(String location)Allows the collector to override the location at which it should be run.RrdRepositorygetRrdRepository(String collectionName)Retrieve theRrdRepositoryconfiguration 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.voidinitialize()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.voidvalidateAgent(CollectionAgent agent, Map<String,Object> parameters)Validate whether or not this collector should be scheduled to run against the given agent.
-
-
-
Method Detail
-
initialize
void initialize() throws CollectionInitializationExceptionInitialize 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.
-
validateAgent
void validateAgent(CollectionAgent agent, Map<String,Object> parameters) throws CollectionInitializationException
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, aCollectionInitializationExceptionmust 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.- Parameters:
agent-parameters-- Throws:
CollectionInitializationException
-
collect
CollectionSet collect(CollectionAgent agent, Map<String,Object> parameters) throws CollectionException
Invokes a collection on the object. This call will be performed in both OpenNMS and Minion.- Parameters:
agent- aorg.opennms.netmgt.collectd.CollectionAgentobject.parameters- aMapobject.- Returns:
- a
org.opennms.netmgt.config.collector.CollectionSetobject. - Throws:
org.opennms.netmgt.collectd.CollectionException- if any.CollectionException
-
getRrdRepository
RrdRepository getRrdRepository(String collectionName)
Retrieve theRrdRepositoryconfiguration for the given collection. This call will always be performed in OpenNMS.- Parameters:
collectionName- aStringobject.- Returns:
- a
RrdRepositoryobject.
-
getRuntimeAttributes
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. This call will always be performed in OpenNMS.- 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
String getEffectiveLocation(String location)
Allows the collector to override the location at which it should be run. This call will always be performed in OpenNMS.- Parameters:
location- location associated with the service to be monitored- Returns:
- a possibly updated location
-
marshalParameters
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. We delegate this task to theServiceCollectorinstead 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.- Parameters:
parameters-- Returns:
-
-