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(java.lang.String objectName,
java.util.List<java.lang.String> attributes,
java.lang.String key,
java.lang.Integer position,
java.lang.String type,
java.lang.String resultAlias,
ResultNameStrategy resultNameStrategy,
java.lang.Integer collectInterval) |
| Modifier and Type | Method and Description |
|---|---|
void |
collectAndExport(javax.management.MBeanServer mbeanServer,
OutputWriter outputWriter) |
java.lang.String |
formatDiscoveryValue(java.lang.String keyProperty) |
getAttributes, getCollectIntervalOverrideOrNull, getKey, getObjectName, getPosition, getResultAlias, getType, toStringpublic DiscoveryQuery(java.lang.String objectName,
java.util.List<java.lang.String> attributes,
java.lang.String key,
java.lang.Integer position,
java.lang.String type,
java.lang.String resultAlias,
ResultNameStrategy resultNameStrategy,
java.lang.Integer collectInterval)
public void collectAndExport(javax.management.MBeanServer mbeanServer,
OutputWriter outputWriter)
collectAndExport in interface CollectorcollectAndExport in class Querypublic java.lang.String formatDiscoveryValue(java.lang.String keyProperty)
Copyright © 2018. All Rights Reserved.