Repost: [SNMP4J] Problem receiving traps

Noel Grandin noel at peralex.com
Mon Apr 18 08:51:42 CEST 2005


Your code looks fine, the only thing I can suggest now is too enable the SNMP logging and see if it complains about 
anything.

import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.snmp4j.log.Log4jLogFactory;
import org.snmp4j.log.LogFactory;

...

// SNMP logging
LogFactory.setLogFactory(new Log4jLogFactory());
Logger.getRootLogger().setLevel(Level.DEBUG);


Mauricio Reyes wrote:
> 
> Hello Noel,
> 
> I have tested the SNMP4J tool without any modification, configured to 
> listen to traps from the snmpd demon, printed to the console. And it 
> works fine. The traps are received as expected. But in my application it 
> stops receiving. Basically I build a class that launches two threads one 
> to send and another to listen form traps. What the class does is do some 
> calculations and draw some information in a JFrame. I don't know if this 
> is why it stops working. The run method in the thread is like this:
> 
> public void run()
>  {
>    try
>    {
>        if (operation == LISTEN)
>        {
>          listen();
>        }
>    }
>    catch (IOException ex)
>    {
>        System.err.println("Error escuchando solicitud Traps: " + 
> ex.getMessage());
>        ex.printStackTrace();
>    }
>  }
> 
> I just call the listen method as in the SnmpRequest file. Would all the 
> code help?
> 
> I haven't been able to trace the error. What could change from using 
> this in a thread and using it as in SnmpRequest?
> 
> Thanks.
> Mauricio
> 
>> From: Noel Grandin <noel at peralex.com>
>> To: Mauricio Reyes <maure5 at hotmail.com>
>> CC: snmp4j at agentpp.org
>> Subject: Re: Repost: [SNMP4J] Problem receiving traps
>> Date: Fri, 15 Apr 2005 07:58:34 +0200
>>
>>
>> Try running ethereal and capturing packets to trace the activity.
>>
>> Mauricio Reyes wrote:
>>
>>>
>>> Hello,
>>>
>>> I don't think the thread dies. Because when I shut down the snmpd 
>>> demon and bring it up again I start to receive traps again. It seems 
>>> to receive only 4 traps and then stops receiving.
>>>
>>> I have no idea what's happening.
>>>
>>>> From: Noel Grandin <noel at peralex.com>
>>>> To: Mauricio Reyes <maure5 at hotmail.com>
>>>> CC: snmp4j at agentpp.org
>>>> Subject: Re: Repost: [SNMP4J] Problem receiving traps
>>>> Date: Thu, 14 Apr 2005 08:18:24 +0200
>>>>
>>>> Maybe the thread died?
>>>>
>>>> If you are running an older JDK you may not see the stack trace if 
>>>> something goes wrong.
>>>> In newer JDKs you can install an "uncaught exception handler" on a 
>>>> Thread.
>>>>
>>>> Mauricio Reyes wrote:
>>>>
>>>>>
>>>>> Hello,
>>>>>
>>>>> The problem keeps on going. Can anyone help me?
>>>>>
>>>>> Thanks a lot.
>>>>>
>>>>>> From: "Mauricio Reyes" <maure5 at hotmail.com>
>>>>>> To: snmp4j at agentpp.org
>>>>>> Subject: [SNMP4J] Problem receiving traps
>>>>>> Date: Sun, 10 Apr 2005 22:04:55 +0000
>>>>>>
>>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I've been having some trouble receiving traps from net-snmp. The 
>>>>>> sitiuation is like this: the snmpd demon registers an alarm to 
>>>>>> send a trap every 60 seconds, and it works fine (snmptrapd 
>>>>>> receives the traps every minute). The thing is that SNMP4J 
>>>>>> recieves two traps and then it seems to stop receiveing traps. I 
>>>>>> don't know why this happens. I'm running a thread that is in 
>>>>>> charge of receiving the traps.
>>>>>>
>>>>>> Thanks a lot for your collaboration.
>>>>>>
>>>>>> Mauricio.
>>>>>>
>>>>>> _________________________________________________________________
>>>>>> Express yourself instantly with MSN Messenger! Download today it's 
>>>>>> FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>>>>>>
>>>>>> _______________________________________________
>>>>>> SNMP4J mailing list
>>>>>> SNMP4J at agentpp.org
>>>>>> http://lists.agentpp.org/mailman/listinfo/snmp4j
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _________________________________________________________________
>>>>> Express yourself instantly with MSN Messenger! Download today it's 
>>>>> FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>>>>>
>>>>> _______________________________________________
>>>>> SNMP4J mailing list
>>>>> SNMP4J at agentpp.org
>>>>> http://lists.agentpp.org/mailman/listinfo/snmp4j
>>>>>
>>>>
>>>>
>>>> NOTICE: Please note that this email, and the contents thereof, are 
>>>> subject to the standard Peralex email disclaimer, which may be found 
>>>> at: http://www.peralex.com/disclaimer.html
>>>>
>>>> If you cannot access the disclaimer through the URL attached and you 
>>>> wish to receive a copy thereof please send an email to 
>>>> email at peralex.com
>>>
>>>
>>>
>>> _________________________________________________________________
>>> Don't just search. Find. Check out the new MSN Search! 
>>> http://search.msn.click-url.com/go/onm00200636ave/direct/01/
>>>
>>>
>>
>>
>> NOTICE: Please note that this email, and the contents thereof, are 
>> subject to the standard Peralex email disclaimer, which may be found 
>> at: http://www.peralex.com/disclaimer.html
>>
>> If you cannot access the disclaimer through the URL attached and you 
>> wish to receive a copy thereof please send an email to email at peralex.com
> 
> 
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today it's FREE! 
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> 
> 


NOTICE: Please note that this email, and the contents thereof, 
are subject to the standard Peralex email disclaimer, which may 
be found at: http://www.peralex.com/disclaimer.html

If you cannot access the disclaimer through the URL attached 
 and you wish to receive a copy thereof please send 
 an email to email at peralex.com


More information about the SNMP4J mailing list