Skip to main content

Not able to generate and recieve JVM snmp traps

No replies
raosaabh
Offline
Joined: 2010-05-25
Points: 0

Hi,

I want JVM instance to generate SNMP trap.

For this i have followed following steps:-

1)I eanbled SNMP agent in JVM,to enable SNMP agent i set following system properties:

->In management.properties file present in /jre/lib/management following properties are set

com.sun.management.snmp.trap=162

com.sun.management.snmp.acl=true

com.sun.management.snmp.acl.file=/opt/jdk/jre/lib/management/snmp.acl

com.sun.management.jmxremote.authenticate=false

->snmp.acl file is created in /jre/lib/management with following content

acl = {

{

communities = public, private

access = read-write

managers = 127.0.0.1

}

}

trap = {

{

trap-community = public

hosts = 127.0.0.1

}

{

trap-community = private

hosts = 127.0.0.1

}

}

->Now i created a program in eclipse which is

public class JVMTraps {

public static void main(String[] args){

List<Object> list = new ArrayList<Object>();

while(true){

list.add(new Object());

System.out.println("Object added to list");

}

}

}

->I also set JVM argument which is -Dcom.sun.management.snmp.port=161

Now when i run this program,according to me snmp agent should get enabled and when this program throwsjava.lang.OutOfMemoryError: Java heap space,JVM should generate a trap present in its MIB file but it does not.

For recieving traps i am using a trap viewer configured to listen at port 161 in my localsystem at address 127.0.0.1

I even tried to send a get request to SNMP agent but result is not good ,when i send get request following response is recieved:

Request Failed: Get Response PDU received from 127.0.0.1 Error Indication in response: There is no such instance in this MIB. Object ID: .1.3.6.1.4.1.42.2.145.3.163.1.1.2.13 NULLOBJ: NULL

Please please help me out in generating jvm traps,tell me what i m missing in it.

Thankyou