Cool... txk! :)

I was playing a little bit here. If you want to see the attributes values,
execute...

//***********************************************************
import java.lang.management.ManagementFactory

def server = ManagementFactory.getPlatformMBeanServer()
def beans = server.queryMBeans(null, null)
println("We have ${(beans ? beans.size() : 0)} bean(s)")

def getValue = { bean, attr ->
  try {
  return server.getAttribute(bean.objectName, attr.name)
  } catch (ignore) {
  return 'NA'
  }
}

def printAttributes = { bean ->
  def info = server.getMBeanInfo(bean.objectName)
  info?.getAttributes()?.each {
    println("    '${it.name}' = ${getValue(bean, it)}")
  }
}

beans?.each { bean ->
  println()
  println("Bean '${bean.objectName}'")
  println("  class: ${bean.className}")
  printAttributes(bean)
}
//***********************************************************

https://dl.dropboxusercontent.com/u/1459144/tomee-list/mbeans_2.png

Sometimes a scripting language like Groovy can be very handy. :)

[]s,
Thiago.



On Thu, Nov 7, 2013 at 9:41 AM, Howard W. Smith, Jr. <[email protected]
> wrote:

> +1 Thiago and Romain, good stuff!
>
>
>
> On Thu, Nov 7, 2013 at 9:21 AM, Romain Manni-Bucau <[email protected]
> >wrote:
>
> > Hehe, the code is in sirona. You have the JMX local tree + you can see
> > attributes and invoke basic operations. here is the server part
> >
> >
> https://svn.apache.org/repos/asf/incubator/sirona/trunk/server/reporting/src/main/java/org/apache/sirona/reporting/web/plugin/jmx/JMXEndpoints.java
> > . Views are
> >
> https://svn.apache.org/repos/asf/incubator/sirona/trunk/server/reporting/src/main/resources/templates/jmx/
> > Romain Manni-Bucau
> > Twitter: @rmannibucau
> > Blog: http://rmannibucau.wordpress.com/
> > LinkedIn: http://fr.linkedin.com/in/rmannibucau
> > Github: https://github.com/rmannibucau
> >
> >
> >
> > 2013/11/7 Thiago Veronezi <[email protected]>:
> > > Out of curiosity, you can use the webaccess* to see some of that stuff
> > via
> > > jmx.
> > > You just need to open the console and execute...
> > >
> > > // Groovy code
> > > // ********************************************************************
> > > import java.lang.management.ManagementFactory
> > >
> > > def server = ManagementFactory.getPlatformMBeanServer()
> > > def beans = server.queryMBeans(null, null)
> > > println("We have ${(beans ? beans.size() : 0)} bean(s)")
> > >
> > > beans?.each { bean ->
> > >   println()
> > >   println("---------------------------------------------")
> > >   println("  ${bean.objectName}: ${bean.className}")
> > > }
> > > // ********************************************************************
> > >
> > > https://dl.dropboxusercontent.com/u/1459144/tomee-list/mbeans.png
> > >
> > > ... or you can simply use jconsole.
> > >
> > > It would be nice to have a tree with all the mbeans... hmmm maybe we
> will
> > > have it. :)
> > >
> > > []s,
> > > Thiago.
> > >
> > > webaccess*: oh boy... I still didn't rename it!
> > >
> > >
> > >
> > > On Thu, Nov 7, 2013 at 7:44 AM, Howard W. Smith, Jr. <
> > [email protected]
> > >> wrote:
> > >
> > >> +1 Romain, thanks.
> > >>
> > >> On Thu, Nov 7, 2013 at 7:30 AM, Romain Manni-Bucau <
> > [email protected]
> > >> >wrote:
> > >>
> > >> > well, before working on [monitoring] and launching sirona I
> evaluated
> > >> > hawtio. It is really nice but has big drawbacks which are blocking
> to
> > >> > be usable for me (I don't say it is a bad solution, just it doesn't
> > >> > fit my needs):
> > >> >
> > >>
> > >> does not fit my needs, too
> > >>
> > >>
> > >> > 1) it is not Java (well the solutions are working but not entreprise
> > >> > friendly IMO, in particular for monitoring where you don't want to
> > >> > loose time learning a techno)
> > >> >
> > >>
> > >> thanks! that says a lot!
> > >>
> > >>
> > >> > 2) it is JMX based (JMX is important but there are a lot of other
> > things)
> > >> > 3) when I tested I didn't find how to aggregate servers (maybe you
> can
> > >> now)
> > >> > 4) it is not *easily* pluggable (you can doing an overlay which is
> not
> > >> > a solution)
> > >> > 5) there is no real agents (it is mainly a JMX gui)
> > >> > 6) there is no counter for perfs
> > >> >
> > >> > surely few others...
> > >> >
> > >>
> >
>

Reply via email to