From brian.jewell at modius.com Tue Aug 21 11:36:17 2007 From: brian.jewell at modius.com (Brian Jewell) Date: Wed Aug 22 10:45:53 2007 Subject: [snmp] SnmpContest question Message-ID: Hi, I'm having a little trouble understanding the use of SnmpContexts and SnmpContextPool's. 1) When sending GET requests to the same host, is it correct to call "new SnmpContextPool()" to retrieve a context each time a PDU is to be sent? 2) If an SnmpContext is created for receiving traps, and a trap listener is added with SnmpContest context = new SnmpContext(.); context.addListener(.); When I wish to stop receiving traps from a specified host, do I need to call removeTrapListener() using the *same* context (as I used for calling addListener(), or is it ok to create a *new* SnmpContext (with the same properties) and use it for calling removeTrapListener()? Thanks for your help. --Brian From birgit at westhawk.co.uk Wed Aug 22 12:07:18 2007 From: birgit at westhawk.co.uk (Birgit Arkesteijn) Date: Wed Aug 22 11:08:34 2007 Subject: [snmp] SnmpContext question In-Reply-To: References: Message-ID: <46CC0AD6.8030306@westhawk.co.uk> Hi Brian, On 21/08/07 18:36, Brian Jewell wrote: > Hi, > > I'm having a little trouble understanding the use of SnmpContexts and > SnmpContextPool's. > > 1) When sending GET requests to the same host, is it correct to call "new > SnmpContextPool()" to retrieve a context each time a PDU is to be sent? That is correct. See uk.co.westhawk.examplev2c.set_one.createContext(..) > 2) If an SnmpContext is created for receiving traps, and a trap listener is > added with > > SnmpContext context = new SnmpContext(.); > context.addListener(.); > > > When I wish to stop receiving traps from a specified host, do I need to call > removeTrapListener() using the *same* context (as I used for calling > addListener(), or is it ok to create a *new* SnmpContext (with the same > properties) and use it for calling removeTrapListener()? You'll have to use the *same* context, since the listener is associated with that context (and that context only). *new* SnmpContext won't do the trick. > > Thanks for your help. > > --Brian Cheers, Birgit -- -- Birgit Arkesteijn, birgit@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 -- From brian.jewell at modius.com Wed Aug 22 08:44:10 2007 From: brian.jewell at modius.com (Brian Jewell) Date: Wed Aug 22 15:47:19 2007 Subject: [snmp] SnmpContext question In-Reply-To: <46CC0AD6.8030306@westhawk.co.uk> Message-ID: Birgit, Thank you for your response. --Brian -----Original Message----- From: snmp-bounces@snmp.westhawk.co.uk [mailto:snmp-bounces@snmp.westhawk.co.uk] On Behalf Of Birgit Arkesteijn Sent: Wednesday, August 22, 2007 3:07 AM To: List for discussion of the Westhawk SNMP stack Subject: Re: [snmp] SnmpContext question Hi Brian, On 21/08/07 18:36, Brian Jewell wrote: > Hi, > > I'm having a little trouble understanding the use of SnmpContexts and > SnmpContextPool's. > > 1) When sending GET requests to the same host, is it correct to call "new > SnmpContextPool()" to retrieve a context each time a PDU is to be sent? That is correct. See uk.co.westhawk.examplev2c.set_one.createContext(..) > 2) If an SnmpContext is created for receiving traps, and a trap listener is > added with > > SnmpContext context = new SnmpContext(.); > context.addListener(.); > > > When I wish to stop receiving traps from a specified host, do I need to call > removeTrapListener() using the *same* context (as I used for calling > addListener(), or is it ok to create a *new* SnmpContext (with the same > properties) and use it for calling removeTrapListener()? You'll have to use the *same* context, since the listener is associated with that context (and that context only). *new* SnmpContext won't do the trick. > > Thanks for your help. > > --Brian Cheers, Birgit -- -- Birgit Arkesteijn, birgit@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 -- _______________________________________________ snmp mailing list snmp@snmp.westhawk.co.uk http://snmp.westhawk.co.uk/mailman/listinfo/snmp From brian.jewell at modius.com Wed Aug 22 12:07:04 2007 From: brian.jewell at modius.com (Brian Jewell) Date: Thu Aug 23 10:30:03 2007 Subject: [snmp] SnmpContext question In-Reply-To: <46CC0AD6.8030306@westhawk.co.uk> Message-ID: Birgit, A couple more questions regarding Contexts vs. Context Pools... In an application that listens for SNMP traps, I'm trying to understand the difference between instantiating individual Contexts (i.e., "new SnmpContextv2c()") as opposed to using the Context Pool. Does using the ListeningContextPool relieve me of the overhead of keeping track of the contexts that are created? In other words, if I want to create a context to listen for traps, and later I want to "turn off" trap listening by calling removeTrapListener(), does using ListeningContextPool somehow associate the context that was created with the instance of the class that created it? Both approaches ("new SnmpContextv2c()" and "new ListeningContextPool()") seemed to be used in the sample ReceiveTrap.java, so I'm a little confused about which approach is best. Thanks again for your help. --Brian -----Original Message----- From: snmp-bounces@snmp.westhawk.co.uk [mailto:snmp-bounces@snmp.westhawk.co.uk] On Behalf Of Birgit Arkesteijn Sent: Wednesday, August 22, 2007 3:07 AM To: List for discussion of the Westhawk SNMP stack Subject: Re: [snmp] SnmpContext question Hi Brian, On 21/08/07 18:36, Brian Jewell wrote: > Hi, > > I'm having a little trouble understanding the use of SnmpContexts and > SnmpContextPool's. > > 1) When sending GET requests to the same host, is it correct to call "new > SnmpContextPool()" to retrieve a context each time a PDU is to be sent? That is correct. See uk.co.westhawk.examplev2c.set_one.createContext(..) > 2) If an SnmpContext is created for receiving traps, and a trap listener is > added with > > SnmpContext context = new SnmpContext(.); > context.addListener(.); > > > When I wish to stop receiving traps from a specified host, do I need to call > removeTrapListener() using the *same* context (as I used for calling > addListener(), or is it ok to create a *new* SnmpContext (with the same > properties) and use it for calling removeTrapListener()? You'll have to use the *same* context, since the listener is associated with that context (and that context only). *new* SnmpContext won't do the trick. > > Thanks for your help. > > --Brian Cheers, Birgit -- -- Birgit Arkesteijn, birgit@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 -- _______________________________________________ snmp mailing list snmp@snmp.westhawk.co.uk http://snmp.westhawk.co.uk/mailman/listinfo/snmp From birgit at westhawk.co.uk Thu Aug 23 12:16:32 2007 From: birgit at westhawk.co.uk (Birgit Arkesteijn) Date: Thu Aug 23 11:17:48 2007 Subject: [snmp] SnmpContext question In-Reply-To: References: Message-ID: <46CD5E80.7050205@westhawk.co.uk> Hi Brian, It depends a bit on your needs whether to go via a SnmpContext or use ListeningContextPool straight away. If you want the stack to decode your trap, you need a SnmpContext and add a listener to it. If you want to handle all incoming (undecoded or raw) traps yourself, you use the later class. There is a section in the StackUsage document (StackUsage.html) that explains how to listen for incoming traps. The document is part of the distribution zip. Hopefully it answers most of your questions below. We've had questions before in the mailing list regarding decoding traps. The google search box in page http://snmp.westhawk.co.uk/index.html should help you find them. Cheers, Birgit On 22/08/07 19:07, Brian Jewell wrote: > Birgit, > > A couple more questions regarding Contexts vs. Context Pools... > > In an application that listens for SNMP traps, I'm trying to understand the > difference between instantiating individual Contexts (i.e., "new > SnmpContextv2c()") as opposed to using the Context Pool. > > Does using the ListeningContextPool relieve me of the overhead of keeping > track of the contexts that are created? > > In other words, if I want to create a context to listen for traps, and later > I want to "turn off" trap listening by calling removeTrapListener(), does > using ListeningContextPool somehow associate the context that was created > with the instance of the class that created it? > > Both approaches ("new SnmpContextv2c()" and "new ListeningContextPool()") > seemed to be used in the sample ReceiveTrap.java, so I'm a little confused > about which approach is best. > > Thanks again for your help. > > --Brian -- -- Birgit Arkesteijn, birgit@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 -- From brian.jewell at modius.com Wed Aug 29 15:54:33 2007 From: brian.jewell at modius.com (Brian Jewell) Date: Thu Aug 30 07:59:20 2007 Subject: [snmp] SNMP V2 Traps Message-ID: Hi, I just wondered if you are familiar with an effective means of processing SNMP V2 traps? With V1 traps the "Enterprise" field, which contains an OID, can be used to associate a trap with a MIB definition. The TrapPduv1.getEnterprise() method will obtain this OID. However, with an SNMP V2 trap, there is no Enterprise field, and no TrapPduv2 methods available (as far as I can tell) to somehow identify which trap in a MIB has been received. I was wondering if you are familiar with a common approach for solving the issue? Thanks in advance for your help. --Brian From birgit at westhawk.co.uk Thu Aug 30 12:33:48 2007 From: birgit at westhawk.co.uk (Birgit Arkesteijn) Date: Thu Aug 30 11:35:05 2007 Subject: [snmp] SNMP V2 Traps In-Reply-To: References: Message-ID: <46D69D0C.1030006@westhawk.co.uk> Hi Brian, In Trapv2 the notifications are part of the varbind list. Have a look at the javadoc for uk.co.westhawk.snmp.stack.TrapPduv2 Reading http://www.ietf.org/rfc/rfc3418.txt, I think that the Enterprise field in Trapv1 corresponds with the (optional?) snmpTrapEnterprise OID in the varbind list of Trapv2. The description says: "The authoritative identification of the enterprise associated with the trap currently being sent. When an SNMP proxy agent is mapping an RFC1157 Trap-PDU into a SNMPv2-Trap-PDU, this variable occurs as the last varbind." See also "4.2.6. The SNMPv2-Trap-PDU" of http://www.ietf.org/rfc/rfc3416.txt I hope this helps. Cheers, Birgit On 29/08/07 22:54, Brian Jewell wrote: > Hi, > > > > I just wondered if you are familiar with an effective means of processing > SNMP V2 traps? > > > > With V1 traps the "Enterprise" field, which contains an OID, can be used to > associate a trap with a MIB definition. The TrapPduv1.getEnterprise() method > will obtain this OID. > > > > However, with an SNMP V2 trap, there is no Enterprise field, and no > TrapPduv2 methods available (as far as I can tell) to somehow identify which > trap in a MIB has been received. > > > > I was wondering if you are familiar with a common approach for solving the > issue? > > > > Thanks in advance for your help. > > > > --Brian > > _______________________________________________ > snmp mailing list > snmp@snmp.westhawk.co.uk > http://snmp.westhawk.co.uk/mailman/listinfo/snmp -- -- Birgit Arkesteijn, birgit@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 -- From brian.jewell at modius.com Thu Aug 30 08:41:38 2007 From: brian.jewell at modius.com (Brian Jewell) Date: Thu Aug 30 15:44:52 2007 Subject: [snmp] SNMP V2 Traps In-Reply-To: <46D69D0C.1030006@westhawk.co.uk> Message-ID: Birgit, Thanks again for your help. --Brian -----Original Message----- From: snmp-bounces@snmp.westhawk.co.uk [mailto:snmp-bounces@snmp.westhawk.co.uk] On Behalf Of Birgit Arkesteijn Sent: Thursday, August 30, 2007 3:34 AM To: List for discussion of the Westhawk SNMP stack Subject: Re: [snmp] SNMP V2 Traps Hi Brian, In Trapv2 the notifications are part of the varbind list. Have a look at the javadoc for uk.co.westhawk.snmp.stack.TrapPduv2 Reading http://www.ietf.org/rfc/rfc3418.txt, I think that the Enterprise field in Trapv1 corresponds with the (optional?) snmpTrapEnterprise OID in the varbind list of Trapv2. The description says: "The authoritative identification of the enterprise associated with the trap currently being sent. When an SNMP proxy agent is mapping an RFC1157 Trap-PDU into a SNMPv2-Trap-PDU, this variable occurs as the last varbind." See also "4.2.6. The SNMPv2-Trap-PDU" of http://www.ietf.org/rfc/rfc3416.txt I hope this helps. Cheers, Birgit On 29/08/07 22:54, Brian Jewell wrote: > Hi, > > > > I just wondered if you are familiar with an effective means of processing > SNMP V2 traps? > > > > With V1 traps the "Enterprise" field, which contains an OID, can be used to > associate a trap with a MIB definition. The TrapPduv1.getEnterprise() method > will obtain this OID. > > > > However, with an SNMP V2 trap, there is no Enterprise field, and no > TrapPduv2 methods available (as far as I can tell) to somehow identify which > trap in a MIB has been received. > > > > I was wondering if you are familiar with a common approach for solving the > issue? > > > > Thanks in advance for your help. > > > > --Brian > > _______________________________________________ > snmp mailing list > snmp@snmp.westhawk.co.uk > http://snmp.westhawk.co.uk/mailman/listinfo/snmp -- -- Birgit Arkesteijn, birgit@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 -- _______________________________________________ snmp mailing list snmp@snmp.westhawk.co.uk http://snmp.westhawk.co.uk/mailman/listinfo/snmp