Class PrometheusCollector
- java.lang.Object
-
- org.opennms.netmgt.collection.api.AbstractServiceCollector
-
- org.opennms.netmgt.collection.api.AbstractRemoteServiceCollector
-
- org.opennms.netmgt.collectd.prometheus.PrometheusCollector
-
- All Implemented Interfaces:
ServiceCollector
public class PrometheusCollector extends AbstractRemoteServiceCollector
Collects metrics exposed via HTTP(S) using the Prometheus exposition format. We leverage the Prometheus parser code (APLv2 licensed) written by RedHat as part of the hawkular-agent. See https://github.com/hawkular/hawkular-agent/tree/0.23.0.Final. (The code was removed from their tree in 0.24.0). Further details on the format are available at: https://prometheus.io/docs/instrumenting/exposition_formats/- Author:
- jwhite
-
-
Constructor Summary
Constructors Constructor Description PrometheusCollector()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CollectionSetcollect(CollectionAgent agent, Map<String,Object> map)Invokes a collection on the object.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.voidsetPrometheusCollectionDao(PrometheusDataCollectionConfigDao prometheusCollectionDao)protected static CollectionSettoCollectionSet(CollectionAgent agent, PrometheusCollectionRequest request, List<Metric> metrics)-
Methods inherited from class org.opennms.netmgt.collection.api.AbstractRemoteServiceCollector
getEffectiveLocation, marshalParameters, unmarshalParameters
-
Methods inherited from class org.opennms.netmgt.collection.api.AbstractServiceCollector
validateAgent
-
-
-
-
Method Detail
-
initialize
public void initialize()
Description copied from interface:ServiceCollectorInitialize 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:
initializein interfaceServiceCollector- Overrides:
initializein classAbstractServiceCollector
-
getRuntimeAttributes
public Map<String,Object> getRuntimeAttributes(CollectionAgent agent, Map<String,Object> parameters)
Description copied from interface:ServiceCollectorInvoked 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:
getRuntimeAttributesin interfaceServiceCollector- Overrides:
getRuntimeAttributesin classAbstractServiceCollector- 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).
-
collect
public CollectionSet collect(CollectionAgent agent, Map<String,Object> map) throws CollectionException
Description copied from interface:ServiceCollectorInvokes a collection on the object. This call will be performed in both OpenNMS and Minion.- Parameters:
agent- aorg.opennms.netmgt.collectd.CollectionAgentobject.map- aMapobject.- Returns:
- a
org.opennms.netmgt.config.collector.CollectionSetobject. - Throws:
CollectionException
-
toCollectionSet
protected static CollectionSet toCollectionSet(CollectionAgent agent, PrometheusCollectionRequest request, List<Metric> metrics)
-
getRrdRepository
public RrdRepository getRrdRepository(String collectionName)
Description copied from interface:ServiceCollectorRetrieve theRrdRepositoryconfiguration for the given collection. This call will always be performed in OpenNMS.- Parameters:
collectionName- aStringobject.- Returns:
- a
RrdRepositoryobject.
-
setPrometheusCollectionDao
public void setPrometheusCollectionDao(PrometheusDataCollectionConfigDao prometheusCollectionDao)
-
-