Skip to main content

JMX Reader

Reads data from Java virtual machines running Java applications that support Java Management Extensions (JMX).

JMX Reader properties

property

type

default value

notes

Connection Retry Policy

String

retryInterval=30, maxRetries=3

With the default setting, if a connection attempt is unsuccessful, the adapter will try again in 30 seconds (retryInterval. If the second attempt is unsuccessful, in 30 seconds it will try a third time (maxRetries). If that is unsuccessful, the adapter will fail and log an exception. Negative values are not supported.

Poll Interval

Double

 

how often JMXReader will poll the JVM(s), in seconds 

Service URL

String

a URL specifying how to connect to the JVM(s); you may specify multiple URLs separated by commas

The output type is JSONNodeEvent.

If multiple JVMs are specified in serviceurl and the application is deployed on multiple servers, the JVMs will automatically be distributed among the servers.

JMX Reader example

The following application will write Kafka broker operational metrics to a WActionStore:

CREATE SOURCE JmxSrc USING JmxReader (
  serviceurl:"service:jmx:rmi:///jndi/rmi://localhost:9998/jmxrmi",
  pollinterval:"1"
) 
OUTPUT TO jmxstream;

CREATE TYPE MBeanType (
  time datetime,
  objectname string,
  attributes com.fasterxml.jackson.databind.JsonNode
);
CREATE STREAM MetricStream OF MBeanType;

CREATE CQ getMetric
INSERT INTO MetricStream
SELECT DNOW(),
  data.get("ObjectName").textValue(),
  data.get("Attributes")
FROM jmxstream;

CREATE TYPE MetricType (
  objectname string,
  time datetime,
  metricname string,
  metrictype string,
  metricval string
);
CREATE WACTIONSTORE MetricStore CONTEXT OF MetricType;

CREATE CQ getAttr
INSERT INTO MetricStore
SELECT ms.objectname,
  ms.time, 
  attritr.get(0).textValue(),
  attritr.get(1).textValue(),
  attritr.get(2).textValue()
FROM MetricStream ms, iterator(ms.attributes) attritr;

The query SELECT * FROM MetricStore; will return events similar to:

[
   objectname = kafka.network:type=RequestMetrics,name=LocalTimeMs,request=Offsets
   time = 2018-06-05T09:01:00.087-07:00
   metricname = 50thPercentile
   metrictype = double
   metricval = 0.0
]