Jae Schimmel asked 1 year ago
Title : Monitoring the JCA Adapter’s through WLST script.

Question :

Monitoring the JCA Adapter’s through WLST script.

1 Answers
ParwezParwez Staff answered 12 months ago

Monitoring the JCA Adapter’s through WLST script – Oracle SOA/AIA Suite 11g

At times it is required to monitor  jca adapter for runtime performance, em does provide options to check the performance, but every time you will need to log in to em to monitor the same, the details will not be as exhaustive as provided by wlst script’s output.

The below script can be used for monitoring only the DBAdapter’s and MQAdapter’s; the same can be extended to monitor other JCA Adapters (like FileAdapter) .

Before executing the script change the below condition according to your server name.

if server.getName().strip().startswith(‘S’) | server.getName().strip().startswith(‘O’)

The Adapters are only available in SOA and OSB servers so that I am filtering the other servers  based on the name(AdminServer or MS servers) .The exception will be thrown if we are trying to cd the MBean related to Adapters in others servers.

ResourceAdapterMonitor.py

def monitorDBAdapter(serverName):

    cd(“ServerRuntimes/”+str(serverName)+”/ApplicationRuntimes/DbAdapter/ComponentRuntimes/DbAdapter/ConnectionPools”)

    connectionPools = ls(returnMap=’true’)

    print ‘————————————————————————————–‘

    print ‘DBAdapter Runtime details for ‘+ serverName

    print ‘                                                                                      ‘

    print ‘                                                                                      ‘

    print ‘————————————————————————————–‘

    print ‘%10s %13s %15s %18s’ % (‘Connection Pool’, ‘State’, ‘Current’, ‘Created’)

    print ‘%10s %10s %24s %21s’ % (”, ”, ‘Capacity’, ‘Connections’)

    print ‘                                                                                      ‘

    print ‘————————————————————————————–‘

    for connectionPool in connectionPools:

       if connectionPool!=’eis/DB/SOADemo’:

          cd(‘/’)

          cd(“ServerRuntimes/”+str(serverName)+”/ApplicationRuntimes/DbAdapter/ComponentRuntimes/DbAdapter/ConnectionPools/”+str(connectionPool))

          print ‘%15s %15s %10s %20s’ % (cmo.getName(), cmo.getState(), cmo.getCurrentCapacity(), cmo.getConnectionsCreatedTotalCount())

    print ‘                                                                                      ‘

    print ‘————————————————————————————–‘

def monitorMQAdapter(serverName):

    cd(“ServerRuntimes/”+str(serverName)+”/ApplicationRuntimes/MQSeriesAdapter/ComponentRuntimes/MQSeriesAdapter/ConnectionPools”)

    connectionPoolsMQ = ls(returnMap=’true’)

    print ‘————————————————————————————–‘

    print ‘MQAdapter Runtime details for ‘+ serverName

    print ‘                                                                                      ‘

    print ‘                                                                                      ‘

    print ‘————————————————————————————–‘

    print ‘%15s %17s %15s %18s’ % (‘Connection Pool’, ‘State’, ‘Current’, ‘Created’)

    print ‘%15s %15s %24s %21s’ % (”, ”, ‘Capacity’, ‘Connections’)

    print ‘                                                                                      ‘

    print ‘————————————————————————————–‘

    for connectionPoolMQ in connectionPoolsMQ:

          cd(‘/’)

          cd(“ServerRuntimes/”+str(serverName)+”/ApplicationRuntimes/MQSeriesAdapter/ComponentRuntimes/MQSeriesAdapter/ConnectionPools/”)

          cd(connectionPoolMQ)

          print ‘%15s %20s %10s %20s’ % (cmo.getName(), cmo.getState(), cmo.getCurrentCapacity(), cmo.getConnectionsCreatedTotalCount())

    print ‘                                                                                      ‘

    print ‘————————————————————————————–‘

def main():

      #connect(username, password, admurl)

      connect(‘weblogic’,’reuters123′,’t3://<SOA Host>:<SOA Port>)

      servers = cmo.getServers()

      domainRuntime()

      for server in servers:

         cd(“/ServerLifeCycleRuntimes/” + server.getName())

         if cmo.getState() == ‘RUNNING’:  

            if server.getName().strip().startswith(‘S’) | server.getName().strip().startswith(‘O’) :

                 monitorDBAdapter(server.getName())

      for server in servers:

         cd(‘/’)

         cd(“/ServerLifeCycleRuntimes/” + server.getName())

         if cmo.getState() == ‘RUNNING’:  

            if server.getName().strip().startswith(‘S’) | server.getName().strip().startswith(‘O’) :

                 monitorMQAdapter(server.getName())   

      disconnect()

 

main()

Copy the script to the soa server and execute the below command

>   wlst.sh ResourceAdapterMonitor.py

O/P:

————————————————————————————–

DBAdapter Runtime details for SOA1

————————————————————————————–

Connection Pool         State         Current            Created

                                                    Capacity          Connections

————————————————————————————–

  eis/DB/SOA             Running         22               1051

      eis/DB/Test           Running           2                  697

    eis/DB/Test1           Running           1                  130

————————————————————————————–

—————————————————————————————————-

MQAdapter Runtime details for SOA1

——————————————————————————————————

Connection Pool                                       State          Current            Created

                                                                                  Capacity           Connections

——————————————————————————————————

eis/MQ/MQAdapter                                 Running          0                    0

eis/MQ/MQSeriesAdapterRemote            Running          2                   84

Cubastion is among a very small number of specialized Siebel CRM Oracle Gold Partners in SME.