Zabbix Documentation 3.4

2.23.03.4In development:4.0Unsupported versions:1.82.02.43.2

User Tools

Site Tools


Sidebar

manual:discovery:low_level_discovery:jmx

5 Discovery of JMX objects

Overview

It is possible to discover all JMX MBeans or MBean attributes or to specify a pattern for the discovery of these objects.

Item key

In discovery rule configuration, select JMX agent in the Type field.

The item key to use is

jmx.discovery[<discovery mode>,<object name>]

where

  • discovery mode - one of the following: attributes (retrieve JMX MBean attributes, default) or beans (retrieve JMX MBeans)
  • object name - object name pattern identifying the MBean names to be retrieved (empty by default, retrieving all registered beans).

You may consult ObjectName documentation for the options of specifying object name pattern.

If no parameters are passed, all MBean attributes from JMX are requested.

Not specifying parameters for JMX discovery or trying to receive all attributes for a wide range like *:type=*,name=* may lead to potential performance problems.

This item key is supported since Zabbix Java gateway 3.4.

Item key examples:

jmx.discovery  #Retrieve all JMX MBean attributes
jmx.discovery[beans]  #Retrieve all JMX MBeans
jmx.discovery[attributes,"*:type=GarbageCollector,name=*"]  #Retrieve all garbage collector attributes
jmx.discovery[beans,"*:type=GarbageCollector,name=*"]  #Retrieve all garbage collectors

This item returns a JSON object. For example, in the discovery of MBean attributes (reformatted for clarity):

{
   "data":[
      {
         "{#JMXVALUE}":"0",
         "{#JMXTYPE}":"java.lang.Long",
         "{#JMXOBJ}":"java.lang:type=GarbageCollector,name=PS Scavenge",
         "{#JMXDESC}":"java.lang:type=GarbageCollector,name=PS Scavenge,CollectionCount",
         "{#JMXATTR}":"CollectionCount"
      },
      {
         "{#JMXVALUE}":"0",
         "{#JMXTYPE}":"java.lang.Long",
         "{#JMXOBJ}":"java.lang:type=GarbageCollector,name=PS Scavenge",
         "{#JMXDESC}":"java.lang:type=GarbageCollector,name=PS Scavenge,CollectionTime",
         "{#JMXATTR}":"CollectionTime"
      },
      {
         "{#JMXVALUE}":"true",
         "{#JMXTYPE}":"java.lang.Boolean",
         "{#JMXOBJ}":"java.lang:type=GarbageCollector,name=PS Scavenge",
         "{#JMXDESC}":"java.lang:type=GarbageCollector,name=PS Scavenge,Valid",
         "{#JMXATTR}":"Valid"
      },
      {
         "{#JMXVALUE}":"PS Scavenge",
         "{#JMXTYPE}":"java.lang.String",
         "{#JMXOBJ}":"java.lang:type=GarbageCollector,name=PS Scavenge",
         "{#JMXDESC}":"java.lang:type=GarbageCollector,name=PS Scavenge,Name",
         "{#JMXATTR}":"Name"
      },
      {
         "{#JMXVALUE}":"java.lang:type=GarbageCollector,name=PS Scavenge",
         "{#JMXTYPE}":"javax.management.ObjectName",
         "{#JMXOBJ}":"java.lang:type=GarbageCollector,name=PS Scavenge",
         "{#JMXDESC}":"java.lang:type=GarbageCollector,name=PS Scavenge,ObjectName",
         "{#JMXATTR}":"ObjectName"
      }
   ]
}

In the discovery of MBeans (reformatted for clarity):

{
   "data":[
      {
         "{#JMXDOMAIN}":"java.lang",
         "{#JMXTYPE}":"GarbageCollector",
         "{#JMXOBJ}":"java.lang:type=GarbageCollector,name=PS Scavenge",
         "{#JMXNAME}":"PS Scavenge"
      }
   ]
}

Supported macros

The following macros are supported for use in the discovery rule filter and prototypes of items, triggers and graphs:

MacroDescription
Discovery of MBean attributes
{#JMXVALUE} Attribute value.
{#JMXTYPE} Attribute type.
{#JMXOBJ} Object name.
{#JMXDESC} Object name including attribute name.
{#JMXATTR} Attribute name.
Discovery of MBeans
{#JMXDOMAIN} MBean domain. (Zabbix reserved name)
{#JMXOBJ} Object name. (Zabbix reserved name)
{#JMX<key property>} MBean properties (like {#JMXTYPE}, {#JMXNAME}). Some important notes to pay attention to when defining MBean attribute name that is created from MBean property name by the following algorithm:

* attribute name case is changed to uppercase;
* attribute name case is ignored (no LLD macro is generated) in case it consists of not supported characters. Supported characters can be described by the following regular expression: “A-Z0-9_\.”;
* if an attribute name is called “obj” or “domain” it will be replaced with the values of Zabbix properties {#JMXOBJ} and {#JMXDOMAIN} (supported since Zabbix 3.4.3.).

Please consider this jmx.discovery (with “beans” mode) example. MBean has the following properties defined:

name=test
тип=Type
attributes []=1,2,3
Name=NameOfTheTest
domAin=some

As a result of JMX discovery, the following LLD macros will be generated:

  • {#JMXDOMAIN} - Zabbix internal, describing the domain of MBean
  • {#JMXOBJ} - Zabbix internal, describing MBean object
  • {#JMXNAME} - created from “name” property

Ignored properties are:

  • тип : its name contains unsupported characters (non-ASCII)
  • attributes[] : its name contains unsupported characters (square brackets are not supported)
  • Name : it's already defined (name=test)
  • domAin : it's a Zabbix reserved name