尝试制作一个非常简单的 jython 脚本来从 websphere 获取基本的 PMI 数据。获取诸如空闲堆等 JVM 数据很简单(并且有效)
perfName = AdminControl.completeObjectName ('type=Perf,process=PTEIRMW_APPSERVER801,*')
perfOName = AdminControl.makeObjectName (perfName)
jvmName = AdminControl.completeObjectName ('type=JVM,process=PTEIRMW_APPSERVER801,*')
params = [AdminControl.makeObjectName (jvmName), java.lang.Boolean ('false')]
sigs = ['javax.management.ObjectName', 'java.lang.Boolean']
AdminControl.invoke_jmx (perfOName, 'getStatsObject', params, sigs)
但后来我尝试为 WebContainer 线程池做类似的事情,但它失败了
threadPoolName = AdminControl.completeObjectName('name=WebContainer,type=ThreadPool,process=PTEIRMW_APPSERVER801,*')
threadPoolOName = AdminControl.makeObjectName (threadPoolName)
params = [AdminControl.makeObjectName (threadPoolName), java.lang.Boolean ('false')]
sigs = ['javax.management.ObjectName', 'java.lang.Boolean']
AdminControl.invoke_jmx (threadPoolOName, 'getStatsObject', params, sigs)
错误是
WASX7015E: 异常运行命令:“AdminControl.invoke_jmx (threadPoolOName, 'getStatsObject', params, sigs)”;异常信息:javax.management.MBeanException javax.management.ServiceNotFoundException:操作getStatsObject不在ModelMBeanInfo中
有任何想法吗?我特别只想要 WebContainer 线程池(最好只有活动线程......但我可以稍后过滤掉它)