# JMX input filter, howto construct right query

**URL:** https://discuss.elastic.co/t/jmx-input-filter-howto-construct-right-query/36929
**Category:** Logstash
**Created:** [December 10, 2015, 11:31pm UTC](https://discuss.elastic.co/t/jmx-input-filter-howto-construct-right-query/36929 "2015-12-10T23:31:42Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![stefws](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stefws/32/6442_2.png) [@stefws](https://discuss.elastic.co/u/stefws)
#### Post date: [December 10, 2015, 11:31pm UTC](https://discuss.elastic.co/t/jmx-input-filter-howto-construct-right-query/36929/1 "2015-12-10T23:31:42Z")

</div>

So I've got a jconsole on a cassandra 2.0 cluster and can see metrics like o.a.c.m.ThreadPools.request.RequestResponseStage.\*Tasks

[cassandra wiki](http://wiki.apache.org/cassandra/Metrics#threadpool) says (note ThreadPool in singular):

> o.a.c.m:type=ThreadPool,path=(type),scope=(Thread pool name),name=(Metric name)  
> where:  
> (path) is either internal or request, based on the usage of thread pool  
> (scope) is (path).(Thread pool name)  
> (name) is one of the five Tasks, ie. ActiveTasks...

But how should I read this to configure my jmx input query's json to fetch such metric, below doesn't work:

> {  
> "object\_name" : "org.apache.cassandra.metrics:type=ThreadPools,path=request,scope=RequestResponseStage,name=\*",  
> "attributes" : ["ActiveTasks", "CompletedTasks", "CurrentlyBlockedTasks", "PendingTasks", "TotalBlockedTasks"],  
> "object\_alias" : "${type}.${path}.${scope}.${name}"  
> }

It returns this warning:

> undefined method `active\_tasks' for #JMX::MBean:0x553f7ee2 {:level=\>:warn}  
> Failed retrieving metrics for attribute ActiveTasks on object org.apache.cassandra.metrics:type=ThreadPools,path=request,scope=RequestResponseStage,name=ActiveTasks {:level=\>:warn}

Though one would believe this to be correct when [looking at the jconsole](https://dl.dropboxusercontent.com/u/13225502/jmx_input_question.tiff)

Other metric fetches fine, and return events as expected like:

> {  
> "@version" =\> "1",  
> "@timestamp" =\> "2015-12-10T23:19:20.791Z",  
> "host" =\> "d1r1n1",  
> "type" =\> "jmx",  
> "metric\_path" =\> "blob.BufferPool.direct.ObjectName",  
> "metric\_value\_string" =\> "java.nio:type=BufferPool,name=direct",  
> "@metadata" =\> {  
> "esindex" =\> "cass",  
> "output-stdout" =\> "true"  
> }  
> }

Hints much appreciated, TIA!

---

<div class="post-metadata">

### Author: ![stefws](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stefws/32/6442_2.png) [@stefws](https://discuss.elastic.co/u/stefws)
#### Post date: [December 11, 2015, 1:08pm UTC](https://discuss.elastic.co/t/jmx-input-filter-howto-construct-right-query/36929/2 "2015-12-11T13:08:28Z")

</div>

Connected a Console and browsed the MBeans and found that this works:

> {  
> "object\_name" : "org.apache.cassandra.metrics:type=ThreadPools,path=request,scope=RequestResponseStage,name=\*",  
> "object\_alias" : "${type}.${path}.${scope}.${name}"  
> }

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 5:18am UTC](https://discuss.elastic.co/t/jmx-input-filter-howto-construct-right-query/36929/3 "2017-07-06T05:18:53Z")

</div>


