wsadmin getStatsObject 未返回 JVMRuntime 的所有指标
wsadmin getStatsObject not returning all of the metrics for JVMRuntime
我正在编写一个 jython 脚本,它 return 是 JVMRuntimeModule 的性能指标。它是 returning 以下内容:
HeapSize、FreeMemory、UsedMemory、UpTime、ProcessCpuUsage
但不是以下各项:GCCount、GCIntervalTime、GCTime、ObjectAllocateCount、ObjectFreedCount、ThreadStartedCount、ObjectMovedCount、WaitsForLockCount、ThreadEndedCount、WaitForLockTime
我怎么拥有它return全部?
type = sys.argv[0] # "JVM"
name = sys.argv[1] # "JVM"
process = sys.argv[2] # "MyServer"
objectName = "WebSphere:name=%s,process=%s,type=%s,*" % (name, process, type)
perfName = AdminControl.completeObjectName("type=Perf,process=%s,*" % process)
perfOName = AdminControl.makeObjectName(perfName)
sigs = ['javax.management.ObjectName', 'java.lang.Boolean']
coName = AdminControl.completeObjectName (objectName)
params = [AdminControl.makeObjectName (coName), java.lang.Boolean ('false')]
jvmObj=AdminControl.invoke_jmx (perfOName, 'getStatsObject', params, sigs)
jvmStats = jvmObj.getStatistics()
print jvmStats
jvmStats 只包含 HeapSize,FreeMemory,UsedMemory,UpTime,ProcessCpuUsage
输出:
array([name=HeapSize, ID=1, description=The total memory (in KBytes) in the Java virtual machine run time., unit=KILOBYTE, type=BoundedRangeStatistic, lowWaterMark=262144, highWaterMark=524288, current=523264, integral=7.8067724096E10, lowerBound=262144, upperBound=524288,
name=FreeMemory, ID=2, description=The free memory (in KBytes) in the Java virtual machine run time., unit=KILOBYTE, type=CountStatistic, count=89475,
name=UsedMemory, ID=3, description=The amount of used memory (in KBytes) in the Java virtual machine run time., unit=KILOBYTE, type=CountStatistic, count=433788,
name=UpTime, ID=4, description=The amount of time (in seconds) that the Java virtual machine has been running., unit=SECOND, type=CountStatistic, count=2421377,
name=ProcessCpuUsage, ID=5, description=The CPU Usage (in percent) of the Java virtual machine., unit=N/A, type=CountStatistic, count=0], com.ibm.ws.pmi.stat.StatisticImpl)
我希望所有这些都returned。
不太熟悉这个领域,但我看到了一些要看的东西:
1) 其中一些统计信息仅在启用 JVM 分析时可用,(如 here). E.g. add a generic JVM argument: -agentlib:pmiJvmtiProfiler
. See the instructions here 在管理控制台中执行此操作的位置所述。
2) JVM 统计数据嵌套在树结构中(参见 here),因此您可以添加此行:
print jvmObj.getSubStats()
查看嵌套统计信息。如果你在管理控制台中进入 PMI->server 然后点击 Custom link 你也可以看到这个结构面板以获得显示所有 PMI 设置的树型控件。
3) 当然,您必须启用 PMI 统计信息(来自 PMI->server 等),但我猜您已经这样做了。
除了 Scott 的回答之外,还可以根据启用的 PMI 级别提供不同的统计信息。请在此处查看 JVM 计数器的 "Level" 列:https://www.ibm.com/support/knowledgecenter/en/SSAW57_9.0.5/com.ibm.websphere.nd.multiplatform.doc/ae/rprf_datacounter4.html
一般来说,最好使用 "Custom" 级别并准确配置您想要的指标以获得最佳性能。
我正在编写一个 jython 脚本,它 return 是 JVMRuntimeModule 的性能指标。它是 returning 以下内容:
HeapSize、FreeMemory、UsedMemory、UpTime、ProcessCpuUsage
但不是以下各项:GCCount、GCIntervalTime、GCTime、ObjectAllocateCount、ObjectFreedCount、ThreadStartedCount、ObjectMovedCount、WaitsForLockCount、ThreadEndedCount、WaitForLockTime
我怎么拥有它return全部?
type = sys.argv[0] # "JVM"
name = sys.argv[1] # "JVM"
process = sys.argv[2] # "MyServer"
objectName = "WebSphere:name=%s,process=%s,type=%s,*" % (name, process, type)
perfName = AdminControl.completeObjectName("type=Perf,process=%s,*" % process)
perfOName = AdminControl.makeObjectName(perfName)
sigs = ['javax.management.ObjectName', 'java.lang.Boolean']
coName = AdminControl.completeObjectName (objectName)
params = [AdminControl.makeObjectName (coName), java.lang.Boolean ('false')]
jvmObj=AdminControl.invoke_jmx (perfOName, 'getStatsObject', params, sigs)
jvmStats = jvmObj.getStatistics()
print jvmStats
jvmStats 只包含 HeapSize,FreeMemory,UsedMemory,UpTime,ProcessCpuUsage
输出:
array([name=HeapSize, ID=1, description=The total memory (in KBytes) in the Java virtual machine run time., unit=KILOBYTE, type=BoundedRangeStatistic, lowWaterMark=262144, highWaterMark=524288, current=523264, integral=7.8067724096E10, lowerBound=262144, upperBound=524288,
name=FreeMemory, ID=2, description=The free memory (in KBytes) in the Java virtual machine run time., unit=KILOBYTE, type=CountStatistic, count=89475,
name=UsedMemory, ID=3, description=The amount of used memory (in KBytes) in the Java virtual machine run time., unit=KILOBYTE, type=CountStatistic, count=433788,
name=UpTime, ID=4, description=The amount of time (in seconds) that the Java virtual machine has been running., unit=SECOND, type=CountStatistic, count=2421377,
name=ProcessCpuUsage, ID=5, description=The CPU Usage (in percent) of the Java virtual machine., unit=N/A, type=CountStatistic, count=0], com.ibm.ws.pmi.stat.StatisticImpl)
我希望所有这些都returned。
不太熟悉这个领域,但我看到了一些要看的东西:
1) 其中一些统计信息仅在启用 JVM 分析时可用,(如 here). E.g. add a generic JVM argument: -agentlib:pmiJvmtiProfiler
. See the instructions here 在管理控制台中执行此操作的位置所述。
2) JVM 统计数据嵌套在树结构中(参见 here),因此您可以添加此行:
print jvmObj.getSubStats()
查看嵌套统计信息。如果你在管理控制台中进入 PMI->server 然后点击 Custom link 你也可以看到这个结构面板以获得显示所有 PMI 设置的树型控件。
3) 当然,您必须启用 PMI 统计信息(来自 PMI->server 等),但我猜您已经这样做了。
除了 Scott 的回答之外,还可以根据启用的 PMI 级别提供不同的统计信息。请在此处查看 JVM 计数器的 "Level" 列:https://www.ibm.com/support/knowledgecenter/en/SSAW57_9.0.5/com.ibm.websphere.nd.multiplatform.doc/ae/rprf_datacounter4.html
一般来说,最好使用 "Custom" 级别并准确配置您想要的指标以获得最佳性能。