Class DiscoveryQuery

java.lang.Object
org.jmxtrans.agent.Query
org.jmxtrans.agent.DiscoveryQuery
All Implemented Interfaces:
Collector

public class DiscoveryQuery
extends Query
DiscoveryQuery : Used to discover a list of JMX beans matching a specific naming pattern. Used with the Zabbix server.

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.
Author:
Steve McDuff