[ZBXNEXT-4558] Support of string value of custom JMX mbeans Created: 2018 May 17  Updated: 2024 Apr 10  Resolved: 2018 Jul 23

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: Java gateway (J)
Affects Version/s: 3.4.8
Fix Version/s: 4.0.0alpha9, 4.0 (plan)

Type: Change Request Priority: Major
Reporter: Tommi Palomäki Assignee: Arets Paeglis (Inactive)
Resolution: Fixed Votes: 1
Labels: javagateway, jmx
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Team: Team C
Sprint: Sprint 38
Story Points: 0.2

 Description   

Background

Zabbix v3.4 allows the usage of custom JMX endpoints and you can monitor eg. WebLogic by adding wlfullclient.jar to Java Gateway's classpath (see ZBXNEXT-1935). Currently however, custom WebLogic mbean classes are not supported and you cannot monitor such JMX values with Zabbix.

For example, item jmx["com.bea:ServerRuntime=nnn,Name=nnn,Location=nnn,Type=ApplicationRuntime",HealthState] produces the following error:

data object type is not primitive: class weblogic.health.HealthState

Most JMX consoles support arbitrary mbean classes by calling their toString() method, even though the mbean object is not defined in JMX standard (ie. it's not a primitive object type, TabularData or CompositeData).

Feature request

I suggest that Zabbix Java Gateway supports any mbean classes by calling their toString() method - if there is no field name defined in item definition.

Consequently, the string representation can be parsed in Zabbix server using preprocessing such as regular expression.

Code changes

In JMXItemChecker.java, function getPrimitiveAttributeValue().

Current code:

if (fieldNames.equals(""))
		{
			if (isPrimitiveAttributeType(dataObject.getClass()))
				return dataObject.toString();
			else
				throw new ZabbixException("data object type is not primitive: %s" + dataObject.getClass());
		}

Suggested change:

if (fieldNames.equals(""))
		{
			return dataObject.toString();
		}


 Comments   
Comment by patrik uytterhoeven [ 2018 Jul 18 ]

this would be great if it allowed us to read out hash maps with JMX LLD

Comment by Vjaceslavs Bogdanovs [ 2018 Jul 23 ]

Current development will only allow getting all data from HashMap as a string (not the individual values).

To get proper HashMap support Java gateway should process HashMaps like it is done with CompositeData objects, but it is out of scope of this ticket.

Comment by patrik uytterhoeven [ 2018 Jul 23 ]

ok thx

but if it comes as a string then it would be possible with pre processing to filter out the needed information from that string.

 

Comment by Arets Paeglis (Inactive) [ 2018 Aug 08 ]

Available in 4.0.0alpha9 r82925.

Generated at Fri Apr 26 03:09:12 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.