This is useful to do when you are wishing to monitor the Memory allocation with in your java application.
HowTo
-
Add the following to JVM_OPTS
-Dcom.sun.management.config.file=/export/home/pcanham/jvmsnmp/management.properties
-
Contents of management.properties is
com.sun.management.snmp.interface=0.0.0.0 com.sun.management.snmp.port=1161 com.sun.management.snmp.trap=1162 com.sun.management.snmp.acl=false
-
If wishing ACL create a file called snmp.acl and the change ‘com.sun.management.snmp.acl=false’ to ‘com.sun.management.snmp.acl=snmp.acl’
-
Make sure only owner has read and write access nobody and group are not allowed any access
-rw------- 1 pcanham other 356 Aug 8 16:01 snmp.acl
-
Contents of snmp.acl
acl = { { communities = public, private access = read-only managers = localhost } } # Traps are sent to localhost only trap = { { trap-community = public hosts = localhost } }
MIB
Useful MIBs
jvmMemoryHeapUsed
.1.3.6.1.4.1.42.2.145.3.163.1.1.2.11
jvmMemoryHeapCommitted
.1.3.6.1.4.1.42.2.145.3.163.1.1.2.12
jvmMemoryHeapMaxSize
.1.3.6.1.4.1.42.2.145.3.163.1.1.2.13
jvmMemoryNonHeapUsed
.1.3.6.1.4.1.42.2.145.3.163.1.1.2.21
jvmMemoryNonHeapCommited
.1.3.6.1.4.1.42.2.145.3.163.1.1.2.22
jvmMemoryNonHeapMaxSize
.1.3.6.1.4.1.42.2.145.3.163.1.1.2.23
jvmThreadCount
#.1.3.6.1.4.1.42.2.145.3.163.1.1.3.1
jvmMemPoolName
.1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.2
jvmMemPoolUsed
.1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.11
jvmMemPoolCommitted
.1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.12
jvmMemPoolMaxSize
.1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.13