Search code examples
monitoringjmxzabbix

Two JMX intefaces on the same host : How duplicate JMX items?


On a host, there is two Java app runing, exposing JMX data (App 1 : JBoss Wildfly. App2 : Apache Tomcat)

I set up two JMX interfaces in the Host config on the Zabbix server. Now, I want to create some items that will get the JVM data? e.g :

jmx["java.lang:type=ClassLoading",LoadedClassCount]

I can't create two items with the same key. How can I by-pass this contol ?


Solution

  • Short answer: there is no solution for this.

    Long answer:

    Why you might not want to do it

    Due to a bug https://support.zabbix.com/browse/ZBXNEXT-4677 , Zabbix does not handle multiple interfaces of the same type properly. If one of the interfaces is unavailable (like a JVM being slow or down), Zabbix stops monitoring other interfaces of the same type.

    Doing it anyway

    Hacking this manually in the configuration

    You can manually edit items to make keys different - for example, adding a space after that comma would make the key different, but it would work the same way still. Of course, that completely defeats templating and is not sustainable beyond a couple of items.

    Hacking this in the Java gateway source

    You can hack Java gateway to ignore the third parameter. This way LLD can place port as the third parameter (and also in the JMX URL), making the keys unique.

    https://support.zabbix.com/browse/ZBXNEXT-4510 asked for the change to be included in the gateway, but was rejected.

    Feature requests

    These feature requests might solve your need, but the best you can do is vote on them.