[ZBXNEXT-1223] JMX items LLD discovery Created: 2012 May 15 Updated: 2024 Apr 10 Resolved: 2017 Aug 04 |
|
Status: | Closed |
Project: | ZABBIX FEATURE REQUESTS |
Component/s: | Agent (G), Frontend (F), Java gateway (J), Server (S) |
Affects Version/s: | 2.0.0 |
Fix Version/s: | 3.4.0alpha1, 3.4 (plan) |
Type: | New Feature Request | Priority: | Minor |
Reporter: | Igor Urazov | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 30 |
Labels: | jmx, lld, patch | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Attachments: | JMXItemChecker-3.0.4.java Zabbix-adoptation-3.0.4.txt filter.patch jmx.discovery.filter.patch zbxnext-1223.png | ||||||||||||||||
Issue Links: |
|
||||||||||||||||
Team: | Team C | ||||||||||||||||
Team: | Team C | ||||||||||||||||
Sprint: | Sprint 11, Sprint 12 | ||||||||||||||||
Story Points: | 1 |
Description |
It would be very nice to be able to perform discovery of JVM garbage collectors and memory pools via JMX. Something like: jmx["java.lang:type=GarbageCollector,name={#GCNAME}","CollectionCount"] and jmx["java.lang:type=MemoryPool,name={#MPNAME}","Usage.used"] |
Comments |
Comment by Semyon Koshechkin [ 2012 Nov 22 ] |
It would be nice to autodiscover new ActiveMQ topics and queues via JMX |
Comment by Semyon Koshechkin [ 2012 Nov 23 ] |
Actually, there is a jmx lld in zabbix java gateway source code. file: JMXItemChecker.java i'll try it later |
Comment by Ryan Rupp [ 2013 Mar 07 ] |
Sorry, I had missed this Jira and actually created a duplicate here - |
Comment by Lee Lists [ 2013 May 24 ] |
Hi, Could someone post a template using this feature ? Thanks, |
Comment by Semyon Koshechkin [ 2013 Aug 22 ] |
Code proposal for parameterized jmx.discovery: Example usage: |
Comment by Semyon Koshechkin [ 2013 Aug 27 ] |
Zabbix template using parameterized LLD: |
Comment by Linus Brimstedt [ 2013 Sep 30 ] |
I have this patch in production and it works well! |
Comment by Asbjorn Kjaer [ 2014 Jan 09 ] |
I wrote a small patch that would enable filtered JMX discovery as well, but unlike the previous patch, this does not change the functionality of the existing jmx.discovery key, but instead adds a new key, jmx.discovery.filter. The output is also slightly different than what you get from jmx.discovery. This patch will let you search for specific beans instead of attributes. The example output below shows the output from a HornetQ request. Request { "request": "java gateway jmx", "conn": "10.x.x.x", "port": 9000, "keys": [ "jmx.discovery.filter[\"org.hornetq:module=JMS,type=Queue,name=*\"]" ] } Result { "{#PROPTYPE}":"Queue", "{#PROPNAME}":"\"DLQ\"", "{#PROPMODULE}":"JMS", "{#JMXDESC}":"Information on the management interface of the MBean", "{#JMXOBJ}":"org.hornetq:module=JMS,name=\"DLQ\",type=Queue" } The main reason I found for changing the output, was because the attribute information fields didnt make much sense when you are searching for beans instead. EDIT: I realized that the previous patch was too specific to HornetQ and the way some of the MBean Properties are exposed, so a more generic version can be found at https://github.com/bunjiboys/random/blob/master/filter.patch. Instead of hardcoding certain property names, it will now return {#JMXOBJ}, {#JMXDESC} as before, and then iterate and expose as {#PROP<UPPERCASE-PROPERTY-NAME>}, for example {#PROPNAME}. This lets you use any arbitrary property exposed by the MBean. |
Comment by Asbjorn Kjaer [ 2014 Feb 14 ] |
We have just released a standalone version of the patch about, that can be used with the external scripts functionality, to discover JMX items as well. You can find the source code at https://github.com/RiotGamesMinions/zabbix_jmxdiscovery To build the jar, you can either compile the code manually using javac but we have also provided an ant build file. To build using ant, you simple need to run ant in the root folder of the git repo, and it will create a JAR file in the dist/ folder. |
Comment by Asbjorn Kjaer [ 2014 Mar 01 ] |
Updated jmx.discovery.filter patch, that is less general than the previous version |
Comment by Andrew [ 2015 Jan 09 ] |
Sorry guys, but can you hepl me with Semen's template?.. zabbix_java.log says: 2015-01-09 03:15:25.030 [pool-1-thread-5] DEBUG com.zabbix.gateway.SocketProcessor - starting to process incoming connection 2015-01-09 03:15:25.031 [pool-1-thread-5] DEBUG c.z.gateway.BinaryProtocolSpeaker - reading Zabbix protocol header 2015-01-09 03:15:25.031 [pool-1-thread-5] DEBUG c.z.gateway.BinaryProtocolSpeaker - reading 8 bytes of data length 2015-01-09 03:15:25.031 [pool-1-thread-5] DEBUG c.z.gateway.BinaryProtocolSpeaker - reading 264 bytes of request data 2015-01-09 03:15:25.031 [pool-1-thread-5] DEBUG c.z.gateway.BinaryProtocolSpeaker - received the following data in request: {"request":"java gateway jmx","conn":"10.2.41.21","port":9012,"username":"user","password":"pswd","keys":["jmx.discovery[\"org.apache.activemq:BrokerName=*,Type=*,Destination=*\",Name]","jmx.discovery[\"org.apache.activemq:BrokerName=*,Type=Broker\",BrokerName]"]} 2015-01-09 03:15:25.032 [pool-1-thread-5] DEBUG com.zabbix.gateway.SocketProcessor - dispatched request to class com.zabbix.gateway.JMXItemChecker 2015-01-09 03:15:25.032 [pool-1-thread-5] DEBUG com.zabbix.gateway.JMXItemChecker - connecting to JMX agent at service:jmx:rmi:///jndi/rmi://10.2.41.21:9012/jmxrmi 2015-01-09 03:15:25.049 [pool-1-thread-5] DEBUG com.zabbix.gateway.ItemChecker - getting value for item 'jmx.discovery["org.apache.activemq:BrokerName=*,Type=*,Destination=*",Name]' 2015-01-09 03:15:25.054 [pool-1-thread-5] DEBUG com.zabbix.gateway.ItemChecker - received value '{ "data": [] }' for item 'jmx.discovery["org.apache.activemq:BrokerName=*,Type=*,Destination=*",Name]' 2015-01-09 03:15:25.054 [pool-1-thread-5] DEBUG com.zabbix.gateway.ItemChecker - getting value for item 'jmx.discovery["org.apache.activemq:BrokerName=*,Type=Broker",BrokerName]' 2015-01-09 03:15:25.055 [pool-1-thread-5] DEBUG com.zabbix.gateway.ItemChecker - received value '{ "data": [] }' for item 'jmx.discovery["org.apache.activemq:BrokerName=*,Type=Broker",BrokerName]' 2015-01-09 03:15:25.056 [pool-1-thread-5] DEBUG c.z.gateway.BinaryProtocolSpeaker - sending the following data in response: {"response":"success","data":[{"value":"{\n \"data\": []\n}"},{"value":"{\n \"data\": []\n}"}]} 2015-01-09 03:15:25.056 [pool-1-thread-5] DEBUG com.zabbix.gateway.SocketProcessor - finished processing incoming connection. so it looks like returned json array is empty... thank you. |
Comment by Shijirbaatar Khadbaatar [ 2015 Mar 04 ] |
Hello Dears, |
Comment by richlv [ 2016 Oct 17 ] |
also see the variation of path/context that would be useful to handle in JMX LLD |
Comment by Astapkovich Viacheslav [ 2016 Dec 26 ] |
There are many variations of JMX discovery patch: Are there plans for an official decision? Also, suggest our addoptation for other, who decided to use it for 3.0.4: |
Comment by Augugliaro [ 2017 Jun 08 ] |
Hi, I'm trying to use Asbjorn's external script jmx_discovery (https://github.com/RiotGamesMinions/zabbix_jmxdiscovery) and I've some troubles with the JSON interpretation by Zabbix. "{#PROPID}":"\"jmx_agent_name\"", Then Zabbix refuse to recognize the JSON format. By the way, im forced to keep the double quote to create my jmx item, calling the exact name of the object. Thanks, |
Comment by Vladislavs Sokurenko [ 2017 Jun 08 ] |
Could it be something that has been implemented in glebs.ivanovskis No, it's a different story. |
Comment by Glebs Ivanovskis (Inactive) [ 2017 Jun 08 ] |
Dear Gugli, quote after jmx_agent_name is not escaped. |
Comment by Augugliaro [ 2017 Jun 08 ] |
@Gelbs, I made a mistake on my example, I just edited it : char is well escaped on my JSON discovery return. Unfortunately I'm working on a +25k objects in Zabbix infra, so I cant patch or update Zabbix like I wish. I hope I'll find some light workaround. |
Comment by Augugliaro [ 2017 Jun 09 ] |
As I thought, your documentation is for Zabbix 3.4 and I cant upgrade atm because of the |
Comment by Glebs Ivanovskis (Inactive) [ 2017 Jun 09 ] |
Dear Gugli, 2.2.6 is pretty old. Try minor upgrade to one of the latest 2.2.x. |
Comment by Augugliaro [ 2017 Jun 27 ] |
Hi, Thanks you all for your interest. |
Comment by Rostislav Palivoda [ 2017 Jul 10 ] |
Available in 3.4.0alpha1 r69863. |