[snmp] Problem: SNMP application with different versions.
Birgit Arkesteijn
birgit at westhawk.co.uk
Mon Oct 29 12:13:41 GMT 2007
Hi Vijay,
Your snippet of code seems fine.
Also, since you manage to send v1 and v2 traps, it seems that the
implementation of SNMPClienV1 and SNMPClientV2 is fine.
The fact that the first item in the list determines what goes for the
life of your application, indicates (to me) that the problem is within
SNMPFactory.getSNMPFactory(list.get(i));
I would try printing out
- list.get(i) and
- snmpcilent
to confirm my suspicion and take a closer look at
SNMPFactory.getSNMPFactory().
Cheers, Birgit
On 29/10/07 11:47, Vijay Gholap wrote:
>
> Hi all,
>
> I have a list (ArrayList) contains the snmp parameters. I have created
> one factory class which will return the reference of passed version. i.e. if
> i passed version 1, it will return me reference of class which has a logic
> of sending trap of version 1. I have iterated list and sent the trap for
> the list data.
>
> for(i=0;i<list.size();i++){
> ISNMPClient snmpcilent =SNMPFactory.getSNMPFactory(list.get(i));
> snmpcilent.setManagerConfig(manager);
> snmpcilent.sendTrap(pdu);
> }
>
> ISNMPClient is interface implemented by two classes...
> 1. SNMPClienV1
> 2. SNMPClientV2
>
> which has a logic of sending snmp v1 and v2 trap respectively.
> SNMPFactory returns the reference of one of above class... i.e if i pass
> version=1; it will give me reference of SNMPClientV1 class.
>
> My problem is....
>
> If my list contains the first data is version1... it sends the trap only for
> version 1.. but not for version2.
> and if my list contains first snmp version 2 data.. then its sends only snmp
> 2 related trap.
>
>
> Suppose if my list is like this...
> list[1,1,2,1,2] .... i.e contains the snmp version of which i want to send a
> trap.
> Then,
> My application send the trap of SNMPClientV1 only but not SNMPClientV2..
> If my list is like this...
> list[2,1,2,1,2] ...
> Then,
> My application send the trap of SNMPClientV2 only but not SNMPClientV1..
>
> As per my observation.. application sending trap for the version which is
> the first version in list.
>
>
> So please help me out ....
>
> Thanks,
> Vijay Gholap.
--
-- Birgit Arkesteijn, birgit at westhawk.co.uk,
-- Westhawk Ltd, Albion Wharf, 19 Albion Street, Manchester M1 5LN, UK
-- Company no: 1769350
-- Registered Office:
-- 15 London Road, Stockton Heath, Warrington WA4 6SJ. UK.
-- tel.: +44 (0)161 237 0660
-- <URL: http://www.westhawk.co.uk>
More information about the snmp
mailing list