Groovy JMX Access
Last updated on 08 October, 2024Although for accessing JMX MBeans within a DataSource you can typically use our JMX collection mechanism, when you need to do complex processing of results from a JMX query, using Groovy to retrieve the JMX results can be much simpler.
A complete reference of LogicMonitor’s Groovy JMX methods can be found at the bottom of this page, but here’s a few examples to demonstrate how this feature works.
Example 1 – Retrieve the value of a MBean Attribute
Example 2 – Retrieve a list of values of a given MBean property
Example 3 – Create a JMX client using JMXMP
JMX Method Reference
Object Instatiation
JMX.open(url, [timeout]) – open a connection to remote jmx service without authentication
- @param string url – jmx url
- @param int timeout – connection timeout in milliseconds
- @return object connection – an jmx connection object for use with subsequent method calls
JMX.open(url, [userid], [passwd], [timeout]) – open a connection to remote jmx service with authentication
- @param string url – jmx url
- @param string userid – userid credential
- @param string passwd – password credential
- @param int timeout – connection timeout in milliseconds
- @return object connection – an jmx connection object for use with subsequent method calls
JMX.open(protocol, host, port, environmentMap, [timeout]) – open a connection to remote jmxmp or rmi service
- @param string protocol – jmx protocol
- @param string host – hostname on which to connect
- @param int port – port on which to connect
- @param map environmentMap – jmx environment map, which may contain credentials, remote profiles, TLS cipher suites, etc)
- @param int timeout – connection timeout in milliseconds
- @return object connection – an jmx connection object for use with subsequent method calls
Object Methods
getValue(jmxpath) – get the value of a jmx mbean
- @param string jmxpath – jmx mbean path
- @return string mbean – jmx mbean value
getChildren(jmxpath) – reads text from the connection until it finds a match in the provided regular expression
- @param string jmxpath – jmx node or property path
- @return array propertynames|nodes – names of child nodes or property names, depending on path