Specifying *all* MBeans

172 views
Skip to first unread message

Conor Beverland

unread,
Apr 1, 2015, 9:38:44 PM4/1/15
to jmxt...@googlegroups.com
Hi,

Is there any way to configure jmxtrans with a query that would simply pull back all available MBeans and all their attributes so that I could browse everything in the jmxtrans output in a similar way to how JConsole will let you explore the full JMX hierarchy? My real use case is that I want all the numeric values to feed into graphite.

I've already seen that if you don't supply the "attr" property it will return all of them but it doesn't look the same thing is the case if you don't supply the "obj" parameter.

I'm not very familiar with JMX Object names (or even JMX in general) but I've tried some things like:

"obj" : "*"
"obj" : "*:type=*"
"obj" : "*:type=name=*"

to no avail. 

Is this possible?

Many Thanks,
Conor

Jon Stevens

unread,
Apr 1, 2015, 9:58:03 PM4/1/15
to jmxt...@googlegroups.com
Have you tried "obj": null or "obj": ""?

I believe the value is passed right through to MBeanServerConnection.queryNames()

Note, I haven't tried this before, this could be a pretty expensive operation.

jon
> --
> You received this message because you are subscribed to the Google Groups "jmxtrans" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jmxtrans+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Conor Beverland

unread,
Apr 3, 2015, 9:36:19 PM4/3/15
to jmxt...@googlegroups.com
Hi Jon,

Thanks for your help. I understand that this is not a typical use case and that it could be an expensive query. 

I'm using jmxtrans_20121016-175251-ab6cfd36e3-1_all.deb

"obj": "" partially works

I am using GraphiteWriter with a file that looks like this:

{
  "servers" : [ {
    "port" : "1105",
    "host" : "localhost",
    "queries" : [ {
      "obj" : "\"push.2879\":name=\"duration\",type=\"\"",
      "outputWriters" : [ {
        "@class" : "com.googlecode.jmxtrans.model.output.GraphiteWriter",
        "settings" : {
          "port" : 10000,
          "host" : "localhost",
          "rootPrefix" : "jmx",
          "typeNames" : ["name"]
        }
      } ]
    } ]
}]}

If I look in jmxtrans.log then I can see lines like: DEBUG (com.googlecode.jmxtrans.util.JmxUtils:195) - Executing queryName: XXXXXX
for all of the MBeans so it looks like your expectation was correct in how the empty string would be passed in and jmxtrans does appear to be seeing all the data.

However if I look at the graphite output it appeared to just contain a single MBean's output.

I next tried parsing jmxtrans.log, pulling out all the obj names like: "java.lang:name=PS Eden Space,type=MemoryPool" and putting them:

1. within separate queries in a single JSON
2. as separate files in /var/lib/json (same server host and port in each file but different single queries)

In these cases the output still looks like it's just a single MBean, but, if I stop jmxtrans then suddenly the others flow across as if GraphiteWriter was queueing them up somehow.

Any ideas on things I could try to change to get all the different values to "flush" through correctly? 

Thanks!
Conor

Just to make it clearer, in case number 2 I end up with multiple files that look something like the below but each with different obj specifications. This is the method that is getting me closest so far but much of the data only comes over port 10000 as jmxtrans is stopping:

{
  "servers" : [ {
    "port" : "1105",
    "host" : "foo",
    "alias" : "foo",
    "queries" : [ {
      "obj" : "java.lang:type=Memory",
      "outputWriters" : [ {
        "@class" : "com.googlecode.jmxtrans.model.output.GraphiteWriter",
        "settings" : {
          "port" : 10000,
          "host" : "localhost",
          "rootPrefix" : "jmx",
          "typeNames" : ["name"]
        }
      } ]
    } ]
}]}

Conor Beverland

unread,
Apr 6, 2015, 5:08:21 PM4/6/15
to jmxt...@googlegroups.com
I tried again with the latest .deb which I found here with much better results. (I see this link has been updated in README.md since I first tried this as well :-) ).

The only remaining issue I have is that when trying to generically pull back "all" MBeans I'm not in a position to be able to hardcode resultAlias for each of them and so run into very similar issues to this:  https://groups.google.com/forum/#!topic/jmxtrans/Exhb4BEul-M

Is it possible to specify the "domain" of the ObjectName, i.e. the piece before : as the key to be used rather than the ClassName ?

Many thanks,
Conor

Guillaume Lederrey

unread,
Apr 6, 2015, 5:18:28 PM4/6/15
to jmxt...@googlegroups.com
I've not had this use case yet ... so I would need to dig a bit in the code to find the answer. You probably have a chance to get something working with JexlNamingStrategy.

Not much time right now, but I'll try to look into this during the week.

Good luck !
--
mobile : +41 76 573 32 40
skype : Guillaume.Lederrey

projects :
* http://rwanda.ledcom.ch/
* http://trock.ch/
others :
* http://kiva.org/

Conor Beverland

unread,
Apr 6, 2015, 10:38:09 PM4/6/15
to jmxt...@googlegroups.com
Thanks, I haven't looked at the source at all until this point. I see that the current GraphiteWriter class does not use JexlNamingStrategy at all so are you suggesting my best bet may be to extend the existing GraphiteWriter and add that support?

Guillaume Lederrey

unread,
Apr 7, 2015, 2:56:45 AM4/7/15
to jmxt...@googlegroups.com
We should move this one level higher and make sure all OutputWriters use the same naming mechanism. So that's probably something that needs to go in BaseOutputWriter. I need to dig a bit more into it. If you have a clear view of what needs to be done, please send a pull request, even if only for GraphiteWriter. Or open an issue (https://github.com/jmxtrans/jmxtrans/issues) that's really something that needs to be fixed.

Jon Stevens

unread,
Apr 7, 2015, 3:18:16 AM4/7/15
to jmxt...@googlegroups.com
Agreed. When I wrote the first few I didn't have a good idea of how things should work. This should definitely get refactored.

Jon

Guillaume Lederrey

unread,
Apr 9, 2015, 2:08:54 PM4/9/15
to jmxt...@googlegroups.com
Hello !

I had time to dig a bit into this and it seems that it is going to take more time to implement then I have available right now. As this seems to be a not so frequent use case, I'm going to put it on hold on my side.

If you think this feature is important, could you open an issue (https://github.com/jmxtrans/jmxtrans/issues) ? Or send a patch ?

Thanks !

Conor Beverland

unread,
Apr 9, 2015, 7:14:25 PM4/9/15
to jmxt...@googlegroups.com
I understand the timing issue! I just sent you a pull request. It's working well for me and I think it's a useful option even when you aren't interested in pulling back multiple MBeans. For instance I think this makes JMXTrans more user friendly for yammer metrics.

Conor
Reply all
Reply to author
Forward
0 new messages