#!python
#
# parameter:process is was application name
perfStr=AdminControl.queryNames( 'type=Perf,process=server1,*')
perfObj=AdminControl.makeObjectName( perfStr)
# parameter:name is was application name
srvrStr=AdminControl.queryNames( 'type=Server,name=server1,*')
srvrObj=AdminControl.makeObjectName( srvrStr)
stats=AdminControl.invoke_jmx( perfObj, 'getStatsObject', [ srvrObj,java.lang.Boolean('true')], ['javax.management.ObjectName', 'java.lang.Boolean'])
###########################Print Was Performance #####################################
##################Print JDBC Perf ###################
# getStats('jdbc/dsjlec')
# jdbc/dsjlec is JDBC NAME
print stats.getStats('connectionPoolModule').getStats('DB2').getStats('jdbc/dsejianlong').getStatistic('WaitTime')
print stats.getStats('connectionPoolModule').getStats('DB2').getStats('jdbc/dsejianlong').getStatistic('UseTime')
print stats.getStats('connectionPoolModule').getStats('DB2').getStats('jdbc/dsejianlong').getStatistic('PercentUsed')
print stats.getStats('connectionPoolModule').getStats('DB2').getStats('jdbc/dsejianlong').getStatistic('WaitingThreadCount')
print stats.getStats('connectionPoolModule').getStats('DB2').getStats('jdbc/dsejianlong').getStatistic('PoolSize')
print stats.getStats('connectionPoolModule').getStats('DB2').getStats('jdbc/dsejianlong').getStatistic('FreePoolSize')
print stats.getStats('connectionPoolModule').getStats('DB2').getStats('jdbc/dsejianlong').getStatistic('JDBCTime')
print AdminControl.invoke(AdminControl.queryNames("*:name=dsejianlong,process=server1,*"), "showPoolContents")
#################Print JVM Perf #####################
print stats.getStats('jvmRuntimeModule').getStatistic('HeapSize')
print stats.getStats('jvmRuntimeModule').getStatistic('FreeMemory')
print stats.getStats('jvmRuntimeModule').getStatistic('UsedMemory')
print stats.getStats('jvmRuntimeModule').getStatistic('ProcessCpuUsage')
print stats.getStats('jvmRuntimeModule').getStatistic('UpTime')
######################### print WebContainer Thread Perf #############################
print stats.getStats('threadPoolModule').getStats('WebContainer').getStatistic('CreateCount')
print stats.getStats('threadPoolModule').getStats('WebContainer').getStatistic('DestroyCount')
print stats.getStats('threadPoolModule').getStats('WebContainer').getStatistic('ActiveCount')
print stats.getStats('threadPoolModule').getStats('WebContainer').getStatistic('PoolSize')
print stats.getStats('threadPoolModule').getStats('WebContainer').getStatistic('PercentMaxed')
print stats.getStats('threadPoolModule').getStats('WebContainer').getStatistic('DeclaredThreadHungCount')
print stats.getStats('threadPoolModule').getStats('WebContainer').getStatistic('ClearedThreadHangCount')
print stats.getStats('threadPoolModule').getStats('WebContainer').getStatistic('ConcurrentHungThreadCount')
print stats.getStats('threadPoolModule').getStats('WebContainer').getStatistic('ActiveTime')
########################## print Default Thread Perf #############################
#print stats.getStats('threadPoolModule').getStatistic('CreateCount')
#print stats.getStats('threadPoolModule').getStatistic('DestroyCount')
#print stats.getStats('threadPoolModule').getStatistic('ActiveCount')
#print stats.getStats('threadPoolModule').getStatistic('PoolSize')
#print stats.getStats('threadPoolModule').getStatistic('PercentMaxed')
#print stats.getStats('threadPoolModule').getStatistic('DeclaredThreadHungCount')
#print stats.getStats('threadPoolModule').getStatistic('ClearedThreadHangCount')
#print stats.getStats('threadPoolModule').getStatistic('ConcurrentHungThreadCount')
#print stats.getStats('threadPoolModule').getStatistic('ActiveTime')
#!/bin/ksh
/WAS9/WebSphere/AppServer/bin/wsadmin.sh -lang jython -f /etc/zabbix/zabbix_agentd/WAS_C254.py > /etc/zabbix/zabbix_agentd/log/WAS_C254_tmp.log
cp /etc/zabbix/zabbix_agentd/log/WAS_C254_tmp.log /etc/zabbix/zabbix_agentd/log/WAS_C254.log
grep PercentUsed /etc/zabbix/zabbix_agentd/log/WAS_C254.log |awk -F'current=' '{print $2}' |awk -F',' '{print $1}' >/etc/zabbix/zabbix_agentd/log/C254_java_pool_PercentUsed.log
grep "Total number of connection" /etc/zabbix/zabbix_agentd/log/WAS_C254.log |awk -F'max/min' '{print $1}' |awk -F'connections:' '{print $2}' |awk -F'(' '{print $1}' | sed 's/ //g' >
/etc/zabbix/zabbix_agentd/log/C254_java_pool_connectionnumber.log
#add for WaitingThreadCount
grep WaitingThreadCount /etc/zabbix/zabbix_agentd/log/WAS_C254.log |awk -F'current=' '{print $2}' |awk -F',' '{print $1}' > /etc/zabbix/zabbix_agentd/log/C254_java_pool_WaitingThreadCoun
t.log