Thursday, May 3, 2012

WebLogic monitoring with JMX and JConsole

This great post explains you everything


cd C:\Oracle\Middleware\wlserver_10.3\server\lib
java -jar wljarbuilder.jar
echo %JAVA_HOME%

C:\Oracle\MIDDLE~1\JDK160~1
cd %JAVA_HOME%
cd bin
jconsole -J-Djava.class.path=C:\Oracle\MIDDLE~1\JDK160~1\lib\jconsole.jar;C:\Oracle\MIDDLE~1\JDK160~1\lib\tools.jar;C:\Oracle\Middleware\wlserver_10.3\server\lib\wlfullclient.jar -J-Djmx.remote.protocol.provider.pkgs=weblogic.management.remote -debug



(make sure you enter it like that, with the -J-D which looks very weird)

when jconsole comes up, choose remote connection,
provide
service:jmx:iiop://yourhost:yourport/jndi/weblogic.management.mbeanservers.runtime

(your port is NOT the jmx port provided in -Dcom.sun.management.jmxremote.port=8888, but the listen port of the WLS)
and enter your weblogic username and password to authenticate


You can also find MBean Object Names with weblogic.Admin:


java weblogic.Admin -url t3://myserver.acme.com:8105 -username Pierluigi -password weblogic1 -pretty GET -type ClusterRuntime


and the MBean name is osbdv2do:ServerRuntime=osbdv2ms1,Name=osbdv2cl,Type=ClusterRuntime,Location=osbdv2ms1



---------------------------
MBeanName: "osbdv2do:ServerRuntime=osbdv2ms1,Name=osbdv2cl,Type=ClusterRuntime,Location=osbdv2ms1"
ActiveSingletonServices:
AliveServerCount: 2
CachingDisabled: true
CurrentMachine: myserver
CurrentSecondaryServer: -7551940697957911746S:myserver.acme.com:[8205,8205,-1,-1,-1,-1,-1]:myserver.acme.com:8105,myserver.acme.com:8205:osbdv2do:osbdv2ms2
DetailedSecondariesDistribution:
ForeignFragmentsDroppedCount: 0
FragmentsReceivedCount: 696
FragmentsSentCount: 805
HealthState: Component:null,State:HEALTH_OK,MBean:null,ReasonCode:[]
JobSchedulerRuntime:
MulticastMessagesLostCount: 2
Name: osbdv2cl
Parent: osbdv2ms1
PrimaryCount: 0
Registered: true
ResendRequestsCount: 1
SecondaryCount: 0
SecondaryDistributionNames:
SecondaryServerDetails: -7551940697957911746S:myserver.acme.com:[8205,8205,-1,-1,-1,-1,-1]:myserver.acme.com:8105,myserver.acme.com:8205:osbdv2do:osbdv2ms2
ServerMigrationRuntime: ServerMigrationRuntime
ServerNames: osbdv2ms2,osbdv2ms1
Type: ClusterRuntime
UnicastMessaging: UnicastMessagingRuntime




wlst jmx objectname for clusterruntime:

This is the way to find the OBJECT_NAME associated to a MBean with WLST:

http://docs.oracle.com/cd/E23943_01/web.1111/e13715/nav_edit.htm#i1001906

java weblogic.WLST

connect(...)
serverRuntime()
easeSyntax()
cd ClusterRuntime
cd osbdv2cluster
cmo

[MBeanServerInvocationHandler]com.bea:ServerRuntime=osbdv2ms1,Name=osbdv2cluster,Type=ClusterRuntime

so com.bea:ServerRuntime=osbdv2ms1,Name=osbdv2cluster,Type=ClusterRuntime is the OBJECT_NAME

you can extract attributes: ServerNames et AliveServerCount


You can test if your OBJECT_NAME is correct with "weblogic.Admin GET -mbean":

http://docs.oracle.com/cd/E13222_01/wls/docs81/admin_ref/cli30.html#1035148

java weblogic.Admin -url t3://myserver.acme.com:8105 -username pippo -password weblogic1 -pretty GET -mbean osbdv2do:ServerRuntime=osbdv2ms1,Name=osbdv2cl,Type=ClusterRuntime,Location=osbdv2ms1


To enable remote JMX connection, in $DOMAIN_HOME/bin/setDomainEnv.sh, almost at the bottom, add:

if [ "${SERVER_NAME}" = "osbdv2ms1" ] ; then
JAVA_OPTIONS="${JAVA_OPTIONS} -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8888 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
fi


Here a good article on how to expose an interface through a MBean, including the HtmlAdaptorServer

No comments: