public class DiscoveryQuery extends Query
For example, the following discovery rule :
<discoveryQuery
objectName="java.lang:type=GarbageCollector,name=*"
attributes="name,type"
resultAlias="discovery[garbageCollector]"
collectIntervalInSeconds="300"/>
<query objectName="java.lang:type=GarbageCollector,name=*"
attributes="CollectionTime,CollectionCount"
resultAlias="discovery[GarbageCollector.%name%.#attribute#]" />
May yield the following discovery output (formatted for readability) :
{"data":[
{"{#name}":"PS Scavenge","{#type}":"GarbageCollector"},
{"{#name}":"PS MarkSweep","{#type}":"GarbageCollector"}
]}
On the Zabbix side, create a "Discovery Rule" of type "Zabbix trapper"
with a "Key" that matches the result alias. You can then create "Item prototypes" that use the values.
Sample Zabbix configuration that matches the example above :
Discovery rule :
Name : Discover Garbage Collectors
Key : discovery[garbageCollector]
Item Prototype
Name : Object {#TYPE} named {#NAME}
Key : discovery[{#TYPE}.{#NAME}.CollectionTime]
Item Prototype
Name : Object {#TYPE} named {#NAME}
Key : discovery[{#TYPE}.{#NAME}.CollectionCount]
NOTE : It can take a few minutes for Zabbix to enable newly created discovery
rules and item prototypes.attributes, key, objectName, position, resultAlias, resultNameStrategy| Constructor and Description |
|---|
DiscoveryQuery(String objectName,
List<String> attributes,
String key,
Integer position,
String type,
String resultAlias,
ResultNameStrategy resultNameStrategy,
Integer collectInterval) |
| Modifier and Type | Method and Description |
|---|---|
void |
collectAndExport(MBeanServer mbeanServer,
OutputWriter outputWriter) |
String |
formatDiscoveryValue(String keyProperty) |
getAttributes, getCollectIntervalOverrideOrNull, getKey, getObjectName, getPosition, getResultAlias, getType, toStringpublic void collectAndExport(MBeanServer mbeanServer, OutputWriter outputWriter)
collectAndExport in interface CollectorcollectAndExport in class QueryCopyright © 2017. All Rights Reserved.