Zabbix Documentation 3.4

2.23.04.04.2 (current)In development:4.4 (devel)Unsupported:1.82.02.43.23.4

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/01/26 15:40]
dimir fixed instructions regarding spaces, reformat heading
manual:config:items:itemtypes:jmx_monitoring [2018/07/19 06:51] (current)
martins-v some rewording
Line 1: Line 1:
 ====== 14 JMX monitoring ====== ====== 14 JMX monitoring ======
  
-===== Overview ​=====+=== Overview ===
  
 JMX monitoring can be used to monitor JMX counters of a Java application. JMX monitoring can be used to monitor JMX counters of a Java application.
Line 13: Line 13:
 <note warning>​Communication between Java gateway and the monitored JMX application should not be firewalled.</​note>​ <note warning>​Communication between Java gateway and the monitored JMX application should not be firewalled.</​note>​
  
-===== Enabling remote JMX monitoring for Java application ​=====+=== Enabling remote JMX monitoring for Java application ===
  
 A Java application does not need any additional software installed, but it needs to be started with the command-line options specified below to have support for remote JMX monitoring. A Java application does not need any additional software installed, but it needs to be started with the command-line options specified below to have support for remote JMX monitoring.
Line 53: Line 53:
 See [[http://​download.oracle.com/​javase/​1.5.0/​docs/​guide/​management/​agent.html|Monitoring and Management Using JMX]] for a detailed description. See [[http://​download.oracle.com/​javase/​1.5.0/​docs/​guide/​management/​agent.html|Monitoring and Management Using JMX]] for a detailed description.
  
-===== Configuring JMX interfaces and items in Zabbix frontend ​=====+=== Configuring JMX interfaces and items in Zabbix frontend ===
  
 With Java gateway running, server knowing where to find it and a Java application started with support for remote JMX monitoring, it is time to configure the interfaces and items in Zabbix GUI. With Java gateway running, server knowing where to find it and a Java application started with support for remote JMX monitoring, it is time to configure the interfaces and items in Zabbix GUI.
  
-==== Configuring JMX interface ​====+== Configuring JMX interface ==
  
 You begin by creating a JMX-type interface on the host of interest: You begin by creating a JMX-type interface on the host of interest:
Line 63: Line 63:
 {{jmx_interface.png?​600|}} {{jmx_interface.png?​600|}}
  
-==== Adding JMX agent item ====+== Adding JMX agent item ==
  
 For each JMX counter you are interested in you add **JMX agent** item attached to that interface. ​ For each JMX counter you are interested in you add **JMX agent** item attached to that interface. ​
Line 81: Line 81:
 If you wish to monitor a Boolean counter that is either "​true"​ or "​false",​ then you specify type of information as "​Numeric (unsigned)"​ and select "​Boolean to decimal"​ preprocessing step in the Preprocessing tab. Server will store Boolean values as 1 or 0, respectively. If you wish to monitor a Boolean counter that is either "​true"​ or "​false",​ then you specify type of information as "​Numeric (unsigned)"​ and select "​Boolean to decimal"​ preprocessing step in the Preprocessing tab. Server will store Boolean values as 1 or 0, respectively.
  
-==== JMX item keys in more detail ​====+=== JMX item keys in more detail ===
  
-=== Simple attributes ​===+== Simple attributes ==
  
 An MBean object name is nothing but a string which you define in your Java application. An attribute name, on the other hand, can be more complex. In case an attribute returns primitive data type (an integer, a string etc.) there is nothing to worry about, the key will look like this: An MBean object name is nothing but a string which you define in your Java application. An attribute name, on the other hand, can be more complex. In case an attribute returns primitive data type (an integer, a string etc.) there is nothing to worry about, the key will look like this:
Line 91: Line 91:
 In this example an object name is "​com.example:​Type=Hello",​ attribute name is "​weight"​ and probably the returned value type should be "​Numeric (float)"​. In this example an object name is "​com.example:​Type=Hello",​ attribute name is "​weight"​ and probably the returned value type should be "​Numeric (float)"​.
  
-=== Attributes returning composite data ===+== Attributes returning composite data ==
  
 It becomes more complicated when your attribute returns composite data. For example: your attribute name is "​apple"​ and it returns a hash representing its parameters, like "​weight",​ "​color"​ etc. Your key may look like this: It becomes more complicated when your attribute returns composite data. For example: your attribute name is "​apple"​ and it returns a hash representing its parameters, like "​weight",​ "​color"​ etc. Your key may look like this:
Line 101: Line 101:
   jmx[com.example:​Type=Hello,​fruits.apple.weight]   jmx[com.example:​Type=Hello,​fruits.apple.weight]
  
-=== Problem with dots ===+== Problem with dots ==
  
 So far so good. But what if an attribute name or a hash key contains dot symbol? Here is an example: So far so good. But what if an attribute name or a hash key contains dot symbol? Here is an example:
Line 117: Line 117:
   jmx[com.example:​Type=Hello,​all\.fruits.apple.total\.weight]   jmx[com.example:​Type=Hello,​all\.fruits.apple.total\.weight]
  
-=== Other issues ​===+== Other issues ==
  
-A backslash character should be escaped ​as well:+A backslash character ​in an attribute name should be escaped:
  
   jmx[com.example:​type=Hello,​c:​\\documents]   jmx[com.example:​type=Hello,​c:​\\documents]
  
-If the object name or attribute name contains commasdouble-quote it: +For handling any other special characters in JMX item keyplease see [[/​manual/​config/​items/​item/​key##​parameter_-_quoted_string|this section]].
- +
-  jmx["​com.example:​Type=My,​object","​bits,​pieces"​]+
  
 This is actually all there is to it. Happy JMX monitoring! This is actually all there is to it. Happy JMX monitoring!
  
 +=== 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|}}