Discussion:
[jruby-user] jconsole mbeans connection
Sen Kie
2014-06-06 18:46:05 UTC
Permalink
Hello

I am trying to use jruby to connect to the jconsole's Mbeans to get
counter values in the output.
I installed jmx4r gems for that purpose.

so this is what I am doing: as follows "-

jirb
(takes me to the jruby interactive console on linux)
mp = JMX::MBean.find_all_by_name "Process:name=MyProcessStatistics",
:host => "localhost", :port => 3001

Ideally, this command should display all the functions inside the
process, so that I can use 'put' to display the counter values....for
instance. it should give something like below

"total_files_dispatched"=>"TotalFilesDispatched"

but it actually just returns => [#<JMX::MBean:0x4178feba>]
Not sure what that means.. Can someone please help?
--
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Thomas E Enebo
2014-06-06 19:20:37 UTC
Permalink
You are getting back all by that name so you have an array of results.

The result itself is a class in jmx4r which uses method_missing magic. I
am guessing you need to call something on it to get individual values. you
want like a = find_all_by_name(...); a[0].TotalFilesDispatched.

-Tom
Post by Sen Kie
Hello
I am trying to use jruby to connect to the jconsole's Mbeans to get
counter values in the output.
I installed jmx4r gems for that purpose.
so this is what I am doing: as follows "-
jirb
(takes me to the jruby interactive console on linux)
mp = JMX::MBean.find_all_by_name "Process:name=MyProcessStatistics",
:host => "localhost", :port => 3001
Ideally, this command should display all the functions inside the
process, so that I can use 'put' to display the counter values....for
instance. it should give something like below
"total_files_dispatched"=>"TotalFilesDispatched"
but it actually just returns => [#<JMX::MBean:0x4178feba>]
Not sure what that means.. Can someone please help?
--
Posted via http://www.ruby-forum.com/.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
--
blog: http://blog.enebo.com twitter: tom_enebo
mail: ***@gmail.com
Loading...