问题
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 :
- Configure the JVM with snmp.acl and management.properties
- Compile the JVM-MANAGEMENT-MIB with mibcc and replace the mib.bin.
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...
So what did I miss ? Thanks
回答1:
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 \
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."
来源:https://stackoverflow.com/questions/15519673/monitoring-a-jvm-with-snmp