使用SNMP监视JVM [英] Monitoring a JVM with SNMP
问题描述
我正在使用snmp监视某些服务器(主要是win2k3),并且在上网过程中,我发现Oracle制作了一个MIB,用于监视JVM-JVM-MANAGEMENT-MIB.到目前为止,我要做的是:
I'm using snmp to monitore some servers (win2k3 mostly) and during my journey on internet, I found a MIB done by Oracle for monitoring a JVM, JVM-MANAGEMENT-MIB. What I did so far to use it is :
- 使用snmp.acl和management.properties配置JVM
- 用mibcc编译JVM-MANAGEMENT-MIB并替换mib.bin.
通过这些步骤,我认为我很好尝试.所以我用snmp4j编写了一个Java程序,当我尝试从JVM mib调用OID时,出现了错误Request timed out
.
奇怪的是,我只编译JVM-MANAGEMENT-MIB,所以我应该只能访问那些OID,对吗?但事实并非如此,我仍然可以使用cpu的使用情况,进程数...
With those steps, I think I'm good to try. So I made a java program with snmp4j and when I try to call an OID from the JVM mib, I have got an error Request timed out
.
The weird part is, I only compile the JVM-MANAGEMENT-MIB so I should have access to only those OIDs, right ? But it's not the case, I still have access to cpu usage, number of process...
那我想念什么?谢谢
推荐答案
将以下三个参数添加到JVM,它应该是您所需要的.
Add the following three parameters to the JVM and it should be all you need.
-Dcom.sun.management.snmp.interface=127.0.0.1 \
-Dcom.sun.management.snmp.acl=false \
-Dcom.sun.management.snmp.port=16500 \
好吧,您无需编写Java程序即可验证其是否有效. net-snmp或某些MIB浏览器就足够了.
Well and you do not need to write a java program to verify if it works. net-snmp or some MIB browser is enough.
snmpwalk -v2c -c public 127.0.0.1:16500 SNMPv2-SMI::enterprises.42.2.145.3.163.1.1.4
SNMPv2-SMI::enterprises.42.2.145.3.163.1.1.4.2.0 = STRING: "Java HotSpot(TM) 64-Bit Server VM"
SNMPv2-SMI::enterprises.42.2.145.3.163.1.1.4.3.0 = STRING: "Sun Microsystems Inc."
SNMPv2-SMI::enterprises.42.2.145.3.163.1.1.4.4.0 = STRING: "20.10-b01"
SNMPv2-SMI::enterprises.42.2.145.3.163.1.1.4.5.0 = STRING: "Java Virtual Machine Specification"
SNMPv2-SMI::enterprises.42.2.145.3.163.1.1.4.6.0 = STRING: "Sun Microsystems Inc."
这篇关于使用SNMP监视JVM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!