title: zabbix JMX monitoring of kafka
body: <p>I am trying to monitor java app Apache Kafka Server from zabbix via zabbix java gateway and I am a bit struggling with zabbix set up. I was able to monitor JVM standard metrics like LoadedClassCount etc. But I cannot find proper setup for Kafka metrics.</p>
  
  <p><img src="https://i.stack.imgur.com/Ze3Ns.png" alt="JConsole kafka JMX attributes"></p>
  
  <p>My zabbix java gateway JMX key is following:</p>
  
  <pre><code>jmx["kafka.server.BrokerTopicMetrics:type=AllTopicsMessagesInPerSec",Count]
  </code></pre>
  
  <p>I tried various combination but so far with no luck. Any hints what might be wrong?</p>
  
  <p>It seems like JMX objects are nested.</p>
  
  <p>Update:
  I tried to replicate situation avoiding a Kafka MBeans using standard JVM MBeans
  <img src="https://i.stack.imgur.com/cC4gJ.png" alt="Standard JVM MBean"></p>
  
  <p>Using Zabbix config</p>
  
  <pre><code>jmx[java.lang:type=GarbageCollector,ConcurrentMarkSweep.CollectionCount]
  </code></pre>
  
  <p>And I am getting following exception in log:</p>
  
  <pre><code>2014-07-09 08:00:11.664 [pool-1-thread-5] DEBUG com.zabbix.gateway.ItemChecker - caught exception for item 'jmx[java.lang:type=GarbageCollector,ConcurrentMarkSweep.CollectionCount]'
  javax.management.InstanceNotFoundException: java.lang:type=GarbageCollector
          at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1118) ~[na:1.6.0_24]
          at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:679) ~[na:1.6.0_24]
          at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:672) ~[na:1.6.0_24]
          at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1427) ~[na:1.6.0_24]
          at javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:90) ~[na:1.6.0_24]
          at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1285) ~[na:1.6.0_24]
          at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1383) ~[na:1.6.0_24]
          at javax.management.remote.rmi.RMIConnectionImpl.getAttribute(RMIConnectionImpl.java:619) ~[na:1.6.0_24]
          at sun.reflect.GeneratedMethodAccessor82.invoke(Unknown Source) ~[na:na]
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.6.0_24]
          at java.lang.reflect.Method.invoke(Method.java:616) ~[na:1.6.0_24]
          at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322) ~[na:1.6.0_24]
          at sun.rmi.transport.Transport$1.run(Transport.java:177) ~[na:1.6.0_24]
          at java.security.AccessController.doPrivileged(Native Method) ~[na:1.6.0_24]
          at sun.rmi.transport.Transport.serviceCall(Transport.java:173) ~[na:1.6.0_24]
          at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553) ~[na:1.6.0_24]
          at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808) ~[na:1.6.0_24]
          at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667) ~[na:1.6.0_24]
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [na:1.6.0_24]
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [na:1.6.0_24]
          at java.lang.Thread.run(Thread.java:679) [na:1.6.0_24]
  </code></pre>
  
  <p>Thx</p>