1SNMP(3)               User Contributed Perl Documentation              SNMP(3)
2
3
4

NAME

6       SNMP - The Perl5 'SNMP' Extension Module for the Net-SNMP SNMP package.
7

SYNOPSIS

9        use SNMP;
10        ...
11        $sess = new SNMP::Session(DestHost => localhost, Community => public);
12        $val = $sess->get('sysDescr.0');
13        ...
14        $vars = new SNMP::VarList([sysDescr,0], [sysContact,0], [sysLocation,0]);
15        @vals = $sess->get($vars);
16        ...
17        $vb = new SNMP::Varbind();
18        do {
19           $val = $sess->getnext($vb);
20           print "@{$vb}\n";
21        } until ($sess->{ErrorNum});
22        ...
23        $SNMP::save_descriptions = 1;
24        SNMP::initMib(); # assuming mib is not already loaded
25        print "$SNMP::MIB{sysDescr}{description}\n";
26

DESCRIPTION

28       Note: The perl SNMP 5.0 module which comes with net-snmp 5.0 and higher
29       is different than previous versions in a number of ways.  Most
30       importantly, it behaves like a proper net-snmp application and calls
31       init_snmp properly, which means it will read configuration files and
32       use those defaults where appropriate automatically parse MIB files,
33       etc.  This will likely affect your perl applications if you have, for
34       instance, default values set up in your snmp.conf file (as the perl
35       module will now make use of those defaults).  The docmuentation,
36       however, has sadly not been updated yet (aside from this note), nor is
37       the read_config default usage implementation fully complete.
38
39       The basic operations of the SNMP protocol are provided by this module
40       through an object oriented interface for modularity and ease of use.
41       The primary class is SNMP::Session which encapsulates the persistent
42       aspects of a connection between the management application and the
43       managed agent. Internally the class is implemented as a blessed hash
44       reference. This class supplies 'get', 'getnext', 'set', 'fget', and
45       'fgetnext' method calls. The methods take a variety of input argument
46       formats and support both syncronous and asyncronous operation through a
47       polymorphic API (i.e., method behaviour varies dependent on args passed
48       - see below).
49

SNMP::Session

51       $sess = new SNMP::Session(DestHost => 'host', ...)
52
53       The following arguments may be passed to new as a hash.
54
55       DestHost
56           default 'localhost', hostname or ip addr of SNMP agent
57
58       Community
59           default 'public', SNMP community string (used for both R/W)
60
61       Version
62           default taken from library configuration - probably 3 [1, 2 (same
63           as 2c), 2c, 3]
64
65       RemotePort
66           default '161', allow remote UDP port to be overriden
67
68       Timeout
69           default '1000000', micro-seconds before retry
70
71       Retries
72           default '5', retries before failure
73
74       RetryNoSuch
75           default '0', if enabled NOSUCH errors in 'get' pdus will be
76           repaired, removing the varbind in error, and resent - undef will be
77           returned for all NOSUCH varbinds, when set to '0' this feature is
78           disabled and the entire get request will fail on any NOSUCH error
79           (applies to v1 only)
80
81       SecName
82           default 'initial', security name (v3)
83
84       SecLevel
85           default 'noAuthNoPriv', security level [noAuthNoPriv, authNoPriv,
86           authPriv] (v3)
87
88       SecEngineId
89           default <none>, security engineID, will be probed if not supplied
90           (v3)
91
92       ContextEngineId
93           default <SecEngineId>, context engineID, will be probed if not
94           supplied (v3)
95
96       Context
97           default '', context name (v3)
98
99       AuthProto
100           default 'MD5', authentication protocol [MD5, SHA] (v3)
101
102       AuthPass
103           default <none>, authentication passphrase
104
105       PrivProto
106           default 'DES', privacy protocol [DES, AES] (v3)
107
108       PrivPass
109           default <none>, privacy passphrase (v3)
110
111       AuthMasterKey
112       PrivMasterKey
113       AuthLocalizedKey
114       PrivLocalizedKey
115           Directly specified SNMPv3 USM user keys (used if you want to
116           specify the keys instead of deriving them from a password as
117           above).
118
119       VarFormats
120           default 'undef', used by 'fget[next]', holds an hash reference of
121           output value formatters, (e.g., {<obj> => <sub-ref>, ... }, <obj>
122           must match the <obj> and format used in the get operation. A
123           special <obj>, '*', may be used to apply all <obj>s, the supplied
124           sub is called to translate the value to a new format. The sub is
125           called passing the Varbind as the arg
126
127       TypeFormats
128           default 'undef', used by 'fget[next]', holds an hash reference of
129           output value formatters, (e.g., {<type> => <sub-ref>, ... }, the
130           supplied sub is called to translate the value to a new format,
131           unless a VarFormat mathces first (e.g.,
132           $sess->{TypeFormats}{INTEGER} = \&mapEnum(); although this can be
133           done more efficiently by enabling $SNMP::use_enums or session
134           creation param 'UseEnums')
135
136       UseLongNames
137           defaults to the value of SNMP::use_long_names at time of session
138           creation. set to non-zero to have <tags> for 'getnext' methods
139           generated preferring longer Mib name convention (e.g.,
140           system.sysDescr vs just sysDescr)
141
142       UseSprintValue
143           defaults to the value of SNMP::use_sprint_value at time of session
144           creation. set to non-zero to have return values for 'get' and
145           'getnext' methods formatted with the libraries snprint_value
146           function. This will result in certain data types being returned in
147           non-canonical format Note: values returned with this option set may
148           not be appropriate for 'set' operations (see discussion of value
149           formats in <vars> description section)
150
151       UseEnums
152           defaults to the value of SNMP::use_enums at time of session
153           creation. set to non-zero to have integer return values converted
154           to enumeration identifiers if possible, these values will also be
155           acceptable when supplied to 'set' operations
156
157       UseNumeric
158           defaults to the value of SNMP::use_numeric at time of session
159           creation. set to non-zero to have <tags> for get methods returned
160           as numeric OID's rather than descriptions.  UseLongNames will be
161           set so that the full OID is returned to the caller.
162
163       BestGuess
164           defaults to the value of SNMP::best_guess at time of session
165           creation. this setting controls how <tags> are parsed.  setting to
166           0 causes a regular lookup.  setting to 1 causes a regular
167           expression match (defined as -Ib in snmpcmd) and setting to 2
168           causes a random access lookup (defined as -IR in snmpcmd).
169
170       NonIncreasing
171           defaults to the value of SNMP::non_increasing at time of session
172           creation. this setting controls if a non-increasing OID during
173           bulkwalk will causes an error. setting to 0 causes the default
174           behaviour (which may, in very badly performing agents, result in a
175           never-ending loop).  setting to 1 causes an error (OID not
176           increasing) when this error occur.
177
178       ErrorStr
179           read-only, holds the error message assoc. w/ last request
180
181       ErrorNum
182           read-only, holds the snmp_err or staus of last request
183
184       ErrorInd
185           read-only, holds the snmp_err_index when appropriate
186
187       Private variables:
188
189       DestAddr
190           internal field used to hold the translated DestHost field
191
192       SessPtr
193           internal field used to cache a created session structure
194
195   SNMP::Session methods
196       $sess->update(<fields>)
197           Updates the SNMP::Session object with the values fields passed in
198           as a hash list (similar to new(<fields>)) (WARNING! not fully
199           implemented)
200
201       $sess->get(<vars> [,<callback>])
202           do SNMP GET, multiple <vars> formats accepted.  for syncronous
203           operation <vars> will be updated with value(s) and type(s) and will
204           also return retrieved value(s). If <callback> supplied method will
205           operate asyncronously
206
207       $sess->fget(<vars> [,<callback>])
208           do SNMP GET like 'get' and format the values according the handlers
209           specified in $sess->{VarFormats} and $sess->{TypeFormats}
210
211       $sess->getnext(<vars> [,<callback>])
212           do SNMP GETNEXT, multiple <vars> formats accepted, returns
213           retrieved value(s), <vars> passed as arguments are updated to
214           indicate next lexicographical <obj>,<iid>,<val>, and <type>
215
216           Note: simple string <vars>,(e.g., 'sysDescr.0') form is not
217           updated. If <callback> supplied method will operate asyncronously
218
219       $sess->fgetnext(<vars> [,<callback>])
220           do SNMP GETNEXT like getnext and format the values according the
221           handlers specified in $sess->{VarFormats} and $sess->{TypeFormats}
222
223       $sess->set(<vars> [,<callback>])
224           do SNMP SET, multiple <vars> formats accepted.  the value field in
225           all <vars> formats must be in a canonical format (i.e., well known
226           format) to ensure unambiguous translation to SNMP MIB data value
227           (see discussion of canonical value format <vars> description
228           section), returns snmp_errno. If <callback> supplied method will
229           operate asyncronously
230
231       $sess->getbulk(<non-repeaters>, <max-repeaters>, <vars>)
232           do an SNMP GETBULK, from the list of Varbinds, the single next
233           lexico instance is fetched for the first n Varbinds as defined by
234           <non-repeaters>. For remaining Varbinds, the m lexico instances are
235           retrieved each of the remaining Varbinds, where m is
236           <max-repeaters>.
237
238       $sess->bulkwalk(<non-repeaters>, <max-repeaters>, <vars> [,<callback>])
239           Do a "bulkwalk" of the list of Varbinds.  This is done by sending a
240           GETBULK request (see getbulk() above) for the Varbinds.  For each
241           requested variable, the response is examined to see if the next
242           lexico instance has left the requested sub-tree.  Any further
243           instances returned for this variable are ignored, and the walk for
244           that sub-tree is considered complete.
245
246           If any sub-trees were not completed when the end of the responses
247           is reached, another request is composed, consisting of the
248           remaining variables.  This process is repeated until all sub-trees
249           have been completed, or too many packets have been exchanged (to
250           avoid loops).
251
252           The bulkwalk() method returns an array containing an array of
253           Varbinds, one for each requested variable, in the order of the
254           variable requests.  Upon error, bulkwalk() returns undef and sets
255           $sess->ErrorStr and $sess->ErrorNum.  If a callback is supplied,
256           bulkwalk() returns the SNMP request id, and returns immediately.
257           The callback will be called with the supplied argument list and the
258           returned variables list.
259
260           Note: Because the client must "discover" that the tree is complete
261           by comparing the returned variables with those that were requested,
262           there is a potential "gotcha" when using the max-repeaters value.
263           Consider the following code to print a list of interfaces and byte
264           counts:
265
266               $numInts = $sess->get('ifNumber.0');
267               ($desc, $in, $out) = $sess->bulkwalk(0, $numInts,
268                             [['ifDescr'], ['ifInOctets'], ['ifOutOctets']]);
269
270               for $i (0..($numInts - 1)) {
271                   printf "Interface %4s: %s inOctets, %s outOctets\n",
272                             $$desc[$i]->val, $$in[$i]->val, $$out[$i]->val;
273               }
274
275           This code will produce *two* requests to the agent -- the first to
276           get the interface values, and the second to discover that all the
277           information was in the first packet.  To get around this, use
278           '$numInts + 1' for the max_repeaters value.  This asks the agent to
279           include one additional (unrelated) variable that signals the end of
280           the sub-tree, allowing bulkwalk() to determine that the request is
281           complete.
282
283       $results = $sess->gettable(<TABLE OID>, <OPTIONgt)
284           This will retrieve an entire table of data and return a hash
285           reference to that data.  The returned hash reference will have
286           indexes of the OID suffixes for the index data as the key.  The
287           value for each entry will be another hash containing the data for a
288           given row.  The keys to that hash will be the column names, and the
289           values will be the data.
290
291           Example:
292
293             #!/usr/bin/perl
294
295             use SNMP;
296             use Data::Dumper;
297
298             my $s = new SNMP::Session(DestHost => 'localhost');
299
300             print Dumper($s->gettable('ifTable'));
301
302           On my machine produces:
303
304             $VAR1 = {
305                       '6' => {
306                                'ifMtu' => '1500',
307                                'ifPhysAddress' => 'PV',
308                                # ...
309                                'ifInUnknownProtos' => '0'
310                              },
311                       '4' => {
312                                'ifMtu' => '1480',
313                                'ifPhysAddress' => '',
314                                # ...
315                                'ifInUnknownProtos' => '0'
316                              },
317                       # ...
318                      };
319
320           By default, it will try to do as optimized retrieval as possible.
321           It'll request multiple columns at once, and use GETBULK if
322           possible.  A few options may be specified by passing in an OPTIONS
323           hash containing various parameters:
324
325           noindexes => 1
326               Instructs the code not to parse the indexes and place the
327               results in the second hash.  If you don't need the index data,
328               this will be faster.
329
330           columns => [ colname1, ... ]
331               This specifies which columns to collect.  By default, it will
332               try to collect all the columns defined in the MIB table.
333
334           repeat => COUNT
335               Specifies a GETBULK repeat COUNT.  IE, it will request this
336               many varbinds back per column when using the GETBULK operation.
337               Shortening this will mean smaller packets which may help going
338               through some systems.  By default, this value is calculated and
339               attepmts to guess at what will fit all the results into 1000
340               bytes.  This calculation is fairly safe, hopefully, but you can
341               either raise or lower the number using this option if desired.
342               In lossy networks, you want to make sure that the packets don't
343               get fragmented and lowering this value is one way to help that.
344
345           nogetbulk => 1
346               Force the use of GETNEXT rather than GETBULK.  (always true for
347               SNMPv1, as it doesn't have GETBULK anyway).  Some agents are
348               great implementers of GETBULK and this allows you to force the
349               use of GETNEXT oprations instead.
350
351           callback => \&subroutine
352           callback => [\&subroutine, optarg1, optarg2, ...]
353               If a callback is specified, gettable will return quickly
354               without returning results.  When the results are finally
355               retrieved the callback subroutine will be called (see the other
356               sections defining callback behaviour and how to make use of
357               SNMP::MainLoop which is required fro this to work).  An
358               additional argument of the normal hash result will be added to
359               the callback subroutine arguments.
360
361               Note 1: internally, the gettable function uses it's own
362               callbacks which are passed to getnext/getbulk as appropriate.
363
364               Note 2: callback support is only available in the SNMP module
365               version 5.04 and above.  To test for this in code intending to
366               support both versions prior to 5.04 and 5.04 and up, the
367               following should work:
368
369                 if ($response = $sess->gettable('ifTable', callback => \&my_sub)) {
370                     # got a response, gettable doesn't support callback
371                     my_sub($response);
372                     $no_mainloop = 1;
373                 }
374
375               Deciding on whether to use SNMP::MainLoop is left as an
376               excersize to the reader since it depends on whether your code
377               uses other callbacks as well.
378

SNMP::TrapSession

380       $sess = new SNMP::Session(DestHost => 'host', ...)
381
382       supports all applicable fields from SNMP::Session (see above)
383
384   SNMP::TrapSession methods
385       $sess->trap(enterprise, agent, generic, specific, uptime, <vars>)
386               $sess->trap(enterprise=>'.1.3.6.1.4.1.2021', # or 'ucdavis' [default]
387                           agent => '127.0.0.1', # or 'localhost',[dflt 1st intf on host]
388                           generic => specific,  # can be omitted if 'specific' supplied
389                           specific => 5,        # can be omitted if 'generic' supplied
390                           uptime => 1234,       # dflt to localhost uptime (0 on win32)
391                           [[ifIndex, 1, 1],[sysLocation, 0, "here"]]); # optional vars
392                                                                        # always last
393
394       trap(oid, uptime, <vars>) - v2 format
395               $sess->trap(oid => 'snmpRisingAlarm',
396                           uptime => 1234,
397                           [[ifIndex, 1, 1],[sysLocation, 0, "here"]]); # optional vars
398                                                                        # always last
399

Acceptable variable formats:

401       <vars> may be one of the following forms:
402
403       SNMP::VarList
404           represents an array of MIB objects to get or set, implemented as a
405           blessed reference to an array of SNMP::Varbinds, (e.g.,
406           [<varbind1>, <varbind2>, ...])
407
408       SNMP::Varbind
409           represents a single MIB object to get or set, implemented as a
410           blessed reference to a 4 element array; [<obj>, <iid>, <val>,
411           <type>].
412
413           <obj>
414               one of the following forms:
415
416               1)  leaf identifier (e.g., 'sysDescr') assumed to be unique for
417                   practical purposes
418
419               2)  fully qualified identifier (e.g.,
420                   '.iso.org.dod.internet.mgmt.mib-2.system.sysDescr')
421
422               3)  fully qualified, dotted-decimal, numeric OID (e.g.,
423                   '.1.3.6.1.2.1.1.1')
424
425           <iid>
426               the dotted-decimal, instance identifier. for scalar MIB objects
427               use '0'
428
429           <val>
430               the SNMP data value retrieved from or being set to the agents
431               MIB. for (f)get(next) operations <val> may have a variety of
432               formats as determined by session and package settings. However
433               for set operations the <val> format must be canonical to ensure
434               unambiguous translation. The canonical forms are as follows:
435
436               OBJECTID
437                   dotted-decimal (e.g., .1.3.6.1.2.1.1.1)
438
439               OCTETSTR
440                   perl scalar containing octets
441
442               INTEGER
443                   decimal signed integer (or enum)
444
445               NETADDR
446                   dotted-decimal
447
448               IPADDR
449                   dotted-decimal
450
451               COUNTER
452                   decimal unsigned integer
453
454               COUNTER64
455                   decimal unsigned integer
456
457               GAUGE
458                   decimal unsigned integer
459
460               UINTEGER
461                   decimal unsigned integer
462
463               TICKS
464                   decimal unsigned integer
465
466               OPAQUE
467                   perl scalar containing octets
468
469               NULL
470                   perl scalar containing nothing
471
472           <type>
473               SNMP data type (see list above), this field is populated by
474               'get' and 'getnext' operations. In some cases the programmer
475               needs to populate this field when passing to a 'set' operation.
476               this field need not be supplied when the attribute indicated by
477               <tag> is already described by loaded Mib modules. for 'set's,
478               if a numeric OID is used and the object is not currently in the
479               loaded Mib, the <type> field must be supplied
480
481       simple string
482           light weight form of <var> used to 'set' or 'get' a single
483           attribute without constructing an SNMP::Varbind.  stored in a perl
484           scalar, has the form '<tag>.<iid>', (e.g., 'sysDescr.0'). for 'set'
485           operations the value is passed as a second arg. Note: This argument
486           form is not updated in get[next] operations as are the other forms.
487

Acceptable callback formats

489       <callback> may be one of the following forms:
490
491       without arguments
492           \&subname
493           sub { ... }
494       or with arguments
495           [ \&subname, $arg1, ... ]
496           [ sub { ... }, $arg1, ... ]
497           [ "method", $obj, $arg1, ... ]
498
499       callback will be called when response is received or timeout occurs.
500       the last argument passed to callback will be a SNMP::VarList reference.
501       In case of timeout the last argument will be undef.
502
503       &SNMP::MainLoop([<timeout>, [<callback>]])
504           to be used with async SNMP::Session calls. MainLoop must be called
505           after initial async calls so return packets from the agent will not
506           be processed.  If no args suplied this function enters an infinite
507           loop so program must be exited in a callback or externally
508           interupted. If <timeout(sic)
509
510       &SNMP::finish()
511           This function, when called from an SNMP::MainLoop() callback
512           function, will cause the current SNMP::MainLoop() to return after
513           the callback is completed.  finish() can be used to terminate an
514           otherwise-infinite MainLoop.  A new MainLoop() instance can then be
515           started to handle further requests.
516

SNMP package variables and functions

518       $SNMP::VERSION
519           the current version specifier (e.g., 3.1.0)
520
521       $SNMP::auto_init_mib
522           default '1', set to 0 to disable automatic reading of the MIB upon
523           session creation. set to non-zero to call initMib at session
524           creation which will result in MIB loading according to Net-SNMP
525           env. variables (see man mib_api)
526
527       $SNMP::verbose
528           default '0', controls warning/info output of SNMP module, 0 => no
529           output, 1 => enables warning/info output from SNMP module itself
530           (is also controlled by SNMP::debugging - see below)
531
532       $SNMP::use_long_names
533           default '0', set to non-zero to enable the use of longer Mib
534           identifiers. see translateObj. will also influence the formatting
535           of <tag> in varbinds returned from 'getnext' operations. Can be set
536           on a per session basis (UseLongNames)
537
538       $SNMP::use_sprint_value
539           default '0', set to non-zero to enable formatting of response
540           values using the snmp libraries snprint_value function. can also be
541           set on a per session basis (see UseSprintValue) Note: returned
542           values may not be suitable for 'set' operations
543
544       $SNMP::use_enums
545           default '0',set non-zero to return values as enums and allow sets
546           using enums where appropriate. integer data will still be accepted
547           for set operations. can also be set on a per session basis (see
548           UseEnums)
549
550       $SNMP::use_numeric
551           default to '0',set to non-zero to have <tags> for 'get' methods
552           returned as numeric OID's rather than descriptions.  UseLongNames
553           will be set so that the entire OID will be returned.  Set on a per-
554           session basis (see UseNumeric).
555
556       $SNMP::best_guess
557           default '0'.  This setting controls how <tags> are parsed.  Setting
558           to 0 causes a regular lookup.  Setting to 1 causes a regular
559           expression match (defined as -Ib in snmpcmd) and setting to 2
560           causes a random access lookup (defined as -IR in snmpcmd).  Can
561           also be set on a per session basis (see BestGuess)
562
563       $SNMP::save_descriptions
564           default '0',set non-zero to have mib parser save attribute
565           descriptions. must be set prior to mib initialization
566
567       $SNMP::debugging
568           default '0', controlls debugging output level within SNMP module
569           and libsnmp
570
571           1.  enables 'SNMP::verbose' (see above)
572
573           2.  level 1 plus snmp_set_do_debugging(1)
574
575           3.  level 2 plus snmp_set_dump_packet(1)
576
577       $SNMP::dump_packet
578           default '0', set [non-]zero to independently set
579           snmp_set_dump_packet()
580

%SNMP::MIB

582       a tied hash to access parsed MIB information. After the MIB has been
583       loaded this hash allows access to to the parsed in MIB meta-data(the
584       structure of the MIB (i.e., schema)). The hash returns blessed
585       references to SNMP::MIB::NODE objects which represent a single MIB
586       attribute. The nodes can be fetched with multiple 'key' formats - the
587       leaf name (e.g.,sysDescr) or fully/partially qualified name (e.g.,
588       system.sysDescr) or fully qualified numeric OID. The returned node
589       object supports the following fields:
590
591       objectID
592           dotted decimal fully qualified OID
593
594       label
595           leaf textual identifier (e.g., 'sysDescr')
596
597       subID
598           leaf numeric OID component of objectID (e.g., '1')
599
600       moduleID
601           textual identifier for module (e.g., 'RFC1213-MIB')
602
603       parent
604           parent node
605
606       children
607           array reference of children nodes
608
609       nextNode
610           next lexico node (BUG!does not return in lexico order)
611
612       type
613           returns application type (see getType for values)
614
615       access
616           returns ACCESS (ReadOnly, ReadWrite, WriteOnly, NoAccess, Notify,
617           Create)
618
619       status
620           returns STATUS (Mandatory, Optional, Obsolete, Deprecated)
621
622       syntax
623           returns 'textualConvention' if defined else 'type'
624
625       textualConvention
626           returns TEXTUAL-CONVENTION
627
628       TCDescription
629           returns the TEXTUAL-CONVENTION's DESCRIPTION field.
630
631       units
632           returns UNITS
633
634       hint
635           returns HINT
636
637       enums
638           returns hash ref {tag => num, ...}
639
640       ranges
641           returns array ref of hash ref [{low => num, high => num}, ...]
642
643       description
644           returns DESCRIPTION ($SNMP::save_descriptions must be set prior to
645           MIB initialization/parsing)
646
647       reference
648           returns the REFERENCE clause
649
650       indexes
651           returns the objects in the INDEX clause
652
653       implied
654           returns true if the last object in the INDEX is IMPLIED
655

MIB Functions

657       &SNMP::setMib(<file>)
658           allows dynamic parsing of the mib and explicit specification of mib
659           file independent of enviroment variables. called with no args acts
660           like initMib, loading MIBs indicated by environment variables (see
661           Net-SNMP mib_api docs). passing non-zero second arg forces previous
662           mib to be freed and replaced (Note: second arg not working since
663           freeing previous Mib is more involved than before).
664
665       &SNMP::initMib()
666           calls library init_mib function if Mib not already loaded - does
667           nothing if Mib already loaded. will parse directories and load
668           modules according to environment variables described in Net-SNMP
669           documentations.  (see man mib_api, MIBDIRS, MIBS, MIBFILE(S), etc.)
670
671       &SNMP::addMibDirs(<dir>,...)
672           calls library add_mibdir for each directory supplied. will cause
673           directory(s) to be added to internal list and made available for
674           searching in subsequent loadModules calls
675
676       &SNMP::addMibFiles(<file>,...)
677           calls library read_mib function. The file(s) supplied will be read
678           and all Mib module definitions contained therein will be added to
679           internal mib tree structure
680
681       &SNMP::loadModules(<mod>,...)
682           calls library read_module function. The module(s) supplied will be
683           searched for in the current mibdirs and and added to internal mib
684           tree structure. Passing special <mod>, 'ALL', will cause all known
685           modules to be loaded.
686
687       &SNMP::unloadModules(<mod>,...)
688           *Not Implemented*
689
690       &SNMP::translateObj(<var>[,arg,[arg]])
691           will convert a text obj tag to an OID and vice-versa.  Any iid
692           suffix is retained numerically.  Default behaviour when converting
693           a numeric OID to text form is to return leaf identifier only
694           (e.g.,'sysDescr') but when $SNMP::use_long_names is non-zero or a
695           non-zero second arg is supplied it will return a longer textual
696           identifier.  An optional third argument of non-zero will cause the
697           module name to be prepended to the text name (e.g.
698           'SNMPv2-MIB::sysDescr').  When converting a text obj, the
699           $SNMP::best_guess option is used.  If no Mib is loaded when called
700           and $SNMP::auto_init_mib is enabled then the Mib will be loaded.
701           Will return 'undef' upon failure.
702
703       &SNMP::getType(<var>)
704           return SNMP data type for given textual identifier OBJECTID,
705           OCTETSTR, INTEGER, NETADDR, IPADDR, COUNTER GAUGE, TIMETICKS,
706           OPAQUE, or undef
707
708       &SNMP::mapEnum(<var>)
709           converts integer value to enumertion tag defined in Mib or converts
710           tag to integer depending on input. the function will return the
711           corresponding integer value *or* tag for a given MIB attribute and
712           value. The function will sense which direction to perform the
713           conversion. Various arg formats are supported
714
715           $val = SNMP::mapEnum($varbind);
716               where $varbind is SNMP::Varbind or equiv.  note: $varbind will
717               be updated
718
719           $val = SNMP::mapEnum('ipForwarding', 'forwarding');
720           $val = SNMP::mapEnum('ipForwarding', 1);
721

Exported SNMP utility functions

723       Note: utility functions do not support async operation yet.
724
725       &snmp_get()
726           takes args of SNMP::Session::new followed by those of
727           SNMP::Session::get
728
729       &snmp_getnext()
730           takes args of SNMP::Session::new followed by those of
731           SNMP::Session::getnext
732
733       &snmp_set()
734           takes args of SNMP::Session::new followed by those of
735           SNMP::Session::set
736
737       &snmp_trap()
738           takes args of SNMP::TrapSession::new followed by those of
739           SNMP::TrapSession::trap
740

Trouble Shooting

742       If problems occur there are number areas to look at to narrow down the
743       possibilities.
744
745       The first step should be to test the Net-SNMP installation
746       independently from the Perl5 SNMP interface.
747
748       Try running the apps from the Net-SNMP distribution.
749
750       Make sure your agent (snmpd) is running and properly configured with
751       read-write access for the community you are using.
752
753       Ensure that your MIBs are installed and enviroment variables are set
754       appropriately (see man mib_api)
755
756       Be sure to remove old net-snmp installations and ensure headers and
757       libraries from old CMU installations are not being used by mistake.
758
759       If the problem occurs during compilation/linking check that the snmp
760       library being linked is actually the Net-SNMP library (there have been
761       name conflicts with existing snmp libs).
762
763       Also check that the header files are correct and up to date.
764
765       Sometimes compiling the Net-SNMP library with
766       'position-independent-code' enabled is required (HPUX specifically).
767
768       If you cannot resolve the problem you can post to
769       comp.lang.perl.modules or
770       net-snmp-users@net-snmp-users@lists.sourceforge.net
771
772       please give sufficient information to analyze the problem (OS type,
773       versions for OS/Perl/Net-SNMP/compiler, complete error output, etc.)
774

Acknowledgements

776       Many thanks to all those who supplied patches, suggestions and
777       feedback.
778
779        Joe Marzot (the original author)
780        Wes Hardaker and the net-snmp-coders
781        Dave Perkins
782        Marcel Wiget
783        David Blackburn
784        John Stofell
785        Gary Hayward
786        Claire Harrison
787        Achim Bohnet
788        Doug Kingston
789        Jacques Vidrine
790        Carl Jacobsen
791        Wayne Marquette
792        Scott Schumate
793        Michael Slifcak
794        Srivathsan Srinivasagopalan
795        Bill Fenner
796        Jef Peeraer
797        Daniel Hagerty
798        Karl "Rat" Schilke and Electric Lightwave, Inc.
799        Perl5 Porters
800        Alex Burger
801
802       Apologies to any/all who's patch/feature/request was not mentioned or
803       included - most likely it was lost when paying work intruded on my fun.
804       Please try again if you do not see a desired feature. This may actually
805       turn out to be a decent package with such excellent help and the fact
806       that I have more time to work on it than in the past.
807

AUTHOR

809       bugs, comments, questions to net-snmp-users@lists.sourceforge.net
810
812            Copyright (c) 1995-2000 G. S. Marzot. All rights reserved.
813            This program is free software; you can redistribute it and/or
814            modify it under the same terms as Perl itself.
815
816            Copyright (c) 2001-2002 Networks Associates Technology, Inc.  All
817            Rights Reserved.  This program is free software; you can
818            redistribute it and/or modify it under the same terms as Perl
819            itself.
820
821
822
823perl v5.10.1                      2009-04-23                           SNMP(3)
Impressum