Monitoring Weblogic using JMX in SiteScope

28 February, 2008 – 2:45 pm

Using JMX (Java Management Extensions) it is possible to monitor Managed Beans published by MBean servers. Weblogic (WL) provides MBeans for both admin and managed servers.

You can find out more info about WebLogic MBeans and accessing them with JMX here

Following are some augmented instructions for setting up JMX monitors within SiteScope. I used this excellent article as a starting point.

Types
There are two types of MBeans which we’re interested in namely:

1. Configuration MBeans, which expose attributes and operations
for configuring WebLogic Server resources.
2. Runtime MBeans, which provide information about the runtime state of its resources.

In terms of performance monitoring we’re more interested in the latter, but from an overall system level monitoring point of view, sysadmins may also be interested in static config MBeans.

In reality there are 1,000’s of runtime MBeans available for WebLogic and navigating/finding the correct bean inside SiteScope can be difficult due to it’s clunky web interface …

As a starting point refer to the MBean reference previously mentioned to get an overview of runtime beans available. In this case I’m interested in the JMSRuntime bean …

Using the WL Scripting Tool
If you are working on the WL server you can use the WL Scripting Tool to browse the available Runtime beans:
D:\Data\bea\wlserver_10.0\server\bin>setWLSEnv.cmd
D:\Data\bea\wlserver_10.0\server\bin>java weblogic.WLST
connect('username','password','t3://host:8003')
serverRuntime()
ls()
cd("JMSRuntime")
ls()
cd("server01_01.jms")
ls()
 
dr-\-   Connections
dr-\-   JMSServers
 
-r-\-   ConnectionsCurrentCount                      14
-r-\-   ConnectionsHighCount                         14
-r-\-   ConnectionsTotalCount                        18
-r-\-   HealthState                                  State:HEALTH_OK,ReasonCode:\[\]
-r-\-   JMSServersCurrentCount                       2
-r-\-   JMSServersHighCount                          2
-r-\-   JMSServersTotalCount                         2
-r-\-   Name                                         server01_01.jms
-r-\-   Type                                         JMSRuntime

This will help identify the name of the MBean (in this case server01_01.jms) and the indicative path
to that MBean when using JConsole or SiteScope.

Setting up IIOP access on monitored machines
SiteScope relies on the IIOP protocol to talk to the WL server. In order to get remote access with JMX via IIOP you need to provide a default username and password for the IIOP user.

This can be done via the WL admin console as in:
domServiceBus->Environment->Servers->server01_nn->Protocols [tab]\->IIOP->advanced

Then provide a default username and password for the IIOP user.

Note: IIOP is already enabled by default, but a username and pwd is not. This change requires a server restart for WL. You must make sure that the username and password is >= 8 digits, otherwise the CORBA connection will fail when using SiteScope.

Testing connectivity from JConsole
Before setting up a SiteScope monitor it is worth using JConsole to familiarize yourself with the published MBeans.
Assuming you have the Java SDK installed, launch JConsole as per the following:
C:\Program Files\Java\jdk1.5.0_14\bin\jconsole.exe \-J-Dcom.sun.CORBA.transport.ORBTCPReadTimeouts=10:60000:500:10

Note: you must provide the additional read timeout arguments otherwise you will get a connection error like this:
Unable to retrieve counters: Error receiving browse data: java.rmi.MarshalException: CORBA COMM_FAILURE 1398079696 Maybe; nested exception is: org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 208 completed: Maybe

To connect to the target server, click on New Connection->advanced and provide the following details:
JMX URL: service:jmx:rmi:///jndi/iiop://hostname:8003/weblogic.management.mbeanservers.runtime
Username: <whatever you set for the IIOP user>
Password: <whatever you set for the IIOP user>

You will then get a tree-like broswer in which you can look at all available MBeans.

Setting up a SiteScope JMX monitor
Before setting up the monitor, make sure you change the following registry key for SiteScope to avoid the aforementioned timeout errors:
@="-server -Xmx256m -showversion -Dcom.sun.CORBA.transport.ORBTCPReadTimeouts=10:30000:500:10
-Dcatalina.home=\"D:\\SiteScope\\Tomcat\" -Dflipper.param.file=..\\conf\\flipperSiteScope.properties
-Dtopaz.home=.. -cp \"D:\\SiteScope\\Tomcat\\bin\\bootstrap.jar\" org.apache.catalina.startup.Bootstrap start"

Note the added parameter argument:
-Dcom.sun.CORBA.transport.ORBTCPReadTimeouts=10:30000:500:10

You will need to stop/start the SiteScope windows service for this change to take affect.

Now create a new JMX monitor:
Name: 8003 - Managed server
Frequency: 2 minutes
JMX URL: service:jmx:rmi:///jndi/iiop://host:8003/weblogic.management.mbeanservers.runtime
Domain filter:
Username: weblogic
Password: password

Then click Get Counters …

If you used the WLST you’d now know what path the MBean exists on. In this case:
com.bea/server01_01/server01_01.jms/JMSRuntime

And suggested counters to collect might be:
ConnectionsCurrentCount
ConnectionsHighCount
ConnectionsTotalCount
JMSServersCurrentCount
JMSServersHighCount
JMSServersTotalCount

Now you will be able to use SiteScope as the central repository for collecting metrics (long term monitoring). When running a load test scenario, you will be able to poll these same metrics using the SiteScope monitor available to the Controller.

