Tuesday, April 21, 2015
On April 21, 2015 by Kamlesh 5 comments
WLST Script for checking the status of JDBC Datasource in Weblogic
WLST has some good features like we can monitor the weblogic domain, monitor JMS Cluster, Datasource target and untarget etc.
In this post I am explaining about how to monitor JDBC Datasource like status of datasource, load on datasource etc. by WLST script.
Step by step explaining how to prepare the JDBCmonitor.py file and how to run it.
1) Prepare the JDBCmonitor.py file and save it in somewhere in your machine.
#############################################################################
# @author Middlewaregeek.blogspot.in
#############################################################################
from java.io import FileInputStream
import java.lang
import os
import string
username = 'weblogic'
password = 'weblogic'
url='t3://localhost:7001'
connect(username,password,url)
allServers=domainRuntimeService.getServerRuntimes();
if (len(allServers) > 0):
for tempServer in allServers:
jdbcServiceRT = tempServer.getJDBCServiceRuntime();
dataSources = jdbcServiceRT.getJDBCDataSourceRuntimeMBeans();
if (len(dataSources) > 0):
for dataSource in dataSources:
print 'ActiveConnectionsAverageCount ' , dataSource.getActiveConnectionsAverageCount()
print 'ActiveConnectionsCurrentCount ' , dataSource.getActiveConnectionsCurrentCount()
print 'ActiveConnectionsHighCount ' , dataSource.getActiveConnectionsHighCount()
print 'ConnectionDelayTime ' , dataSource.getConnectionDelayTime()
print 'ConnectionsTotalCount ' , dataSource.getConnectionsTotalCount()
print 'CurrCapacity ' , dataSource.getCurrCapacity()
print 'CurrCapacityHighCount ' , dataSource.getCurrCapacityHighCount()
print 'DeploymentState ' , dataSource.getDeploymentState()
print 'FailedReserveRequestCount ' , dataSource.getFailedReserveRequestCount()
print 'FailuresToReconnectCount ' , dataSource.getFailuresToReconnectCount()
print 'HighestNumAvailable ' , dataSource.getHighestNumAvailable()
print 'HighestNumUnavailable ' , dataSource.getHighestNumUnavailable()
print 'LeakedConnectionCount ' , dataSource.getLeakedConnectionCount()
print 'ModuleId ' , dataSource.getModuleId()
print 'Name ' , dataSource.getName()
print 'NumAvailable ' , dataSource.getNumAvailable()
print 'NumUnavailable ' , dataSource.getNumUnavailable()
print 'Parent ' , dataSource.getParent()
print 'PrepStmtCacheAccessCount ' , dataSource.getPrepStmtCacheAccessCount()
print 'PrepStmtCacheAddCount ' , dataSource.getPrepStmtCacheAddCount()
print 'PrepStmtCacheCurrentSize ' , dataSource.getPrepStmtCacheCurrentSize()
print 'PrepStmtCacheDeleteCount ' , dataSource.getPrepStmtCacheDeleteCount()
print 'PrepStmtCacheHitCount ' , dataSource.getPrepStmtCacheHitCount()
print 'PrepStmtCacheMissCount ' , dataSource.getPrepStmtCacheMissCount()
print 'Properties ' , dataSource.getProperties()
print 'ReserveRequestCount ' , dataSource.getReserveRequestCount()
print 'State ' , dataSource.getState()
print 'Type ' , dataSource.getType()
print 'VersionJDBCDriver ' , dataSource.getVersionJDBCDriver()
print 'WaitingForConnectionCurrentCount ' , dataSource.getWaitingForConnectionCurrentCount()
print 'WaitingForConnectionFailureTotal ' , dataSource.getWaitingForConnectionFailureTotal()
print 'WaitingForConnectionHighCount ' , dataSource.getWaitingForConnectionHighCount()
print 'WaitingForConnectionSuccessTotal ' , dataSource.getWaitingForConnectionSuccessTotal()
print 'WaitingForConnectionTotal ' , dataSource.getWaitingForConnectionTotal()
print 'WaitSecondsHighCount ' , dataSource.getWaitSecondsHighCount()
if (len(allServers) > 0):
for tempServer in allServers:
jdbcServiceRT = tempServer.getJDBCServiceRuntime();
dataSources = jdbcServiceRT.getJDBCDataSourceRuntimeMBeans();
if (len(dataSources) > 0):
for dataSource in dataSources:
print 'ActiveConnectionsAverageCount ' , dataSource.getActiveConnectionsAverageCount()
print 'ActiveConnectionsCurrentCount ' , dataSource.getActiveConnectionsCurrentCount()
print 'ActiveConnectionsHighCount ' , dataSource.getActiveConnectionsHighCount()
print 'ConnectionDelayTime ' , dataSource.getConnectionDelayTime()
print 'ConnectionsTotalCount ' , dataSource.getConnectionsTotalCount()
print 'CurrCapacity ' , dataSource.getCurrCapacity()
print 'CurrCapacityHighCount ' , dataSource.getCurrCapacityHighCount()
print 'DeploymentState ' , dataSource.getDeploymentState()
print 'FailedReserveRequestCount ' , dataSource.getFailedReserveRequestCount()
print 'FailuresToReconnectCount ' , dataSource.getFailuresToReconnectCount()
print 'HighestNumAvailable ' , dataSource.getHighestNumAvailable()
print 'HighestNumUnavailable ' , dataSource.getHighestNumUnavailable()
print 'LeakedConnectionCount ' , dataSource.getLeakedConnectionCount()
print 'ModuleId ' , dataSource.getModuleId()
print 'Name ' , dataSource.getName()
print 'NumAvailable ' , dataSource.getNumAvailable()
print 'NumUnavailable ' , dataSource.getNumUnavailable()
print 'Parent ' , dataSource.getParent()
print 'PrepStmtCacheAccessCount ' , dataSource.getPrepStmtCacheAccessCount()
print 'PrepStmtCacheAddCount ' , dataSource.getPrepStmtCacheAddCount()
print 'PrepStmtCacheCurrentSize ' , dataSource.getPrepStmtCacheCurrentSize()
print 'PrepStmtCacheDeleteCount ' , dataSource.getPrepStmtCacheDeleteCount()
print 'PrepStmtCacheHitCount ' , dataSource.getPrepStmtCacheHitCount()
print 'PrepStmtCacheMissCount ' , dataSource.getPrepStmtCacheMissCount()
print 'Properties ' , dataSource.getProperties()
print 'ReserveRequestCount ' , dataSource.getReserveRequestCount()
print 'State ' , dataSource.getState()
print 'Type ' , dataSource.getType()
print 'VersionJDBCDriver ' , dataSource.getVersionJDBCDriver()
print 'WaitingForConnectionCurrentCount ' , dataSource.getWaitingForConnectionCurrentCount()
print 'WaitingForConnectionFailureTotal ' , dataSource.getWaitingForConnectionFailureTotal()
print 'WaitingForConnectionHighCount ' , dataSource.getWaitingForConnectionHighCount()
print 'WaitingForConnectionSuccessTotal ' , dataSource.getWaitingForConnectionSuccessTotal()
print 'WaitingForConnectionTotal ' , dataSource.getWaitingForConnectionTotal()
print 'WaitSecondsHighCount ' , dataSource.getWaitSecondsHighCount()
2) Set the class path by using setDomainEnv script or go to the below path and execute JDBCmonitor.py file.
$WL_HOME/wlserver_10.3/common/bin
Then execute below command
$ ./wlst.sh <location of .py file >/ JDBCmonitor.py
3) You should get following output.
Initializing WebLogic Scripting Tool (WLST) ...
*sys-package-mgr*: skipping bad jar, '/WL_HOME/wlserver_10.3/common/lib/mssqlserver.jar'
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Connecting to t3://localhost:7001 with userid
Successfully connected to Admin Server 'admin' that belongs to domain 'XYZ'.
Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.
Location changed to domainRuntime tree. This is a read-only tree with DomainMBean as the root.
For more help, use help(domainRuntime)
ActiveConnectionsAverageCount 0
ActiveConnectionsCurrentCount 0
ActiveConnectionsHighCount 0
ConnectionDelayTime 30
ConnectionsTotalCount 20
CurrCapacity 10
CurrCapacityHighCount 1
DeploymentState 2
FailedReserveRequestCount 0
FailuresToReconnectCount 0
HighestNumAvailable 10
HighestNumUnavailable 0
LeakedConnectionCount 0
ModuleId DS1
Name DS1
NumAvailable 10
NumUnavailable 0
Parent [MBeanServerInvocationHandler]com.bea:Name=AdminServer,Location=AdminServer,Type=ServerRuntime
PrepStmtCacheAccessCount 0
PrepStmtCacheAddCount 0
PrepStmtCacheCurrentSize 0
PrepStmtCacheDeleteCount 0
PrepStmtCacheHitCount 0
PrepStmtCacheMissCount 0
Properties {databaseName=jdbc:pointbase:server://localhost:7001/TestDS, user=XYZ}
ReserveRequestCount 0
State Running
Type JDBCDataSourceRuntime
VersionJDBCDriver com.pointbase.jdbc.jdbcUniversalDriver
WaitingForConnectionCurrentCount 0
WaitingForConnectionFailureTotal 0
WaitingForConnectionHighCount 0
WaitingForConnectionSuccessTotal 0
WaitingForConnectionTotal 0
WaitSecondsHighCount 0
ActiveConnectionsCurrentCount 0
ActiveConnectionsHighCount 0
ConnectionDelayTime 30
ConnectionsTotalCount 20
CurrCapacity 10
CurrCapacityHighCount 1
DeploymentState 2
FailedReserveRequestCount 0
FailuresToReconnectCount 0
HighestNumAvailable 10
HighestNumUnavailable 0
LeakedConnectionCount 0
ModuleId DS1
Name DS1
NumAvailable 10
NumUnavailable 0
Parent [MBeanServerInvocationHandler]com.bea:Name=AdminServer,Location=AdminServer,Type=ServerRuntime
PrepStmtCacheAccessCount 0
PrepStmtCacheAddCount 0
PrepStmtCacheCurrentSize 0
PrepStmtCacheDeleteCount 0
PrepStmtCacheHitCount 0
PrepStmtCacheMissCount 0
Properties {databaseName=jdbc:pointbase:server://localhost:7001/TestDS, user=XYZ}
ReserveRequestCount 0
State Running
Type JDBCDataSourceRuntime
VersionJDBCDriver com.pointbase.jdbc.jdbcUniversalDriver
WaitingForConnectionCurrentCount 0
WaitingForConnectionFailureTotal 0
WaitingForConnectionHighCount 0
WaitingForConnectionSuccessTotal 0
WaitingForConnectionTotal 0
WaitSecondsHighCount 0
Regards,
Middlewaregeek
Friday, April 10, 2015
On April 10, 2015 by Kamlesh 1 comment
WLST Script for
Monitoring the JMS status of Weblogic Domain
After long time writing something about WLST
WLST has some good features like we can monitor the weblogic
domain, monitor JMS Cluster, Datasource target and untarget etc.
In this post I am explaining about how to monitor JMS
Cluster like message count, pending message etc. by WLST script.
Step by step explaining how to prepare the JMSmonitor.py
file and how to run it.
1) Prepare the JMSmonitor.py file and save it in somewhere in your
machine.
#############################################################################
# @author Middlewaregeek.blogspot.in
#############################################################################
from java.io import FileInputStream
import java.lang
import os
import string
username = 'weblogic'
password = 'weblogic'
url='t3://localhost:7001'
connect(username,password,url)
servers = domainRuntimeService.getServerRuntimes();
if (len(servers) > 0):
for server in
servers:
jmsRuntime
= server.getJMSRuntime();
jmsServers
= jmsRuntime.getJMSServers();
for
jmsServer in jmsServers:
destinations = jmsServer.getDestinations();
for
destination in destinations:
print
' BytesCurrentCount ' ,
destination.getBytesCurrentCount()
print ' BytesHighCount ' , destination.getBytesHighCount()
print ' BytesPendingCount ' ,
destination.getBytesPendingCount()
print ' BytesReceivedCount ' ,
destination.getBytesReceivedCount()
print ' BytesThresholdTime ' ,
destination.getBytesThresholdTime()
print '
ConsumersCurrentCount '
, destination.getConsumersCurrentCount()
print ' ConsumersHighCount ' ,
destination.getConsumersHighCount()
print ' ConsumersTotalCount ' ,
destination.getConsumersTotalCount()
print ' ConsumptionPausedState ' ,
destination.getConsumptionPausedState()
print ' '
print ' DestinationInfo ' , destination.getDestinationInfo()
print ' '
print ' DestinationType ' , destination.getDestinationType()
print ' InsertionPaused ' , destination.isInsertionPaused()
print ' InsertionPausedState ' ,
destination.getInsertionPausedState()
print '
MessagesCurrentCount '
, destination.getMessagesCurrentCount()
print '
MessagesDeletedCurrentCount ' ,
destination.getMessagesDeletedCurrentCount()
print ' MessagesHighCount ' ,
destination.getMessagesHighCount()
print '
MessagesMovedCurrentCount '
,
destination.getMessagesMovedCurrentCount()
print ' MessagesPendingCount ' ,
destination.getMessagesPendingCount()
print '
MessagesReceivedCount '
, destination.getMessagesReceivedCount()
print '
MessagesThresholdTime '
, destination.getMessagesThresholdTime()
print ' Parent ' , destination.getParent()
print ' Paused ' , destination.isPaused()
print ' ProductionPaused ' ,
destination.isProductionPaused()
print '
ProductionPausedState '
, destination.getProductionPausedState()
print ' State ' , destination.getState()
print ' Type ' , destination.getType()
2) Set the class
path by using setDomainEnv script or go to the below path and execute JMSmonitor.py file.
$WL_HOME/wlserver_10.3/common/bin
Then execute below command
$ ./wlst.sh <location of .py file >/ JMSmonitor.py
3) You should get
following output.
Initializing WebLogic Scripting Tool (WLST) ...
*sys-package-mgr*: skipping bad jar, '/WL_HOME/wlserver_10.3/common/lib/mssqlserver.jar'
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Connecting to t3://localhost:7001 with userid
Successfully connected to Admin Server 'admin' that
belongs to domain 'XYZ'.
Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.
Location changed to domainRuntime tree. This is a
read-only tree with DomainMBean as the root.
For more help, use help(domainRuntime)
DestinationType Queue
InsertionPaused 0
InsertionPausedState
Insertion-Enabled
MessagesCurrentCount 0
MessagesDeletedCurrentCount 0
MessagesHighCount 3
MessagesMovedCurrentCount 0
MessagesPendingCount 0
MessagesReceivedCount 268
MessagesThresholdTime 0
Parent
[MBeanServerInvocationHandler]com.bea:ServerRuntime=MS1,Name=XYZJMSServer_MS1,Location=MS1,Type=JMSServerRuntime
Paused 0
ProductionPaused 0
ProductionPausedState
Production-Enabled
State advertised_in_cluster_jndi
Type JMSDestinationRuntime
BytesCurrentCount 0
BytesHighCount 19181
BytesPendingCount 0
BytesReceivedCount
6636125
BytesThresholdTime 0
ConsumersCurrentCount 5
ConsumersHighCount 5
ConsumersTotalCount 5
ConsumptionPausedState
Consumption-Enabled
Regards,
Middlewaregeek
On April 10, 2015 by Kamlesh 6 comments
WLST Script for
checking the health status of Weblogic Domain (Admin/Managed node)
After long time writing something about WLST
WLST has some good features like we can monitor the weblogic
domain, monitor JMS Cluster, Datasource target and untarget etc.
In this post I am explaining about how to monitor
Weblogic domain like Server State, Server Health, Listen Port, Listen Addresses
etc. by WLST script.
Step by step explaining how to prepare the wlsstatus.py
file and how to run it.
1) Prepare the wlsstatus.py file and save it in
somewhere in your machine.
############################################################################
# This script is for checking the Health Status of the
servers
# Author:
@Middlewaregeek.blogspot.in
############################################################################
# Connect to
the Admin Server
from java.io import FileInputStream
import java.lang
import os
import string
username = 'weblogic'
password = 'weblogic'
url='t3://localhost:7001'
connect(username,password,url)
domainRuntime()
cd('ServerRuntimes')
servers=domainRuntimeService.getServerRuntimes()
for server in servers:
serverName=server.getName();
print
'**************************************************'
print
'##############' , serverName,'###############'
print
'**************************************************'
print '#####
Server State #####',
server.getState()
print '#####
Server ListenAddress #####', server.getListenAddress()
print '##### Server
ListenPort #####',
server.getListenPort()
print '#####
Server Health State #####',
server.getHealthState()
2) Set the class
path by using setDomainEnv script or go to the below path and execute
wlsstatus.py file.
$WL_HOME/wlserver_10.3/common/bin
Then execute below command
$ ./wlst.sh <location of .py file >/wlsstatus.py
3) You should get
following output.
Initializing WebLogic Scripting Tool (WLST) ...
*sys-package-mgr*: skipping bad jar, '/WL_HOME/wlserver_10.3/common/lib/mssqlserver.jar'
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Connecting to t3://localhost:7001 with userid
Successfully connected to Admin Server 'admin' that belongs
to domain 'XYZ'.
Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.
Location changed to domainRuntime tree. This is a
read-only tree with DomainMBean as the root.
For more help, use help(domainRuntime)
**************************************************
############## MS1 ###############
**************************************************
##### Server State
##### RUNNING
##### Server ListenAddress ##### Listening Address
##### Server ListenPort
##### 7001
##### Server Health State ##### Component:ServerRuntime,State:HEALTH_OK,MBean:MS1,ReasonCode:[]
**************************************************
############## MS2 ###############
**************************************************
##### Server State
##### RUNNING
##### Server ListenAddress ##### Listening Address
##### Server ListenPort
##### 7001
##### Server Health State #####
Component:ServerRuntime,State:HEALTH_OK,MBean:MS2,ReasonCode:[]
**************************************************
############## MS3
###############
**************************************************
##### Server State
##### RUNNING
##### Server ListenAddress ##### Listening Address
##### Server ListenPort
##### 7001
##### Server Health State ##### Component:ServerRuntime,State:HEALTH_OK,MBean:MS3,ReasonCode:[]
**************************************************
############## admin ###############
**************************************************
##### Server State
##### RUNNING
##### Server ListenAddress ##### Listening Address
##### Server ListenPort
##### 7001
##### Server Health State ##### Component:ServerRuntime,State:HEALTH_OK,MBean:admin,ReasonCode:[]
**************************************************
############## MS4
###############
**************************************************
##### Server State
##### RUNNING
##### Server ListenAddress ##### Listening Address
##### Server ListenPort
##### 7001
##### Server Health State #####
Component:ServerRuntime,State:HEALTH_OK,MBean:MS4,ReasonCode:[]
Regards,
Middlewaregeek
Subscribe to:
Posts (Atom)
Search
AdSense
Recent Posts
Popular Posts
-
WLST Script for checking the health status of Weblogic Domain (Admin/Managed node) After long time writing something about WLST WLST...
-
WLST Script for checking the status of JDBC Datasource in Weblogic WLST has some good features like we can monitor the weblogic dom...
-
WLST Script for Monitoring the JMS status of Weblogic Domain After long time writing something about WLST WLST has some good feature...
-
WLST Server Start The server of a WebLogic domain can be started using different techniques. The best setup depends on the technical re...
-
How to Deploy Application using WLST We can use WLST to quickly deploy an Application in a Weblogic Server. Requirement:- · The ...
-
How to create WebLogic Domain using Domain template: 1. Open an existing domain template (assuming WebLogic Server is installed at c:...
-
Basic concepts of WLST. What is WLST? It is a scripting tool offered by Weblogic. Any way WLST is not only for a sense of control,...
-
Hi All, writing something about OPMN utility with oracle instance and Weblogic. WebLogic Server – Weblogic is J2EE application ...
-
Hadoop Distributed Filesystem (HDFS) Built to support high throughput, streaming reads and writes of extremely large files. NAS ...
-
Before diving into this implementation, I would suggest you to look at Spring Security Introduction first. Let's Start Most of the We...
Recent Posts
Sample Text
Blog Archive
Total Pageviews
Find Us On Facebook
Powered by Blogger.