Zabbix Documentation 5.0

3.04.04.4 (current)| In development:5.0 (devel)| Unsupported:1.82.02.22.43.23.44.2Guidelines

User Tools

Site Tools


manual:config:items:itemtypes:jmx_monitoring

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
manual:config:items:itemtypes:jmx_monitoring [2018/03/27 09:03]
martins-v fixng heading levels
manual:config:items:itemtypes:jmx_monitoring [2020/03/16 11:35] (current)
martins-v minor grammar fix
Line 71: Line 71:
 The key in the screenshot below says ''​%%jmx["​java.lang:​type=Memory","​HeapMemoryUsage.used"​]%%''​. The key in the screenshot below says ''​%%jmx["​java.lang:​type=Memory","​HeapMemoryUsage.used"​]%%''​.
  
-{{jmx_item.png|}}+{{jmx_item.png?600|}}
  
 All mandatory input fields are marked with a red asterisk. ​ All mandatory input fields are marked with a red asterisk. ​
Line 105: Line 105:
   jmx[com.example:​Type=Hello,​fruits.apple.weight]   jmx[com.example:​Type=Hello,​fruits.apple.weight]
  
 +== Attributes returning tabular data ==
 +
 +Tabular data attributes consist of one or multiple composite attributes. If such an attribute is specified in the attribute name parameter then this item value will return the complete structure of the attribute in JSON format. The individual element values inside the tabular data attribute can be retrieved using preprocessing.
 +
 +Tabular data attribute example:
 +   ​jmx[com.example:​type=Hello,​foodinfo]
 +
 +Item value:
 +<code javascript>​
 +[
 +  {
 +    "​a":​ "​apple",​
 +    "​b":​ "​banana",​
 +    "​c":​ "​cherry"​
 +  },
 +  {
 +    "​a":​ "​potato",​
 +    "​b":​ "​lettuce",​
 +    "​c":​ "​onion"​
 +  }
 +]
 +</​code>​
 == Problem with dots == == Problem with dots ==
  
Line 127: Line 149:
   jmx[com.example:​type=Hello,​c:​\\documents]   jmx[com.example:​type=Hello,​c:​\\documents]
  
-For handling any other special characters in JMX item key, please see [[/​manual/​config/​items/​item/​key##​parameter_-_quoted_string|this section]].+For handling any other special characters in JMX item key, please see the item key format ​[[/​manual/​config/​items/​item/​key##​parameter_-_quoted_string|section]].
  
 This is actually all there is to it. Happy JMX monitoring! This is actually all there is to it. Happy JMX monitoring!
  
 +== Non-primitive data types ==
 +
 +Since Zabbix 4.0.0 it is possible to work with custom MBeans returning non-primitive data types, which override the **toString()** method.
 +
 +=== Custom endpoint example with JBoss EAP 6.4 ===
 +
 +Custom endpoints allow working with different transport protocols other than the default RMI.
 +
 +To illustrate this possibility,​ let's try to configure JBoss EAP 6.4 monitoring as an example. First, let's make some assumptions:​
 +
 +  * You have already installed Zabbix Java gateway. If not, then you can do it in accordance with the [[:​manual/​concepts/​java|documentation]].
 +  * Zabbix server and Java gateway are installed with the prefix /usr/local/
 +  * JBoss is already installed in /​opt/​jboss-eap-6.4/​ and is running in standalone mode
 +  * We shall assume that all these components work on the same host
 +  * Firewall and SELinux are disabled (or configured accordingly)
 +
 +Let's make some simple settings in zabbix_server.conf:​
 +
 +  JavaGateway=127.0.0.1
 +  StartJavaPollers=5
 +
 +And in the zabbix_java/​settings.sh configuration file (or zabbix_java_gateway.conf):​
 +
 +  START_POLLERS=5
 +
 +Check that JBoss listens to its standard management port:
 +
 +  $ netstat -natp | grep 9999
 +  tcp        0      0 127.0.0.1:​9999 ​         0.0.0.0:​* ​              ​LISTEN ​     10148/java
 +
 +Now let's create a host with JMX interface 127.0.0.1:​9999 in Zabbix.
 +
 +{{:​manual:​config:​items:​itemtypes:​jmx_jboss_example.png?​600|}}
 +
 +As we know that this version of JBoss uses the the JBoss Remoting protocol instead of RMI, we may mass update the JMX endpoint parameter in our JMX template accordingly:​
 +
 +  service:​jmx:​remoting-jmx://​{HOST.CONN}:​{HOST.PORT}
 +
 +{{:​manual:​config:​items:​itemtypes:​jmx_jboss_example3.png?​600|}}
 +
 +Let's update the configuration cache:
 +  $ /​usr/​local/​sbin/​zabbix_server -R config_cache_reload
 +
 +Note that you may encounter an error first.
 +
 +{{:​manual:​config:​items:​itemtypes:​jmx_jboss_example4.png?​600|}}
 +
 +"​Unsupported protocol: remoting-jmx"​ means that Java gateway does not know how to work with the specified protocol. That can be fixed by creating a ~/​needed_modules.txt file with the following content:
 +
 +  jboss-as-remoting
 +  jboss-logging
 +  jboss-logmanager
 +  jboss-marshalling
 +  jboss-remoting
 +  jboss-sasl
 +  jcl-over-slf4j
 +  jul-to-slf4j-stub
 +  log4j-jboss-logmanager
 +  remoting-jmx
 +  slf4j-api
 +  xnio-api
 +  xnio-nio</​pre>​
 +
 +and then executing the command:
 +
 +  $ for i in $(cat ~/​needed_modules.txt);​ do find /​opt/​jboss-eap-6.4 -iname ${i}*.jar -exec cp {} /​usr/​local/​sbin/​zabbix_java/​lib/​ \; ; done
 +
 +Thus, Java gateway will have all the necessary modules for working with jmx-remoting. What's left is to restart the Java gateway, wait a bit and if you did everything right, see that JMX monitoring data begin to arrive in Zabbix:
  
 +{{:​manual:​config:​items:​itemtypes:​jmx_jboss_example5.png?​600|}}