Share it: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Netscape
  • Reddit
  • Slashdot
  • Technorati
  • YahooMyWeb
  1. 9 Responses to “Monitoring Weblogic using JMX in SiteScope”

  2. AMAZING! It worked fine in my environment! I spent 2 weeks with technicians to get it solved but nothing!

    By Mauricio on Apr 18, 2008

  3. Does increasing the timeout affect how long the SiteScope JMX monitor will be allowed to run once the counters are selected or does it only affect how long it will wait when retrieving the counters during initial setup?

    By Kevin Redding on Jun 11, 2008

  4. Changing the timeout affects how long it will wait in order to get the counters during the initial setup. Once the XML file that SiteScope builds for each targeted server has been made, the timeout does not appear to affect performance during ongoing collection.

    However, for real life scenarios on managed servers that have alot of JMX counters, SiteScope performs dismally. I have a good alternative posted here:
    http://90kts.com/blog/2008/monitoring-weblogic-92-with-jmx-and-jruby/

    using JRuby to do the raw collection, and if you search through my posts I also show how to provide SiteScope like functionality for LoadRunner…

    Regards,
    Tim Koopmans

    By Tim on Jun 12, 2008

  5. hi Tim,

    I am trying to set up weblogic application server version 9 monitor using sitescope 8.8 but I am getting this error:

    SiteScope can monitor these objects.

    ——————————————————————————–
    (Click the to expand, and the to collapse).
    Counters

    Counters

    I have placed the weblogic 9 version JAR file in sitescope but then too no counters visible. Can you please help me.

    Thanks,
    Sujith

    By Sujith on Jun 13, 2008

  6. Can I have a similar setup to watch the jboss mbeans using SiteScope? Please Advice.

    By Raghavendra on Jun 25, 2008

  7. @Sujith, confirm the user account u are using has access to monitor the relevant objects.

    @Raghavendra, JMX is a fairly open standard across Java platforms, so my guess is jboss should be able to be monitored. Although I have ditched this approach (using sitescope) and favour using JRuby and the jmx4r gem instead.

    By Tim on Jun 25, 2008

  8. This user account has the rights. Please help me as I am trying to set it up from past two months

    By Sujith on Jul 4, 2008

  9. Thanks for the post. That is one of doing it, but worries me about setting the default IIOP username/password is it may break EJB’s that use IIOP.

    I have also came up with a work around that is much more cumbersome then the one you suggested.

    There is a work around, by putting a custom SiteScope group file into the group’s directory of the SiteScope root directory. I can send you the one I used. When you add this file into the directory it will pickup the groups and monitors and you can then use the console to add the appropriate username and passwords, etc. The monitor then will be able to connect to Weblogic, but it will display no mbeans. However, unlike when you use the console the connection will not error and you will then be able to add the mbeans monitors into the groups file manually. This process is cumbersome since you have to find the mbeans yourself using a tool like WLST. This functionality has been broken in SiteScope since I started working with SiteScope which was about 2 years ago. The reason is that Weblogic 9 uses a different mbean structure then Weblogic 8 and HP never fixed the tree structure change.

    You may also want to try adding this to the monitors classpath and you may be able to use the old monitor or HTTP to access the JMX mbean:

    Set Up the Classpath for Remote Clients
    If your JMX client runs in its own JVM (that is, a JVM that is not a WebLogic Server instance), include the following JAR file in the client’s classpath:

    WL_HOME\lib\wljmxclient.jar

    where WL_HOME is the directory in which you installed WebLogic Server.

    This JAR contains BEA’s implementation of the HTTP and IIOP protocols and its proprietary T3 protocol. With BEA’s implementation, JMX clients send login credentials with their connection request and the WebLogic Server security framework authenticates the clients. Only authenticated clients can access MBeans that are registered in a WebLogic Server MBean server.

    Note: While BEA recommends that you use its implementation of the HTTP and IIOP protocols or its proprietary T3 protocol, JMX clients can use the IIOP protocol that is defined in the standard JDK. See Remote Connections Using Only JDK Classes on page 4-7.

    http://edocs.bea.com/wls/docs90/jmx/accessWLS.html#1112969

    BEA’s documentation suggested you should be able to access JMX through all sorts of protocols:

    One of the following values as the protocol for communicating with the MBean server:
    t3, t3s, http, https, iiop, iiops

    It would be intresting if you could.

    Thanks,

    David :)

    By DDamo on Aug 1, 2008

  10. Hi David,

    Thanks for your detailed suggestions! In short I’ve long since abandoned monitoring JMX via SiteScope as I found it too cumbersome for what I was after. Instead I’ve opted for simple JRuby scripts that use a JMX gem to automatically enum desired counters. This has saved me loads of time in terms of trawling through metrics via WLST and JConsole =)

    Regarding hacking the groups file, I had also done this in the past in response to a different defect, where SiteScope would timeout (actually run out of memory) when trying to enum the entire domainruntime MBeans tree upon first connect. Ugh.

    I wasn’t aware that BEA is serving up via other protocols, I had only ever tried via IIOP … I also wasn’t aware I would break other EJB access via the same protocol, but I guess that makes sense. Since I posted the original entry, I’ve realized you don’t need to make sure the password is >= 8 digits, that was my mistake, as I was using the default weblogic/weblogic account. Since then I’ve got the sysadmin to create me a custom account in the security realm and added it to the monitor & operator groups (not sure if they are default on all instances). In any case that setup works well.

    Thanks again for your tips, if you’re interested in using JRuby to collect the same info, please see this link:
    http://90kts.com/blog/2008/monitoring-weblogic-92-with-jmx-and-jruby/

    By Tim on Aug 1, 2008

Post a Comment

*
To prove that you're not a bot, enter this code
Anti-Spam Image