Friday, November 22, 2013

WebLogic JMX remote using JMX protocol and JMXTrans

Make sure this is enabled in your domain configuration:
a) [domain name]->[Configuration][General]->[Advanced]
[X] Platform MBean Server Enabled
[X] Platform MBean Server Used

b) [domain name]->[Security][General]
[X] Anonymous Admin Lookup Enabled




make sure each server listens on a different jmx port:
vi /opt/oracle/domains/osbpl1do/bin/setDomainEnv.sh

if [ "${SERVER_NAME}" = "osbpl1ms1" ] ; 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 -Djavax.management.builder.initial=weblogic.management.jmx.mbeanserver.WLSMBeanServerBuilder"
fi


if [ "${SERVER_NAME}" = "osbpl1as" ] ; then
JAVA_OPTIONS="${JAVA_OPTIONS} -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8889 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djavax.management.builder.initial=weblogic.management.jmx.mbeanserver.WLSMBeanServerBuilder"
fi



restart your servers

To monitor a DataSource Active Connections:

vi myds.json:

{
  "servers" : [ {
    "port" : "25006",
    "host" : "myhost.acme.com",
    "queries" : [ {
      "outputWriters" : [ {
        "@class" : "com.googlecode.jmxtrans.model.output.StdOutWriter",
        "settings" : {
        }
      } ],
      "obj" : "com.bea:ServerRuntime=acme-server-1,Name=acme-import.PickupPointDS,Type=JDBCDataSourceRuntime",
      "attr" : [ "ActiveConnectionsCurrentCount" ]
    }, {
      "outputWriters" : [ {
        "@class" : "com.googlecode.jmxtrans.model.output.StdOutWriter",
        "settings" : {
        }
      } ],
      "obj" : "java.lang:name=CMS Old Gen,type=MemoryPool",
      "attr" : [ "Usage" ]
    }, {
      "outputWriters" : [ {
        "@class" : "com.googlecode.jmxtrans.model.output.StdOutWriter",
        "settings" : {
        }
      } ],
      "obj" : "java.lang:name=ConcurrentMarkSweep,type=GarbageCollector",
      "attr" : [ "LastGcInfo" ]
    } ],
    "numQueryThreads" : 2
  } ]
}



./jmxtrans.sh start myds.json

you should get this

Result [attributeName=ActiveConnectionsCurrentCount, className=weblogic.jdbc.common.internal.DataSourceRuntimeMBeanImpl, typeName=Name=acme-import.PickupPointDS,ServerRuntime=acme-server-1,Type=JDBCDataSourceRuntime, values={ActiveConnectionsCurrentCount=0}, epoch=1385119401592]

To find the ObjectName (like: com.bea:ServerRuntime=acme-server-1,Name=acme-import.PickupPointDS,Type=JDBCDataSourceRuntime ) you connect to the Managed Server with WLST, serverRuntime(), then you cd to the MBean and you do "cmo", this will tell you the ObjectName. The attribute can be discovered wish "ls".

No comments: