pysnmp-users Mailing List for SNMP library for Python
Brought to you by:
elie
You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(2) |
Sep
(3) |
Oct
(2) |
Nov
(4) |
Dec
(4) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
|
Feb
(3) |
Mar
(16) |
Apr
(3) |
May
(6) |
Jun
|
Jul
(7) |
Aug
(12) |
Sep
(4) |
Oct
(2) |
Nov
(11) |
Dec
(6) |
| 2004 |
Jan
(1) |
Feb
(41) |
Mar
(4) |
Apr
(1) |
May
(6) |
Jun
|
Jul
(8) |
Aug
(5) |
Sep
(8) |
Oct
(10) |
Nov
(3) |
Dec
(1) |
| 2005 |
Jan
|
Feb
(4) |
Mar
(8) |
Apr
(4) |
May
(10) |
Jun
(5) |
Jul
(10) |
Aug
(6) |
Sep
(6) |
Oct
(39) |
Nov
(20) |
Dec
(21) |
| 2006 |
Jan
(14) |
Feb
(6) |
Mar
(15) |
Apr
|
May
(5) |
Jun
(16) |
Jul
(16) |
Aug
(18) |
Sep
(35) |
Oct
(12) |
Nov
(3) |
Dec
(3) |
| 2007 |
Jan
(12) |
Feb
(19) |
Mar
(27) |
Apr
(14) |
May
(32) |
Jun
|
Jul
(35) |
Aug
(11) |
Sep
(11) |
Oct
(6) |
Nov
(13) |
Dec
(4) |
| 2008 |
Jan
(7) |
Feb
(4) |
Mar
(2) |
Apr
(3) |
May
(3) |
Jun
(5) |
Jul
(5) |
Aug
(1) |
Sep
(2) |
Oct
(3) |
Nov
(19) |
Dec
(7) |
| 2009 |
Jan
(2) |
Feb
(2) |
Mar
(12) |
Apr
(16) |
May
(16) |
Jun
(23) |
Jul
(7) |
Aug
(2) |
Sep
(17) |
Oct
(20) |
Nov
(20) |
Dec
(5) |
| 2010 |
Jan
(11) |
Feb
(17) |
Mar
(20) |
Apr
(7) |
May
(6) |
Jun
(14) |
Jul
(5) |
Aug
(10) |
Sep
(23) |
Oct
(16) |
Nov
(32) |
Dec
(21) |
| 2011 |
Jan
(6) |
Feb
(11) |
Mar
(3) |
Apr
(1) |
May
(4) |
Jun
(1) |
Jul
(4) |
Aug
(8) |
Sep
(20) |
Oct
(9) |
Nov
(29) |
Dec
(25) |
| 2012 |
Jan
(2) |
Feb
(5) |
Mar
(2) |
Apr
(22) |
May
(21) |
Jun
(7) |
Jul
(6) |
Aug
(2) |
Sep
(12) |
Oct
(20) |
Nov
(17) |
Dec
(17) |
| 2013 |
Jan
(4) |
Feb
(4) |
Mar
(8) |
Apr
(8) |
May
(10) |
Jun
(2) |
Jul
(23) |
Aug
(12) |
Sep
(14) |
Oct
(12) |
Nov
(4) |
Dec
(18) |
| 2014 |
Jan
(2) |
Feb
(7) |
Mar
(3) |
Apr
(8) |
May
(7) |
Jun
(1) |
Jul
(5) |
Aug
(2) |
Sep
(8) |
Oct
|
Nov
(2) |
Dec
(1) |
| 2015 |
Jan
(3) |
Feb
(15) |
Mar
(14) |
Apr
(4) |
May
(6) |
Jun
(3) |
Jul
(1) |
Aug
(6) |
Sep
(5) |
Oct
(21) |
Nov
(43) |
Dec
(10) |
| 2016 |
Jan
|
Feb
(2) |
Mar
(6) |
Apr
(4) |
May
(6) |
Jun
(2) |
Jul
(6) |
Aug
(5) |
Sep
(4) |
Oct
|
Nov
(3) |
Dec
(11) |
| 2017 |
Jan
(1) |
Feb
(8) |
Mar
|
Apr
(7) |
May
|
Jun
|
Jul
(5) |
Aug
|
Sep
(9) |
Oct
(8) |
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
1
|
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
|
9
|
10
|
11
|
12
(1) |
13
(1) |
14
|
15
|
|
16
|
17
|
18
|
19
|
20
|
21
|
22
|
|
23
|
24
|
25
|
26
|
27
|
28
(2) |
29
(2) |
|
30
|
31
|
|
|
|
|
|
|
From: Casey M. <cmc...@ak...> - 2010-05-29 08:58:42
|
On 05/28/2010 08:03 PM, Ilya Etingof wrote: > >>> Agent will return a value (ManagedObjectInstance.syntax) bound to >>> particular OID (MibObjectInstance.name). Both are passed to object >>> constructor and can't be changed. You can bind only one value to >>> each OID. >> >> If you can bind only one value to each OID, does that mean when you >> load a MIB definition, the OID is now bound? > > Whenever you do exportSymbols() for MibScalar((1,2,3), syntax) and > then for MibScalarInstance((1,2,3,4), value), the latter will be > automatically bound to the former by pysnmp/smi/instrum.py code. > Typical pysnmp MIB module calls exportSymbols() for all its objects. > > Here's how pysnmp Agent indexes its Managed Objects: > > # MibTree > # | > # +----MibScalar > # | | > # | +-----MibScalarInstance > # | > # +----MibTable > # | > # +----MibTableRow > # | > # +-------MibTableColumn > # | > # +------MibScalarInstance(s) > >> Then if you want to modify the OID, you have to use the >> unexportSymbols(), or unexportModules(), to first unbind the old >> ManagedObjectInstance.syntax? > > What exactly do you mean saying 'modify an OID'? > > If you need to replace one OID+value for another OID+value, then - > yes. You have to unexport the old and export the new one. > > If you need to change a value (not type) associated with OID, you are > supposed to overload syntax.clone() method so that it would return new > object instance holding new value. > > If you are going to change the syntax (e.g. type associated with > OID) -- well, technically, that can be done without unexport/unload > calls by just changing MibObjectInstance.syntax. However, I do not > think you should do that, as ManagedObjects never change types of > their associated values (e.g. syntax). > > If you describe your goal in more details, I may be able to come up > with better suggestion. > > -ilya Ok, got the OID data working. I made some progress after I sent the last e-mail. Part of my problem was that I was getting authorization errors due to a bad change I made a while back. |
|
From: Ilya E. <il...@gl...> - 2010-05-29 06:03:50
|
>> Agent will return a value (ManagedObjectInstance.syntax) bound to
>> particular OID (MibObjectInstance.name). Both are passed to object
>> constructor and can't be changed. You can bind only one value to each OID.
>
> If you can bind only one value to each OID, does that mean when you load a
> MIB definition, the OID is now bound?
Whenever you do exportSymbols() for MibScalar((1,2,3), syntax) and then
for MibScalarInstance((1,2,3,4), value), the latter will be
automatically bound to the former by pysnmp/smi/instrum.py code. Typical
pysnmp MIB module calls exportSymbols() for all its objects.
Here's how pysnmp Agent indexes its Managed Objects:
# MibTree
# |
# +----MibScalar
# | |
# | +-----MibScalarInstance
# |
# +----MibTable
# |
# +----MibTableRow
# |
# +-------MibTableColumn
# |
# +------MibScalarInstance(s)
> Then if you want to modify the OID, you have to use the unexportSymbols(), or
> unexportModules(), to first unbind the old ManagedObjectInstance.syntax?
What exactly do you mean saying 'modify an OID'?
If you need to replace one OID+value for another OID+value, then - yes.
You have to unexport the old and export the new one.
If you need to change a value (not type) associated with OID, you are
supposed to overload syntax.clone() method so that it would return new
object instance holding new value.
If you are going to change the syntax (e.g. type associated with
OID) -- well, technically, that can be done without unexport/unload calls
by just changing MibObjectInstance.syntax. However, I do not think you
should do that, as ManagedObjects never change types of their
associated values (e.g. syntax).
If you describe your goal in more details, I may be able to come up with
better suggestion.
-ilya
|
|
From: Casey M. <cmc...@ak...> - 2010-05-28 21:33:05
|
On 05/28/2010 09:35 AM, Casey McGinty wrote: > > >> more than once, how does the Agent decide which value to use in the >> response? Sorry if this is not really clear. >> > Agent will return a value (ManagedObjectInstance.syntax) bound to > particular OID (MibObjectInstance.name). Both are passed to object > constructor and can't be changed. You can bind only one value to each OID. > > If you can bind only one value to each OID, does that mean when you load a MIB definition, the OID is now bound? Then if you want to modify the OID, you have to use the unexportSymbols(), or unexportModules(), to first unbind the old ManagedObjectInstance.syntax? |
|
From: Casey M. <cmc...@ak...> - 2010-05-28 19:59:11
|
> I have a third party MIB that I want to implement on the Agent side. So what > is the best way to do that after importing into pySNMP? I have already > converted it using the smidump tool. Good. So you now have your MIB in a pysnmp-native form (SOME-MIB.py), right? > I'm trying to follow the example code as best as I can, from > http://pysnmp.sourceforge.net/examples/4.x/v3arch/agent/cmdrsp.html This is a valid method but it makes more sense in cases when your Managed Objects (agent-side MIB implementation) is highly dynamic. Meaning they are created/deleted at runtime. > What should I be using as the MIB name (e.g PYTHON-EXAMPLE-MIB). From the > example, if I try to use the MIB name 'SNMPv2-MIB', then I get an error > saying they symbol has already been exported? Is it OK to just create a You can choose a random but process-unique MIB name. It's used as a namespace for symbols defined within MIB module. > random MIB name? Or is there a way to replace the defined symbol with the > new MibScalarInstance? Replacing already existing symbols might screw up things elsewhere. Do not do that unless you understand what you are doing. > Intuitively, I just want to define the value of the MIB node that I > imported. The best way is to put all your node values (MibScalarInstance objects) into a dedicated python module, probably named after original MIB: # Import MibScalarInstance class ( MibScalarInstance, ) = mibBuilder.importSymbols( 'SNMPv2-SMI', 'MibScalarInstance' ) # Import parent node class instance myManagedObject, = mibBuilder.importSymbols( 'MY-MIB', 'myManagedObject', ) # Instantiate MibScalarInstance using parent node's OID & value type myManagedObjectInstance = MibScalarInstance( myManagedObject.name, (0,), myManagedObject.syntax ) # Export Managed Object to Agent's repository mibBuilder.exportSymbols( "__MY-MIB", myManagedObjectInstance ) You will have to import this file explicitly into your Agent: snmpEngine.msgAndPduDsp.mibInstrumController.mibBuilder.importSymbols( '__MY-MIB' ) See pysnmp/smi/mibs/instances/*py for more examples. > The syntax.clone API is confusing what it is actually doing, since > I only want 1 copy of the value in the Agent. What if I clone the same node With pysnmp, all Managed Objects' payloads are immutable. That is you can't modify their value in place. So you have to create a copy with new payload (with clone() call). > more than once, how does the Agent decide which value to use in the > response? Sorry if this is not really clear. Agent will return a value (ManagedObjectInstance.syntax) bound to particular OID (MibObjectInstance.name). Both are passed to object constructor and can't be changed. You can bind only one value to each OID. -ilya |
|
From: Ilya E. <il...@gl...> - 2010-05-13 15:36:45
|
> Some SNMP v2 agents use one community name for GET/GET-NEXT/GET-BULK
> requests and another for SET requests ("public" and "private" are
> popular default choices). I also believe that it is a typical
> configuration for e.g. the Net-SNMP toolkit. I have problems figuring
> out how to do the following with the PySNMP (I would prefer to use the
> SNMPv3-aligned API):
This configuration is also possible with pysnmp. In fact pysnmp
configuration is very similar to Net-SNMP's (which, in turn, is
RFC-compliant).
Reading Net-SNMP's "man snmpd.conf" may help understanding pysnmp
configuration process.
> (a) Create a v2 agent that uses different community names as indicated
> for validating incoming requests. (I only need this for test so the
> solution does not have to be elegant)
You have to configure both community names to your Agent, then set
read-only and read-write access mode to OID tree for each community.
> (b) Create a v2 Twisted-integrated manager app that uses different
> community names as indicated. I have tried various options, such as
> creating a separate SNMP engine for each community name, but without
> much success.
You have to create two separate targets at Manager's configuration (LCD)
and send whatever PDUs using appropriate target address.
I've attached modified examples of two-communities Command Responder and
Twisted Command Generator to give you an idea.
Let's see if it helps?
-ilya |
|
From: Mikkel E. <mi...@el...> - 2010-05-12 17:27:06
|
Some SNMP v2 agents use one community name for GET/GET-NEXT/GET-BULK
requests and another for SET requests ("public" and "private" are
popular default choices). I also believe that it is a typical
configuration for e.g. the Net-SNMP toolkit. I have problems figuring
out how to do the following with the PySNMP (I would prefer to use the
SNMPv3-aligned API):
(a) Create a v2 agent that uses different community names as indicated
for validating incoming requests. (I only need this for test so the
solution does not have to be elegant)
(b) Create a v2 Twisted-integrated manager app that uses different
community names as indicated. I have tried various options, such as
creating a separate SNMP engine for each community name, but without
much success.
Is this possible and if so, what is the best approach?
TIA
/Mikkel Elmholdt
|