JMXAccessorGetTask: get attribute value Ant task

List of Attributes

Attribute Description Default value
name Full qualified JMX ObjectName — Catalina:type=Server
attribute Existing MBean attribute (see Tomcat MBean description above)
ref JMX Connection reference jmx.server
echo Echo command usage (access and result) false
resultproperty Save result at this project property
delimiter Split result with delimiter (java.util.StringTokenizier) and use resultproperty as prefix to store tokens.
separatearrayresults When return value is an array, save result as property list ($resultproperty.[0..N] and $resultproperty.length) true

Example to get remote MBean attribute from default JMX connection

<jmx:get

name=”Catalina:type=Manager,context=/servlets-examples,host=localhost”

attribute=”maxActiveSessions”

resultproperty=”servlets-examples.maxActiveSessions”

/>

 

Example to get and result array and split it at separate properties

 

<jmx:get

name=”Catalina:type=ClusterSender,host=localhost”

attribute=”senderObjectNames”

resultproperty=”senderObjectNames”

/>

Access the senderObjectNames properties with:

${senderObjectNames.length} give the number of returned sender list.

${senderObjectNames.[0..N]} found all sender object names

 

Example to get IDataSender attribute connected only when cluster is configured.

Note: The name attribute value was wrapped here to be more readable. It has to be all on the same line, without spaces.

 

<jmx:query

failonerror=”false”

name=”Catalina:type=Cluster,host=${tomcat.application.host}”

resultproperty=”cluster”

/>

<jmx:get

name=

“Catalina:type=IDataSender,host=${tomcat.application.host},

senderAddress=${cluster.backup.address},senderPort=${cluster.backup.port}”

attribute=”connected”

resultproperty=”datasender.connected”

if=”cluster.0.name” />

Share this post
[social_warfare]
JMXAccessorOpenTask – JMX open connection task
The Other Bits: Permissions, Groups, Messages, and Profiles

Get industry recognized certification – Contact us

keyboard_arrow_up