Zabbix Documentation 4.2

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/07/17 05:57]
martins-v fixing typo
manual:config:items:itemtypes:jmx_monitoring [2018/10/01 09:42] (current)
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 127: Line 127:
   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 endpoint example with JBoss EAP 6.4 ===
  
-Custom endpoints ​(available since Zabbix 3.4) allow working with different transport protocols other than the default RMI.+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:​ 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]].   * 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/. +  * 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. +  * JBoss is already installed in /​opt/​jboss-eap-6.4/​ and is running in standalone mode 
-  * For simplicity of the experiment, we shall assume that all these components work on the same host. +  * We shall assume that all these components work on the same host 
-  * Firewall and SELinux are disabled (or configured accordingly, but this is beyond the scope of the article).+  * Firewall and SELinux are disabled (or configured accordingly)
  
 Let's make some simple settings in zabbix_server.conf:​ Let's make some simple settings in zabbix_server.conf:​
Line 148: Line 152:
   StartJavaPollers=5   StartJavaPollers=5
  
-And in the configuration file zabbix_java/​settings.sh (or zabbix_java_gateway.conf):​+And in the zabbix_java/​settings.sh ​configuration file (or zabbix_java_gateway.conf):​
  
   START_POLLERS=5   START_POLLERS=5
Line 161: Line 165:
 {{:​manual:​config:​items:​itemtypes:​jmx_jboss_example.png?​600|}} {{:​manual:​config:​items:​itemtypes:​jmx_jboss_example.png?​600|}}
  
-If now we just take the standard %%"​%%Template App Generic Java JMX%%"​%% and link it to the host, then we probably will get an error: +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:
- +
-  $ tail -f /​tmp/​zabbix_java.log +
- +
-{{:​manual:​config:​items:​itemtypes:​jmx_jboss_example2.png?​600|}} +
- +
-Java gateway tells us that at the specified endpoint it is not RMI at all. Well, we already ​know that this version of JBoss uses the JBoss Remoting protocol instead of RMI, and we just need to start knocking at the right endpoint. +
- +
-Let's make a full clone of %%"​%%Template App Generic Java JMX%%"​%% and call it %%"​%%Template App Generic Java JMX-remoting%%"​%%. Let's select all the data elements inside this template and execute the mass update ​operation for the JMX endpoint parameter. Let's enter the following URL:+
  
   service:​jmx:​remoting-jmx://​{HOST.CONN}:​{HOST.PORT}   service:​jmx:​remoting-jmx://​{HOST.CONN}:​{HOST.PORT}
Line 178: Line 174:
   $ /​usr/​local/​sbin/​zabbix_server -R config_cache_reload   $ /​usr/​local/​sbin/​zabbix_server -R config_cache_reload
  
-Error again.+Note that you may encounter an error first.
  
 {{:​manual:​config:​items:​itemtypes:​jmx_jboss_example4.png?​600|}} {{:​manual:​config:​items:​itemtypes:​jmx_jboss_example4.png?​600|}}
  
-What is it this time? +"​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:
- +
-"​Unsupported protocol: remoting-jmx"​ means that Java gateway does not know how to work with the specified protocol. ​Well, let's teach it. The advice from the article "​[[https://​www.denniskanbier.nl/​blog/​monitoring/​jboss-eap-6-monitoring-using-remoting-jmx-and-zabbix/​|JBoss EAP 6 monitoring using remoting-jmx and Zabbix]]"​ will help us in this. +
- +
-Create ​a ~/​needed_modules.txt file with the following content:+
  
   jboss-as-remoting   jboss-as-remoting
Line 202: Line 194:
   xnio-nio</​pre>​   xnio-nio</​pre>​
  
-Execute ​the command:+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   $ 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 the precious ​data begin to arrive in Zabbix:+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|}} {{:​manual:​config:​items:​itemtypes:​jmx_jboss_example5.png?​600|}}