Package org.jmxtrans.agent
Class Query
java.lang.Object
org.jmxtrans.agent.Query
- All Implemented Interfaces:
Collector
- Direct Known Subclasses:
DiscoveryQuery
public class Query extends Object implements Collector
- Author:
- Cyrille Le Clerc
-
Field Summary
Fields Modifier and Type Field Description protected List<String>attributesThe attribute(s) to retrieve (MBeanServer.getAttribute(javax.management.ObjectName, String)) If empty, will fetch all attributes of the MBean.protected StringkeyIf the MBean attribute value is aCompositeData, the key to lookup.protected ObjectNameobjectNameprotected IntegerpositionIf the returned value is aCollectionor an array, the position of the entry to lookup.protected StringresultAliasprotected ResultNameStrategyresultNameStrategy -
Constructor Summary
Constructors Constructor Description Query(String objectName, String attribute, int position, ResultNameStrategy resultNameStrategy)Query(String objectName, String attribute, String key, Integer position, String type, String resultAlias, ResultNameStrategy resultNameStrategy)Creates a Query with no collectInterval overide.Query(String objectName, String attribute, String key, Integer position, String type, String resultAlias, ResultNameStrategy resultNameStrategy, Integer collectInterval)Query(String objectName, String attribute, String resultAlias, ResultNameStrategy resultNameStrategy)Query(String objectName, String attribute, ResultNameStrategy resultNameStrategy)Query(String objectName, List<String> attributes, String key, Integer position, String type, String resultAlias, ResultNameStrategy resultNameStrategy, Integer collectInterval)Creates a query that accepts a list of attributes to collect. -
Method Summary
Modifier and Type Method Description voidcollectAndExport(MBeanServer mbeanServer, OutputWriter outputWriter)List<String>getAttributes()IntegergetCollectIntervalOverrideOrNull()StringgetKey()ObjectNamegetObjectName()IntegergetPosition()StringgetResultAlias()StringgetType()StringtoString()
-
Field Details
-
resultNameStrategy
-
objectName
-
attributes
The attribute(s) to retrieve (MBeanServer.getAttribute(javax.management.ObjectName, String)) If empty, will fetch all attributes of the MBean. -
resultAlias
-
key
If the MBean attribute value is aCompositeData, the key to lookup.- See Also:
CompositeData.get(String)
-
position
If the returned value is aCollectionor an array, the position of the entry to lookup.
-
-
Constructor Details
-
Query
-
Query
-
Query
-
Query
public Query(@Nonnull String objectName, @Nullable String attribute, @Nullable String key, @Nullable Integer position, @Nullable String type, @Nullable String resultAlias, @Nonnull ResultNameStrategy resultNameStrategy)Creates a Query with no collectInterval overide. -
Query
public Query(@Nonnull String objectName, @Nullable String attribute, @Nullable String key, @Nullable Integer position, @Nullable String type, @Nullable String resultAlias, @Nonnull ResultNameStrategy resultNameStrategy, @Nullable Integer collectInterval)- Parameters:
objectName- TheObjectNameto search for (MBeanServer.queryMBeans(javax.management.ObjectName, javax.management.QueryExp)), can contain wildcards and return several entries.attribute- The attribute to retrieve (MBeanServer.getAttribute(javax.management.ObjectName, String))key- if the MBean attribute value is aCompositeData, the key to lookup.position- if the returned value is aCollectionor an array, the position of the entry to lookup.type- type of the metric ('counter', 'gauge', ...)resultAlias-resultNameStrategy- theResultNameStrategyused during thecollectAndExport(javax.management.MBeanServer, OutputWriter)phase.
-
Query
public Query(@Nonnull String objectName, @Nonnull List<String> attributes, @Nullable String key, @Nullable Integer position, @Nullable String type, @Nullable String resultAlias, @Nonnull ResultNameStrategy resultNameStrategy, @Nullable Integer collectInterval)Creates a query that accepts a list of attributes to collect. If the list is empty, all attributes will be collected.- Parameters:
collectInterval-- See Also:
Query(String, String, String, Integer, String, String, ResultNameStrategy)
-
-
Method Details
-
collectAndExport
- Specified by:
collectAndExportin interfaceCollector
-
toString
-
getObjectName
-
getResultAlias
-
getAttributes
-
getKey
-
getPosition
-
getType
-
getCollectIntervalOverrideOrNull
-