Skip to main content

Add MBean's to Admin Console

6 replies [Last post]
77777777777
Offline
Joined: 2009-05-08

Hi,

I'm using glassfish 2.1 and I have some questions that I hope you can help me out with,

1) I'd like to be able to monitor all or at least a specific OpenMQ queue from within the Admin Console. Using JConsole I can easily browse to com.sun.messaging.jms.server->Destination->Monitor->q->"my queue" for example and see all statistics. The broker is started automatically when I start the Glassfish domain.
2) Is it possible to deploy and instantiate a custom MBean to the Admin Console that has no default constructor?
3) Is it possible to automatically register a MBean (preferably using Spring) when you deploy an application (such as a web-application) so that it becomes visible in the Admin console? We have a spring-based web-app and it registers a custom MBean when it's loaded. From JConsole you get all the details from the MBean but we'd like to be able to see it from the Admin Console as well (without manually having the deploy it).

Thanks

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
km
Offline
Joined: 2005-10-28

Good questions (and interesting java.net ID) :)

> 1) I'd like to be able to monitor all or at least a
> specific OpenMQ queue from within the Admin Console.

Making Admin Console act like an MBean Browser is a long standing request. IMO, that's an
RFE that should be addressed.

> Using JConsole I can easily browse to
> com.sun.messaging.jms.server->Destination->Monitor->q-
> >"my queue" for example and see all statistics. The
> broker is started automatically when I start the
> Glassfish domain.
> 2) Is it possible to deploy and instantiate a custom
> MBean to the Admin Console that has no default
> constructor?

No, not possible. See: http://wiki.glassfish.java.net/attach/GlassFishAdminReferences/custom-mb... for details. Are you impaired by this requirement?

> 3) Is it possible to automatically register a MBean
> (preferably using Spring) when you deploy an
> application (such as a web-application) so that it
> becomes visible in the Admin console? We have a
> spring-based web-app and it registers a custom MBean
> when it's loaded. From JConsole you get all the
> details from the MBean but we'd like to be able to
> see it from the Admin Console as well (without
> manually having the deploy it).

This goes back to 1. Time for doing this in v3.

-Kedar

77777777777
Offline
Joined: 2009-05-08

Thanks for your answers.

1 & 3) Are you saying that it's likely that v3 will be able to act as a MBean browser? (because as I understand it's not possible today in v3 either?) I think it would be an excellent feature.

2) Since you cannot use GF 2.1 as an MBean Browser then no. The reason why I wanted to do this was because in JConsole I found and MBean that displayed lots of useful information on a queue that I wanted to monitor from inside the admin console. This MBean didn't have a default constructor so I couldn't initialize it from the GF Admin Console Deploy Custom MBean.

I have a follow-up question. The customer I'm working for wants this kind of monitoring in the GF Admin Console (i.e. be able to monitor the MBean that exposes details about the queue). Is the best way forward to create a custom/modified admingui war?

Thanks again.

km
Offline
Joined: 2005-10-28

> Thanks for your answers.
>
> 1 & 3) Are you saying that it's likely that v3 will
> be able to act as a MBean browser? (because as I
> understand it's not possible today in v3 either?) I
> think it would be an excellent feature.

Of course. Since v3 GUI is extensible, anyone can develop a plugin to
it. Community help is welcome ;).

> 2) Since you cannot use GF 2.1 as an MBean Browser
> then no. The reason why I wanted to do this was
> because in JConsole I found and MBean that displayed
> lots of useful information on a queue that I wanted
> to monitor from inside the admin console. This MBean
> didn't have a default constructor so I couldn't
> initialize it from the GF Admin Console Deploy Custom
> MBean.

Hmm. But the idea behind custom MBeans (which, are BTW, available on Console) is that
you impart the "persistence" of their state/attributes via administering them.
Check the design document I pointed you to.

>
> I have a follow-up question. The customer I'm working
> for wants this kind of monitoring in the GF Admin
> Console (i.e. be able to monitor the MBean that
> exposes details about the queue). Is the best way
> forward to create a custom/modified admingui war?

Well, that's not supported. You can try it out, but then you are on your own.
What are the exact requirements of the customer?

-Kedar

> Thanks again.

77777777777
Offline
Joined: 2009-05-08

The requirement is that it should be possible monitor resources such as a JMS queue (i.e. be able to see how many messages that have been delivered to the queue etc) as well as monitoring custom "resources"/beans from within the application server (for example how many messages has JMS consumer X consumed from queue Y) So an MBean browsing capability seems perfect to me in this case. Or do you have any other suggestions on how this could be done? Perhaps it would be sufficient to do the monitoring using VisualVM or JConsole for now if this feature will be available in the future. For curiosity, do you know if this is possible out of the box with any other open source application server?

Martin Gainty

What a great Question!

you can use create your JMXBean with createMBean method from javax.management.MBeanServer
http://java.sun.com/j2se/1.5.0/docs/api/javax/management/MBeanServer.html#createMBean(java.lang.String,%20javax.management.ObjectName)

spring accomplishes this thru the org.springframework.jmx.export.annotation.* package specifically
1a)identifying each JMXBean thru ObjectName with
org.springframework.jmx.export.annotation.ManagedResource
1b)identifiying each advertised attribute of the JMXBean with
@ManagedAttribute
1c)identifying each advertised method of JMXBean with
@ManagedOperationParameter

2)once the JMXBean has been created register the JMXBean with JMXServer and add persistence
by extending the import org.springframework.jmx.export.MBeanExporter;

http://www.jroller.com/bogie14/entry/did_java_5_forget_jmx

HTH
Martin Gainty
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.

> Date: Thu, 6 Aug 2009 04:30:02 -0700
> From: glassfish@javadesktop.org
> To: users@glassfish.dev.java.net
> Subject: Add MBean's to Admin Console
>
> Hi,
>
> I'm using glassfish 2.1 and I have some questions that I hope you can help me out with,
>
> 1) I'd like to be able to monitor all or at least a specific OpenMQ queue from within the Admin Console. Using JConsole I can easily browse to com.sun.messaging.jms.server->Destination->Monitor->q->"my queue" for example and see all statistics. The broker is started automatically when I start the Glassfish domain.
> 2) Is it possible to deploy and instantiate a custom MBean to the Admin Console that has no default constructor?
> 3) Is it possible to automatically register a MBean (preferably using Spring) when you deploy an application (such as a web-application) so that it becomes visible in the Admin console? We have a spring-based web-app and it registers a custom MBean when it's loaded. From JConsole you get all the details from the MBean but we'd like to be able to see it from the Admin Console as well (without manually having the deploy it).
>
> Thanks
> [Message sent by forum member '77777777777' (77777777777)]
>
> http://forums.java.net/jive/thread.jspa?messageID=359191
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>

_________________________________________________________________
Express your personality in color! Preview and select themes for Hotmail®.
http://www.windowslive-hotmail.com/LearnMore/personalize.aspx?ocid=PID23...
[att1.html]

77777777777
Offline
Joined: 2009-05-08

Hi,

Thanks for your answer. The problem is not creating or exposing the actual MBean because that all works. Whenever I deploy our webapp a MBean is automatically exposed and I can view all attributes etc from JConsole. The problem is that I'd like to expose this MBean to the Glassfish Admin Console (GUI) so that I can see the attributes of the MBean inside the Admin Console GUI in Glassfish.