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

NAME

6       SNMP::Info - Object Oriented Perl5 Interface to Network devices and
7       MIBs through SNMP.
8

VERSION

10       SNMP::Info - Version 2.01
11

AUTHOR

13       SNMP::Info is maintained by team of Open Source authors headed by Eric
14       Miller and Bill Fenner.
15
16       Please visit http://sourceforge.net/projects/snmp-info/
17       <http://sourceforge.net/projects/snmp-info/> for most up-to-date list
18       of developers.
19
20       SNMP::Info was originally created at UCSC for the Netdisco project
21       <http://netdisco.org> by Max Baker.
22

DEVICES SUPPORTED

24       See <http://netdisco.org/doc/DeviceMatrix.html> or DeviceMatrix.txt for
25       more details.
26

SYNOPSIS

28        use SNMP::Info;
29
30        my $info = new SNMP::Info(
31                                   # Auto Discover more specific Device Class
32                                   AutoSpecify => 1,
33                                   Debug       => 1,
34                                   # The rest is passed to SNMP::Session
35                                   DestHost    => 'router',
36                                   Community   => 'public',
37                                   Version     => 2
38                                 ) or die "Can't connect to device.\n";
39
40        my $err = $info->error();
41        die "SNMP Community or Version probably wrong connecting to device. $err\n" if defined $err;
42
43        $name  = $info->name();
44        $class = $info->class();
45        print "SNMP::Info is using this device class : $class\n";
46
47        # Find out the Duplex status for the ports
48        my $interfaces = $info->interfaces();
49        my $i_duplex   = $info->i_duplex();
50
51        # Get CDP Neighbor info
52        my $c_if       = $info->c_if();
53        my $c_ip       = $info->c_ip();
54        my $c_port     = $info->c_port();
55
56        # Print out data per port
57        foreach my $iid (keys %$interfaces){
58           my $duplex = $i_duplex->{$iid};
59           # Print out physical port name, not snmp iid
60           my $port  = $interfaces->{$iid};
61
62           print "$port: ";
63           print "$duplex duplex" if defined $duplex;
64
65           # The CDP Table has table entries different than the interface tables.
66           # So we use c_if to get the map from cdp table to interface table.
67
68           my %c_map = reverse %$c_if;
69           my $c_key = $c_map{$iid};
70           unless (defined $c_key) {
71                print "\n\n";
72                next;
73            }
74           my $neighbor_ip   = $c_ip->{$c_key};
75           my $neighbor_port = $c_port->{$c_key};
76
77           print " connected to $neighbor_ip / $neighbor_port\n" if defined $neighbor_ip;
78           print "\n";
79
80        }
81

SUPPORT

83       Please direct all support, help, and bug requests to the snmp-info-
84       users Mailing List at
85       <http://lists.sourceforge.net/lists/listinfo/snmp-info-users>.
86

DESCRIPTION

88       SNMP::Info gives an object oriented interface to information obtained
89       through SNMP.
90
91       This module is geared towards network devices.  Subclasses exist for a
92       number of network devices and common MIBs.
93
94       The idea behind this module is to give a common interface to data from
95       network devices, leaving the device-specific hacks behind the scenes in
96       subclasses.
97
98       In the SYNOPSIS example we fetch the name of all the ports on the
99       device and the duplex setting for that port with two methods --
100       interfaces() and i_duplex().
101
102       The information may be coming from any number of MIB files and is very
103       vendor specific.  SNMP::Info provides you a common method for all
104       supported devices.
105
106       Adding support for your own device is easy, and takes little SNMP
107       knowledge.
108
109       The module is not limited to network devices. Any MIB or device can be
110       given an objected oriented front-end by making a module that consists
111       of a couple hashes.  See EXTENDING SNMP::INFO.
112

REQUIREMENTS

114       1. Net-SNMP
115           To use this module, you must have Net-SNMP installed on your
116           system.  More specifically you need the Perl modules that come with
117           it.
118
119           DO NOT INSTALL SNMP:: or Net::SNMP from CPAN!
120
121           The SNMP module is matched to an install of net-snmp, and must be
122           installed from the net-snmp source tree.
123
124           The Perl module "SNMP" is found inside the net-snmp distribution.
125           Go to the perl/ directory of the distribution to install it, or run
126           "./configure --with-perl-modules" from the top directory of the
127           net-snmp distribution.
128
129           Net-SNMP can be found at http://net-snmp.sourceforge.net
130
131           Version 5.3.2 or greater is recommended.
132
133           Versions 5.0.1, 5.0301 and 5.0203 have issues with bulkwalk and are
134           not supported.
135
136           Redhat Users: Some versions that come with certain versions of
137           Redhat/Fedora don't have the Perl library installed.  Uninstall the
138           RPM and install by hand.
139
140       2. MIBS
141           SNMP::Info operates on textual descriptors found in MIBs.
142
143           If you are using SNMP::Info separate from Netdisco, download the
144           Netdisco MIB package at
145           <http://sourceforge.net/project/showfiles.php?group_id=80033&package_id=135517>
146
147           Make sure that your snmp.conf is updated to point to your MIB
148           directory and that the MIBs are world-readable.
149

DESIGN GOALS

151       1. Use of textual MIB leaf identifier and enumerated values
152           ·   All values are retrieved via MIB Leaf node names
153
154               For example SNMP::Info has an entry in its %GLOBALS hash for
155               ``sysName'' instead of 1.3.6.1.2.1.1.5.
156
157           ·   Data returned is in the enumerated value form.
158
159               For Example instead of looking up 1.3.6.1.2.1.2.2.1.3 and
160               getting back 23
161
162               SNMP::Info will ask for "RFC1213-MIB::ifType" and will get back
163               "ppp".
164
165       2. SNMP::Info is easily extended to new devices
166           You can create a new subclass for a device by providing four hashes
167           : %GLOBALS, %MIBS, %FUNCS, and %MUNGE.
168
169           Or you can override any existing methods from a parent class by
170           making a short subroutine.
171
172           See the section EXTENDING SNMP::INFO for more details.
173
174           When you make a new subclass for a device, please be sure to send
175           it back to the developers (via Source Forge or the mailing list)
176           for inclusion in the next version.
177

SUBCLASSES

179       These are the subclasses that implement MIBs and support devices:
180
181       Required MIBs not included in the install instructions above are noted
182       here.
183
184   MIB Subclasses
185       These subclasses implement method to access one or more MIBs.  These
186       are not used directly, but rather inherited from device subclasses.
187
188       For more info run "perldoc" on any of the following module names.
189
190       SNMP::Info::Airespace
191           AIRESPACE-WIRELESS-MIB and AIRESPACE-SWITCHING-MIB.  Inherited by
192           devices based on the Airespace wireless platform.
193
194           See documentation in SNMP::Info::Airespace for details.
195
196       SNMP::Info::Bridge
197           BRIDGE-MIB (RFC1286).  QBRIDGE-MIB. Inherited by devices with
198           Layer2 support.
199
200           See documentation in SNMP::Info::Bridge for details.
201
202       SNMP::Info::CDP
203           CISCO-CDP-MIB.  Cisco Discovery Protocol (CDP) Support.  Inherited
204           by Cisco, Enterasys, and HP devices.
205
206           See documentation in SNMP::Info::CDP for details.
207
208       SNMP::Info::CiscoConfig
209           CISCO-CONFIG-COPY-MIB, CISCO-FLASH-MIB, and OLD-CISCO-SYS-MIB.
210           These OIDs facilitate the writing of configuration files.
211
212           See documentation in SNMP::Info::CiscoConfig for details.
213
214       SNMP::Info::CiscoImage
215           CISCO-IMAGE-MIB. A collection of OIDs providing IOS image
216           characteristics.
217
218           See documentation in SNMP::Info::CiscoImage for details.
219
220       SNMP::Info::CiscoPortSecurity
221           CISCO-PORT-SECURITY-MIB and CISCO-PAE-MIB.
222
223           See documentation in SNMP::Info::CiscoPortSecurity for details.
224
225       SNMP::Info::CiscoPower
226           CISCO-POWER-ETHERNET-EXT-MIB.
227
228           See documentation in SNMP::Info::CiscoPower for details.
229
230       SNMP::Info::CiscoQOS
231           CISCO-CLASS-BASED-QOS-MIB. A collection of OIDs providing
232           information about a Cisco device's QOS config.
233
234           See documentation in SNMP::Info::CiscoQOS for details.
235
236       SNMP::Info::CiscoRTT
237           CISCO-RTTMON-MIB. A collection of OIDs providing information about
238           a Cisco device's RTT values.
239
240           See documentation in SNMP::Info::CiscoRTT for details.
241
242       SNMP::Info::CiscoStack
243           CISCO-STACK-MIB.
244
245           See documentation in SNMP::Info::CiscoStack for details.
246
247       SNMP::Info::CiscoStpExtensions
248           CISCO-STP-EXTENSIONS-MIB
249
250           See documentation in SNMP::Info::CiscoStpExtensions for details.
251
252       SNMP::Info::CiscoStats
253           OLD-CISCO-CPU-MIB, CISCO-PROCESS-MIB, and CISCO-MEMORY-POOL-MIB.
254           Provides common interfaces for memory, cpu, and os statistics for
255           Cisco devices.
256
257           See documentation in SNMP::Info::CiscoStats for details.
258
259       SNMP::Info::CiscoVTP
260           CISCO-VTP-MIB, CISCO-VLAN-MEMBERSHIP-MIB, CISCO-VLAN-IFTABLE-
261           RELATIONSHIP-MIB
262
263           See documentation in SNMP::Info::CiscoVTP for details.
264
265       SNMP::Info::Entity
266           ENTITY-MIB.  Used for device info in Cisco and other vendors.
267
268           See documentation in SNMP::Info::Entity for details.
269
270       SNMP::Info::EtherLike
271           EtherLike-MIB (RFC1398) - Some Layer3 devices implement this MIB,
272           as well as some Aironet Layer 2 devices (non Cisco).
273
274           See documentation in SNMP::Info::EtherLike for details.
275
276       SNMP::Info::FDP
277           Foundry Discovery Protocol.  FOUNDRY-SN-SWITCH-GROUP-MIB
278
279           See documentation in SNMP::Info::FDP for details.
280
281       SNMP::Info::IEEE802dot11
282           IEEE802dot11-MIB.  A collection of OIDs providing information about
283           standards based 802.11 wireless devices.
284
285           See documentation in SNMP::Info::IEEE802dot11 for details.
286
287       SNMP::Info::LLDP
288           LLDP-MIB, LLDP-EXT-DOT1-MIB, and LLDP-EXT-DOT3-MIB.  Link Layer
289           Discovery Protocol (LLDP) Support.
290
291           See documentation in SNMP::Info::LLDP for details.
292
293       SNMP::Info::MAU
294           MAU-MIB (RFC2668).  Some Layer2 devices use this for extended
295           Ethernet (Media Access Unit) interface information.
296
297           See documentation in SNMP::Info::MAU for details.
298
299       SNMP::Info::NortelStack
300           S5-AGENT-MIB, S5-CHASSIS-MIB.
301
302           See documentation in SNMP::Info::NortelStack for details.
303
304       SNMP::Info::PowerEthernet
305           POWER-ETHERNET-MIB
306
307           See documentation in SNMP::Info::PowerEthernet for details.
308
309       SNMP::Info::RapidCity
310           RAPID-CITY.  Inherited by Nortel switches for duplex and VLAN
311           information.
312
313           See documentation in SNMP::Info::RapidCity for details.
314
315       SNMP::Info::SONMP
316           SYNOPTICS-ROOT-MIB, S5-ETH-MULTISEG-TOPOLOGY-MIB.  Provides
317           translation from Nortel Topology Table information to CDP.
318           Inherited by Nortel/Bay/Synoptics switches and hubs.
319
320           See documentation in SNMP::Info::SONMP for details.
321
322   Device Subclasses
323       These subclasses inherit from one or more classes to provide a common
324       interface to data obtainable from network devices.
325
326       All the required MIB files are included in the netdisco-mib package.
327       (See Above).
328
329       SNMP::Info::Layer1
330           Generic Layer1 Device subclass.
331
332           See documentation in SNMP::Info::Layer1 for details.
333
334           SNMP::Info::Layer1::Allied
335               Subclass for Allied Telesys Repeaters / Hubs.
336
337               Requires ATI-MIB
338
339               See documentation in SNMP::Info::Layer1::Allied for details.
340
341           SNMP::Info::Layer1::Asante
342               Subclass for Asante 1012 Hubs.
343
344               Requires ASANTE-HUB1012-MIB
345
346               See documentation in SNMP::Info::Layer1::Asante for details.
347
348           SNMP::Info::Layer1::Bayhub
349               Subclass for Nortel/Bay hubs.  This includes System 5000, 100
350               series, 200 series, and probably more.
351
352               See documentation in SNMP::Info::Layer1::Bayhub for details.
353
354           SNMP::Info::Layer1::Cyclades
355               Subclass for Cyclades terminal servers.
356
357               See documentation in SNMP::Info::Layer1::Cyclades for details.
358
359           SNMP::Info::Layer1::S3000
360               Subclass for Bay/Synoptics hubs.  This includes System 3000,
361               281X, and probably more.
362
363               See documentation in SNMP::Info::Layer1::S3000 for details.
364
365       SNMP::Info::Layer2
366           Generic Layer2 Device subclass.
367
368           See documentation in SNMP::Info::Layer2 for details.
369
370           SNMP::Info::Layer2::Airespace
371               Subclass for Cisco (Airespace) wireless controllers.
372
373               See documentation in SNMP::Info::Layer2::Airespace for details.
374
375           SNMP::Info::Layer2::Aironet
376               Class for Cisco Aironet wireless devices that run IOS.  See
377               also Layer3::Aironet for Aironet devices that don't run IOS.
378
379               See documentation in SNMP::Info::Layer2::Aironet for details.
380
381           SNMP::Info::Layer2::Allied
382               Allied Telesys switches.
383
384               See documentation in SNMP::Info::Layer2::Allied for details.
385
386           SNMP::Info::Layer2::Aruba
387               Subclass for Aruba wireless switches.
388
389               See documentation in SNMP::Info::Layer2::Aruba for details.
390
391           SNMP::Info::Layer2::Bay
392               Depreciated.  Use BayStack.
393
394           SNMP::Info::Layer2::Baystack
395               Subclass for Nortel/Bay Ethernet Switch/Baystack switches.
396               This includes 303, 304, 350, 380, 410, 420, 425, 450, 460, 470
397               series, 2500 series, 4500 series, 5500 series, Business
398               Ethernet Switch (BES), Business Policy Switch (BPS) and
399               probably others.
400
401               See documentation in SNMP::Info::Layer2::Baystack for details.
402
403           SNMP::Info::Layer2::C1900
404               Subclass for Cisco Catalyst 1900 and 1900c Devices running
405               CatOS.
406
407               See documentation in SNMP::Info::Layer2::C1900 for details.
408
409           SNMP::Info::Layer2::C2900
410               Subclass for Cisco Catalyst 2900, 2950, 3500XL, and 3548
411               devices running IOS.
412
413               See documentation in SNMP::Info::Layer2::C2900 for details.
414
415           SNMP::Info::Layer2::Catalyst
416               Subclass for Cisco Catalyst switches running CatOS.  These
417               switches usually report a model number that starts with "wsc".
418               Note that this class does not support everything that has the
419               name Catalyst.
420
421               See documentation in SNMP::Info::Layer2::Catalyst for details.
422
423           SNMP::Info::Layer2::Centillion
424               Subclass for Nortel/Bay Centillion and 5000BH ATM switches.
425
426               See documentation in SNMP::Info::Layer2::Centillion for
427               details.
428
429           SNMP::Info::Layer2::Cisco
430               Generic Cisco subclass for layer2 devices that are not yet
431               supported in more specific subclasses.
432
433               See documentation in SNMP::Info::Layer2::Cisco for details.
434
435           SNMP::Info::Layer2::Foundry
436               Depreciated.  Use SNMP::Info::Layer3::Foundry.
437
438           SNMP::Info::Layer2::HP
439               Subclass for HP Procurve Switches
440
441               Requires HP-ICF-OID and ENTITY-MIB downloaded from HP.
442
443               See documentation in SNMP::Info::Layer2::HP for details.
444
445           SNMP::Info::Layer2::N2270
446               Subclass for Nortel 2270 wireless switches.
447
448               See documentation in SNMP::Info::Layer2::N2270 for details.
449
450           SNMP::Info::Layer2::NAP222x
451               Subclass for Nortel 222x series wireless access points.
452
453               See documentation in SNMP::Info::Layer2::NAP222x for details.
454
455           SNMP::Info::Layer2::Netgear
456               Subclass for Netgear switches
457
458               See documentation in SNMP::Info::Layer2::Netgear for details.
459
460           SNMP::Info::Layer2::Orinoco
461               Subclass for Orinoco/Proxim wireless access points.
462
463               See documentation in SNMP::Info::Layer2::Orinoco for details.
464
465           SNMP::Info::Layer2::ZyXEL_DSLAM
466               Zyxel DSLAMs.  Need I say more?
467
468               See documentation in SNMP::Info::Layer2::ZyXEL_DSLAM for
469               details.
470
471       SNMP::Info::Layer3
472           Generic Layer3 and Layer2+3 Device subclass.
473
474           See documentation in SNMP::Info::Layer3 for details.
475
476           SNMP::Info::Layer3::Aironet
477               Subclass for Cisco Aironet wireless access points (AP) not
478               running IOS. These are usually older devices.
479
480               MIBs for these devices now included in v2.tar.gz available from
481               ftp.cisco.com.
482
483               Note Layer2::Aironet
484
485               See documentation in SNMP::Info::Layer3::Aironet for details.
486
487           SNMP::Info::Layer3::AlcatelLucent
488               Alcatel-Lucent OmniSwitch Class.
489
490               See documentation in SNMP::Info::Layer3::AlcatelLucent for
491               details.
492
493           SNMP::Info::Layer3::AlteonAD
494               Subclass for Nortel Alteon Series Layer 2-7 load balancing
495               switches and Nortel BladeCenter Layer2-3 GbE Switch Modules.
496
497               See documentation in SNMP::Info::Layer3::AlteonAD for details.
498
499           SNMP::Info::Layer3::Altiga
500               See documentation in SNMP::Info::Layer3::Altiga for details.
501
502           SNMP::Info::Layer3::Arista
503               See documentation in SNMP::Info::Layer3::Arista for details.
504
505           SNMP::Info::Layer3::BayRS
506               Subclass for Nortel Multiprotocol/BayRS routers.  This includes
507               BCN, BLN, ASN, ARN, AN, 2430, and 5430 routers.
508
509               See documentation in SNMP::Info::Layer3::BayRS for details.
510
511           SNMP::Info::Layer3::C3550
512               Subclass for Cisco Catalyst 3550,3540,3560 2/3 switches running
513               IOS.
514
515               See documentation in SNMP::Info::Layer3::C3550 for details.
516
517           SNMP::Info::Layer3::C4000
518               This class covers Catalyst 4000s and 4500s.
519
520               See documentation in SNMP::Info::Layer3::C4000 for details.
521
522           SNMP::Info::Layer3::C6500
523               This class covers Catalyst 6500s in native mode, hybrid mode.
524               Catalyst 3750's, 2970's and probably others.
525
526               See documentation in SNMP::Info::Layer3::C6500 for details.
527
528           SNMP::Info::Layer3::Cisco
529               This is a simple wrapper around Layer3 for IOS devices.  It
530               adds on CiscoVTP.
531
532               See documentation in SNMP::Info::Layer3::Cisco for details.
533
534           SNMP::Info::Layer3::Contivity
535               Subclass for Nortel Contivity/VPN Routers.
536
537               See documentation in SNMP::Info::Layer3::Contivity for details.
538
539           SNMP::Info::Layer3::Dell
540               Subclass for Dell PowerConnect switches. D-Link, the IBM
541               BladeCenter Gigabit Ethernet Switch Module and some Linksys
542               switches also use this module based upon MIB support.
543
544               See documentation in SNMP::Info::Layer3::Dell for details.
545
546           SNMP::Info::Layer3::Enterasys
547               Subclass for Enterasys devices.
548
549               See documentation in SNMP::Info::Layer3::Enterasys for details.
550
551           SNMP::Info::Layer3::Extreme
552               Subclass for Extreme Networks switches.
553
554               See documentation in SNMP::Info::Layer3::Extreme for details.
555
556           SNMP::Info::Layer3::Foundry
557               Subclass for Foundry Network devices.
558
559               See documentation in SNMP::Info::Layer3::Foundry for details.
560
561           SNMP::Info::Layer3::HP9300
562               Subclass for HP network devices which Foundry Networks was the
563               Original Equipment Manufacturer (OEM) such as the HP ProCurve
564               9300 series.
565
566               See documentation in SNMP::Info::Layer3::HP9300 for details.
567
568           SNMP::Info::Layer3::Juniper
569               Subclass for Juniper devices
570
571               See documentation in SNMP::Info::Layer3::Juniper for details.
572
573           SNMP::Info::Layer3::Microsoft
574               Subclass for Generic Microsoft Routers running Microsoft
575               Windows OS.
576
577               See documentation in SNMP::Info::Layer3::Microsoft for details.
578
579           SNMP::Info::Layer3::N1600
580               Subclass for Nortel Ethernet Routing Switch 1600 series.
581
582               See documentation in SNMP::Info::Layer3::N1600 for details.
583
584           SNMP::Info::Layer3::NetSNMP
585               Subclass for host systems running Net-SNMP.
586
587               See documentation in SNMP::Info::Layer3::NetSNMP for details.
588
589           SNMP::Info::Layer3::Netscreen
590               Subclass for Juniper NetScreen.
591
592               See documentation in SNMP::Info::Layer3::Netscreen for details.
593
594           SNMP::Info::Layer3::Passport
595               Subclass for Nortel Ethernet Routing Switch/Passport 8000
596               series and Accelar series switches.
597
598               See documentation in SNMP::Info::Layer3::Passport for details.
599
600           SNMP::Info::Layer3::Sun
601               Subclass for Generic Sun Routers running SunOS.
602
603               See documentation in SNMP::Info::Layer3::Sun for details.
604
605           SNMP::Info::Layer3::Timetra
606               Alcatel-Lucent SR Class.
607
608               See documentation in SNMP::Info::Layer3::Timetra for details.
609

Thanks

611       Thanks for testing and coding help (in no particular order) to :
612       Alexander Barthel, Andy Ford, Alexander Hartmaier, Andrew Herrick, Alex
613       Kramarov, Bernhard Augenstein, Bradley Baetz, Brian Chow, Brian Wilson,
614       Carlos Vicente, Dana Watanabe, David Pinkoski, David Sieborger, Douglas
615       McKeown, Greg King, Ivan Auger, Jean-Philippe Luiggi, Jeroen van Ingen,
616       Justin Hunter, Kent Hamilton, Matthew Tuttle, Michael Robbert, Mike
617       Hunter, Nicolai Petri, Ralf Gross, Robert Kerr and people listed on the
618       Netdisco README!
619

USAGE

621   Constructor
622       new()
623           Creates a new object and connects via SNMP::Session.
624
625            my $info = new SNMP::Info( 'Debug'         => 1,
626                                       'AutoSpecify'   => 1,
627                                       'BigInt'        => 1,
628                                       'BulkWalk'      => 1,
629                                       'BulkRepeaters' => 20,
630                                       'LoopDetect'    => 1,
631                                       'DestHost'      => 'myrouter',
632                                       'Community'     => 'public',
633                                       'Version'       => 2,
634                                       'MibDirs'       => ['dir1','dir2','dir3'],
635                                     ) or die;
636
637           SNMP::Info Specific Arguments :
638
639           AutoSpecify
640               Returns an object of a more specific device class
641
642               (default on)
643
644           BigInt
645               Return Math::BigInt objects for 64 bit counters.  Sets on a
646               global scope, not object.
647
648               (default off)
649
650           BulkWalk
651               Set to 0 to turn off BULKWALK commands for SNMPv2 connections.
652
653               Note that BULKWALK is turned off for Net-SNMP versions 5.1.x
654               because of a bug.
655
656               (default on)
657
658           BulkRepeaters
659               Set number of MaxRepeaters for BULKWALK operation.  See
660               "perldoc SNMP" -> bulkwalk() for more info.
661
662               (default 20)
663
664           LoopDetect
665               Detects looping during getnext table column walks by comparing
666               IIDs for each instance.  A loop is detected if the same IID is
667               seen more than once and the walk is aborted.  Note:  This will
668               not detect loops during a bulkwalk operation, Net-SNMP's
669               internal bulkwalk function must detect the loop.
670
671               Set to 0 to turn off loop detection.
672
673               (default on)
674
675           Debug
676               Prints Lots of debugging messages.  Pass 2 to print even more
677               debugging messages.
678
679               (default off)
680
681           DebugSNMP
682               Set $SNMP::debugging  level for Net-SNMP.
683
684               See SNMP for more details.
685
686           MibDirs
687               Array ref to list of directories in which to look for MIBs.
688               Note this will be in addition to the ones setup in snmp.conf at
689               the system level.
690
691               (default use net-snmp settings only)
692
693           RetryNoSuch
694               When using SNMP Version 1, try reading values even if they come
695               back as "no such variable in this MIB".  Set to false if so
696               desired.  This feature lets you read SNMPv2 data from an SNMP
697               version 1 connection, and should probably be left on.
698
699               (default true)
700
701           Session
702               SNMP::Session object to use instead of connecting on own.
703
704               (default creates session automatically)
705
706           OTHER
707               All other arguments are passed to SNMP::Session.
708
709               See SNMP::Session for a list of other possible arguments.
710
711           A Note about the wrong Community string or wrong SNMP Version:
712
713           If a connection is using the wrong community string or the wrong
714           SNMP version, the creation of the object will not fail.  The device
715           still answers the call on the SNMP port, but will not return
716           information.  Check the error() method after you create the device
717           object to see if there was a problem in connecting.
718
719           A note about SNMP Versions :
720
721           Some older devices don't support SNMP version 2, and will not
722           return anything when a connection under Version 2 is attempted.
723
724           Some newer devices will support Version 1, but will not return all
725           the data they might have if you had connected under Version 1
726
727           When trying to get info from a new device, you may have to try
728           version 2 and then fallback to version 1.
729
730       update()
731           Replace the existing session with a new one with updated values,
732           without re-identifying the device.  The only supported changes are
733           to Community or Context.
734
735           Clears the object cache.
736
737           This is useful, e.g., when a device supports multiple contexts (via
738           changes to the Community string, or via the SNMPv3 Context
739           parameter), but a context that you want to access does not support
740           the objects (e.g., "sysObjectID", "sysDescr") that we use to
741           identify the device.
742
743   Data is Cached
744       Methods and subroutines requesting data from a device will only load
745       the data once, and then return cached versions of that data.
746
747       Run $info->load_METHOD() where method is something like 'i_name' to
748       reload data from a method.
749
750       Run $info->clear_cache() to clear the cache to allow reload of both
751       globals and table methods.
752
753   Object Scalar Methods
754       These are for package related data, not directly supplied from SNMP.
755
756       $info->clear_cache()
757           Clears the cached data.  This includes GLOBALS data and TABLE
758           METHOD data.
759
760       $info->debug(1)
761           Returns current debug status, and optionally toggles debugging info
762           for this object.
763
764       $info->bulkwalk([1|0])
765           Returns if bulkwalk is currently turned on for this object.
766
767           Optionally sets the bulkwalk parameter.
768
769       $info->loopdetect([1|0])
770           Returns if loopdetect is currently turned on for this object.
771
772           Optionally sets the loopdetect parameter.
773
774       $info->device_type()
775           Returns the Subclass name for this device.  "SNMP::Info" is
776           returned if no more specific class is available.
777
778           First the device is checked for Layer 3 support and a specific
779           subclass, then Layer 2 support and subclasses are checked.
780
781           This means that Layer 2 / 3  switches and routers will fall under
782           the SNMP::Info::Layer3 subclasses.
783
784           If the device still can be connected to via SNMP::Info, then
785           SNMP::Info is returned.
786
787           See <http://netdisco.org/doc/DeviceMatrix.html> or DeviceMatrix.txt
788           for more details about device support, or view "device_type()" in
789           Info.pm.
790
791       $info->error(no_clear)
792           Returns Error message if there is an error, or undef if there is
793           not.
794
795           Reading the error will clear the error unless you set the no_clear
796           flag.
797
798       $info->has_layer(3)
799           Returns non-zero if the device has the supplied layer in the OSI
800           Model
801
802           Returns if the device doesn't support the layers() call.
803
804       $info->snmp_comm()
805           Returns SNMP Community string used in connection.
806
807       $info->snmp_ver()
808           Returns SNMP Version used for this connection
809
810       $info->specify()
811           Returns an object of a more-specific subclass.
812
813            my $info = new SNMP::Info(...);
814            # Returns more specific object type
815            $info = $info->specific();
816
817           Usually this method is called internally from new(AutoSpecify => 1)
818
819           See device_type() entry for how a subclass is chosen.
820
821       $info->cisco_comm_indexing()
822           Returns 0.  Is an overridable method used for vlan indexing for
823           snmp calls on certain Cisco devices.
824
825           See
826           ftp://ftp.cisco.com/pub/mibs/supportlists/wsc5000/wsc5000-communityIndexing.html
827           <ftp://ftp.cisco.com/pub/mibs/supportlists/wsc5000/wsc5000-communityIndexing.html>
828
829   Globals (Scalar Methods)
830       These are methods to return scalar data from RFC1213.
831
832       Some subset of these is probably available for any network device that
833       speaks SNMP.
834
835       $info->uptime()
836           Uptime in hundredths of seconds since device became available.
837
838           ("sysUpTime")
839
840       $info->contact()
841           ("sysContact")
842
843       $info->name()
844           ("sysName")
845
846       $info->location()
847           ("sysLocation")
848
849       $info->layers()
850           This returns a binary encoded string where each digit represents a
851           layer of the OSI model served by the device.
852
853               eg: 01000010  means layers 2 (physical) and 7 (Application)
854                             are served.
855
856           Note:  This string is 8 digits long.
857
858           See $info->has_layer()
859
860           ("sysServices")
861
862       $info->ports()
863           Number of interfaces available on this device.
864
865           Not too useful as the number of SNMP interfaces usually does not
866           correspond with the number of physical ports
867
868           ("ifNumber")
869
870       $info->ipforwarding()
871           The indication of whether the entity is acting as an IP gateway
872
873           Returns either forwarding or not-forwarding
874
875           ("ipForwarding")
876
877   Table Methods
878       Each of these methods returns a hash_reference to a hash keyed on the
879       interface index in SNMP.
880
881       Example : $info->interfaces() might return
882
883           { '1.12' => 'FastEthernet/0',
884             '2.15' => 'FastEthernet/1',
885             '9.99' => 'FastEthernet/2'
886           }
887
888       The key is what you would see if you were to do an snmpwalk, and in
889       some cases changes between reboots of the network device.
890
891   Partial Table Fetches
892       If you want to get only a part of an SNMP table or a single instance
893       from the table and you know the IID for the part of the table that you
894       want, you can specify it in the call:
895
896           $local_routes = $info->ipr_route('192.168.0');
897
898       This will only fetch entries in the table that start with 192.168.0,
899       which in this case are routes on the local network.
900
901       Remember that you must supply the partial IID (a numeric OID).
902
903       Partial table results are not cached.
904
905   Interface Information
906       $info->interfaces()
907           This methods is overridden in each subclass to provide a mapping
908           between the Interface Table Index (iid) and the physical port name.
909
910       $info->if_ignore()
911           Returns a reference to a hash where key values that exist are
912           interfaces to ignore.
913
914           Ignored interfaces are ones that are usually not physical ports or
915           Virtual Lans (VLANs) such as the Loopback interface, or the CPU
916           interface.
917
918       $info->i_index()
919           Default SNMP IID to Interface index.
920
921           ("ifIndex")
922
923       $info->i_description()
924           Description of the interface. Usually a little longer single word
925           name that is both human and machine friendly.  Not always.
926
927           ("ifDescr")
928
929       $info->i_type()
930           Interface type, such as Vlan, Ethernet, Serial
931
932           ("ifType")
933
934       $info->i_mtu()
935           INTEGER. Interface MTU value.
936
937           ("ifMtu")
938
939       $info->i_speed()
940           Speed of the link, human format.  See munge_speed() later in
941           document for details.
942
943           ("ifSpeed", "ifHighSpeed" if necessary)
944
945       $info->i_speed_raw()
946           Speed of the link in bits per second without munging.  If
947           i_speed_high is available it will be used and multiplied by
948           1_000_000.
949
950           ("ifSpeed", "ifHighSpeed" if necessary)
951
952       $info->i_speed_high()
953           Speed of a high-speed link, human format.  See munge_highspeed()
954           later in document for details.  You should not need to call this
955           directly, as i_speed() will call it if it needs to.
956
957           ("ifHighSpeed")
958
959       $info->i_mac()
960           MAC address of the interface.  Note this is just the MAC of the
961           port, not anything connected to it.
962
963           ("ifPhysAddress")
964
965       $info->i_up()
966           Link Status of the interface.  Typical values are 'up' and 'down'.
967
968           ("ifOperStatus")
969
970       $info->i_up_admin()
971           Administrative status of the port.  Typical values are 'enabled'
972           and 'disabled'.
973
974           ("ifAdminStatus")
975
976       $info->i_lastchange()
977           The value of "sysUpTime" when this port last changed states
978           (up,down).
979
980           ("ifLastChange")
981
982       $info->i_name()
983           Interface Name field.  Supported by a smaller subset of devices,
984           this fields is often human set.
985
986           ("ifName")
987
988       $info->i_alias()
989           Interface Name field.  For certain devices this is a more human
990           friendly form of i_description().  For others it is a human set
991           field like i_name().
992
993           ("ifAlias")
994
995   Interface Statistics
996       $info->i_octet_in(), $info->i_octets_out(), $info->i_octet_in64(),
997       $info->i_octets_out64()
998           Bandwidth.
999
1000           Number of octets sent/received on the interface including framing
1001           characters.
1002
1003           64 bit version may not exist on all devices.
1004
1005           NOTE: To manipulate 64 bit counters you need to use Math::BigInt,
1006           since the values are too large for a normal Perl scalar.   Set the
1007           global $SNMP::Info::BIGINT to 1 , or pass the BigInt value to new()
1008           if you want SNMP::Info to do it for you.
1009
1010           ("ifInOctets") ("ifOutOctets") ("ifHCInOctets") ("ifHCOutOctets")
1011
1012       $info->i_errors_in(), $info->i_errors_out()
1013           Number of packets that contained an error preventing delivery.  See
1014           "IF-MIB" for more info.
1015
1016           ("ifInErrors") ("ifOutErrors")
1017
1018       $info->i_pkts_ucast_in(), $info->i_pkts_ucast_out(),
1019       $info->i_pkts_ucast_in64(), $info->i_pkts_ucast_out64()
1020           Number of packets not sent to a multicast or broadcast address.
1021
1022           64 bit version may not exist on all devices.
1023
1024           ("ifInUcastPkts") ("ifOutUcastPkts") ("ifHCInUcastPkts")
1025           ("ifHCOutUcastPkts")
1026
1027       $info->i_pkts_nucast_in(), $info->i_pkts_nucast_out(),
1028           Number of packets sent to a multicast or broadcast address.
1029
1030           These methods are deprecated by i_pkts_multi_in() and
1031           i_pkts_bcast_in() according to "IF-MIB".  Actual device usage may
1032           vary.
1033
1034           ("ifInNUcastPkts") ("ifOutNUcastPkts")
1035
1036       $info->i_pkts_multi_in() $info->i_pkts_multi_out(),
1037       $info->i_pkts_multi_in64(), $info->i_pkts_multi_out64()
1038           Number of packets sent to a multicast address.
1039
1040           64 bit version may not exist on all devices.
1041
1042           ("ifInMulticastPkts") ("ifOutMulticastPkts")
1043           ("ifHCInMulticastPkts") ("ifHCOutMulticastPkts")
1044
1045       $info->i_pkts_bcast_in() $info->i_pkts_bcast_out(),
1046       $info->i_pkts_bcast_in64() $info->i_pkts_bcast_out64()
1047           Number of packets sent to a broadcast address on an interface.
1048
1049           64 bit version may not exist on all devices.
1050
1051           ("ifInBroadcastPkts") ("ifOutBroadcastPkts")
1052           ("ifHCInBroadcastPkts") ("ifHCOutBroadcastPkts")
1053
1054       $info->i_discards_in() $info->i_discards_out()
1055           "The number of inbound packets which were chosen to be discarded
1056           even though no errors had been detected to prevent their being
1057           deliverable to a higher-layer protocol.  One possible reason for
1058           discarding such a packet could be to free up buffer space."
1059           ("IF-MIB")
1060
1061           ("ifInDiscards") ("ifOutDiscards")
1062
1063       $info->i_bad_proto_in()
1064           "For packet-oriented interfaces, the number of packets received via
1065           the interface which were discarded because of an unknown or
1066           unsupported protocol.  For character-oriented or fixed-length
1067           interfaces that support protocol multiplexing the number of
1068           transmission units received via the interface which were discarded
1069           because of an unknown or unsupported protocol.  For any interface
1070           that does not support protocol multiplexing, this counter will
1071           always be 0."
1072
1073           ("ifInUnknownProtos")
1074
1075       $info->i_qlen_out()
1076           "The length of the output packet queue (in packets)."
1077
1078           ("ifOutQLen")
1079
1080       $info->i_specific()
1081           See "IF-MIB" for full description
1082
1083           ("ifSpecific")
1084
1085   IP Address Table
1086       Each entry in this table is an IP address in use on this device.
1087       Usually this is implemented in Layer3 Devices.
1088
1089       $info->ip_index()
1090           Maps the IP Table to the IID
1091
1092           ("ipAdEntIfIndex")
1093
1094       $info->ip_table()
1095           Maps the Table to the IP address
1096
1097           ("ipAdEntAddr")
1098
1099       $info->ip_netmask()
1100           Gives netmask setting for IP table entry.
1101
1102           ("ipAdEntNetMask")
1103
1104       $info->ip_broadcast()
1105           Gives broadcast address for IP table entry.
1106
1107           ("ipAdEntBcastAddr")
1108
1109   IP Routing Table
1110       $info->ipr_route()
1111           The route in question.  A value of 0.0.0.0 is the default gateway
1112           route.
1113
1114           ("ipRouteDest")
1115
1116       $info->ipr_if()
1117           The interface (IID) that the route is on.  Use interfaces() to map.
1118
1119           ("ipRouteIfIndex")
1120
1121       $info->ipr_1()
1122           Primary routing metric for this route.
1123
1124           ("ipRouteMetric1")
1125
1126       $info->ipr_2()
1127           If metrics are not used, they should be set to -1
1128
1129           ("ipRouteMetric2")
1130
1131       $info->ipr_3()
1132           ("ipRouteMetric3")
1133
1134       $info->ipr_4()
1135           ("ipRouteMetric4")
1136
1137       $info->ipr_5()
1138           ("ipRouteMetric5")
1139
1140       $info->ipr_dest()
1141           From RFC1213:
1142
1143             "The IP address of the next hop of this route.
1144             (In the case of a route bound to an interface
1145             which is realized via a broadcast media, the value
1146             of this field is the agent's IP address on that
1147             interface.)"
1148
1149           ("ipRouteNextHop")
1150
1151       $info->ipr_type()
1152           From RFC1213:
1153
1154               other(1),        -- none of the following
1155               invalid(2),      -- an invalidated route
1156                                -- route to directly
1157               direct(3),       -- connected (sub-)network
1158                                -- route to a non-local
1159               indirect(4)      -- host/network/sub-network
1160
1161
1162                 "The type of route.  Note that the values
1163                 direct(3) and indirect(4) refer to the notion of
1164                 direct and indirect routing in the IP
1165                 architecture.
1166
1167                 Setting this object to the value invalid(2) has
1168                 the effect of invalidating the corresponding entry
1169                 in the ipRouteTable object.  That is, it
1170                 effectively disassociates the destination
1171                 identified with said entry from the route
1172                 identified with said entry.  It is an
1173                 implementation-specific matter as to whether the
1174                 agent removes an invalidated entry from the table.
1175                 Accordingly, management stations must be prepared
1176                 to receive tabular information from agents that
1177                 corresponds to entries not currently in use.
1178                 Proper interpretation of such entries requires
1179                 examination of the relevant ipRouteType object."
1180
1181           ("ipRouteType")
1182
1183       $info->ipr_proto()
1184           From RFC1213:
1185
1186               other(1),       -- none of the following
1187                               -- non-protocol information,
1188                               -- e.g., manually configured
1189               local(2),       -- entries
1190                               -- set via a network
1191               netmgmt(3),     -- management protocol
1192                               -- obtained via ICMP,
1193               icmp(4),        -- e.g., Redirect
1194                               -- the remaining values are
1195                               -- all gateway routing
1196                               -- protocols
1197               egp(5),
1198               ggp(6),
1199               hello(7),
1200               rip(8),
1201               is-is(9),
1202               es-is(10),
1203               ciscoIgrp(11),
1204               bbnSpfIgp(12),
1205               ospf(13),
1206               bgp(14)
1207
1208           ("ipRouteProto")
1209
1210       $info->ipr_age()
1211           Seconds since route was last updated or validated.
1212
1213           ("ipRouteAge")
1214
1215       $info->ipr_mask()
1216           Subnet Mask of route. 0.0.0.0 for default gateway.
1217
1218           ("ipRouteMask")
1219
1220       $info->ipr_info()
1221           Reference to MIB definition specific to routing protocol.
1222
1223           ("ipRouteInfo")
1224

SETTING DATA VIA SNMP

1226       This section explains how to use SNMP::Info to do SNMP Set operations.
1227
1228       $info->set_METHOD($value)
1229           Sets the global METHOD to value.  Assumes that iid is .0
1230
1231           Returns if failed, or the return value from SNMP::Session::set()
1232           (snmp_errno)
1233
1234            $info->set_location("Here!");
1235
1236       $info->set_METHOD($value,$iid)
1237           Table Methods. Set iid of method to value.
1238
1239           Returns if failed, or the return value from SNMP::Session::set()
1240           (snmp_errno)
1241
1242            # Disable a port administratively
1243            my %if_map = reverse %{$info->interfaces()}
1244            $info->set_i_up_admin('down', $if_map{'FastEthernet0/0'})
1245               or die "Couldn't disable the port. ",$info->error(1);
1246
1247       NOTE: You must be connected to your device with a "ReadWrite" community
1248       string in order for set operations to work.
1249
1250       NOTE: This will only set data listed in %FUNCS and %GLOBALS.  For data
1251       acquired from overridden methods (subroutines) specific set_METHOD()
1252       subroutines will need to be added if they haven't been already.
1253

Quiet Mode

1255       SNMP::Info will not chirp anything to STDOUT unless there is a serious
1256       error (in which case it will probably die).
1257
1258       To get lots of debug info, set the Debug flag when calling new() or
1259       call $info->debug(1);
1260
1261       When calling a method check the return value.  If the return value is
1262       undef then check $info->error()
1263
1264       Beware, calling $info->error() clears the error.
1265
1266        my $name = $info->name() or die "Couldn't get sysName!" . $name->error();
1267

EXTENDING SNMP::INFO

1269   Data Structures required in new Subclass
1270       A class inheriting this class must implement these data structures :
1271
1272       $INIT
1273           Used to flag if the MIBs have been loaded yet.
1274
1275       %GLOBALS
1276           Contains a hash in the form ( method_name => SNMP MIB leaf name )
1277           These are scalar values such as name, uptime, etc.
1278
1279           To resolve MIB leaf name conflicts between private MIBs, you may
1280           prefix the leaf name with the MIB replacing each - (dash) and :
1281           (colon) with an _ (underscore).  For example,
1282           ALTEON_TIGON_SWITCH_MIB__agSoftwareVersion would be used as the
1283           hash value instead of the net-snmp notation
1284           ALTEON-TIGON-SWITCH-MIB::agSoftwareVersion.
1285
1286           When choosing the name for the methods, be aware that other new Sub
1287           Modules might inherit this one to get it's features.  Try to choose
1288           a prefix for methods that will give it's own name space inside the
1289           SNMP::Info methods.
1290
1291       %FUNCS
1292           Contains a hash in the form ( method_name => SNMP MIB leaf name)
1293           These are table entries, such as the "ifIndex"
1294
1295           To resolve MIB leaf name conflicts between private MIBs, you may
1296           prefix the leaf name with the MIB replacing each - (dash) and :
1297           (colon) with an _ (underscore).  For example,
1298           ALTEON_TS_PHYSICAL_MIB__agPortCurCfgPortName would be used as the
1299           hash value instead of the net-snmp notation
1300           ALTEON-TS-PHYSICAL-MIB::agPortCurCfgPortName.
1301
1302       %MIBS
1303           A list of each mib needed.
1304
1305               ('MIB-NAME' => 'itemToTestForPresence')
1306
1307           The value for each entry should be a MIB object to check for to
1308           make sure that the MIB is present and has loaded correctly.
1309
1310           $info->init() will throw an exception if a MIB does not load.
1311
1312       %MUNGE
1313           A map between method calls (from %FUNCS or %GLOBALS) and subroutine
1314           methods.  The subroutine called will be passed the data as it gets
1315           it from SNMP and it should return that same data in a more human
1316           friendly format.
1317
1318           Sample %MUNGE:
1319
1320            (my_ip     => \&munge_ip,
1321             my_mac    => \&munge_mac,
1322             my_layers => \&munge_dec2bin
1323            )
1324
1325   Sample Subclass
1326       Let's make a sample Layer 2 Device subclass.  This class will inherit
1327       the Cisco Vlan module as an example.
1328
1329       ----------------------- snip --------------------------------
1330
1331        # SNMP::Info::Layer2::Sample
1332
1333        package SNMP::Info::Layer2::Sample;
1334
1335        $VERSION = 0.1;
1336
1337        use strict;
1338
1339        use Exporter;
1340        use SNMP::Info::Layer2;
1341        use SNMP::Info::CiscoVTP;
1342
1343        @SNMP::Info::Layer2::Sample::ISA = qw/SNMP::Info::Layer2
1344                                              SNMP::Info::CiscoVTP Exporter/;
1345        @SNMP::Info::Layer2::Sample::EXPORT_OK = qw//;
1346
1347        use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
1348
1349        %MIBS    = (%SNMP::Info::Layer2::MIBS,
1350                    %SNMP::Info::CiscoVTP::MIBS,
1351                    'SUPER-DOOPER-MIB'  => 'supermibobject'
1352                   );
1353
1354        %GLOBALS = (%SNMP::Info::Layer2::GLOBALS,
1355                    %SNMP::Info::CiscoVTP::GLOBALS,
1356                    'name'              => 'supermib_supername',
1357                    'favorite_color'    => 'supermib_fav_color_object',
1358                    'favorite_movie'    => 'supermib_fav_movie_val'
1359                    );
1360
1361        %FUNCS   = (%SNMP::Info::Layer2::FUNCS,
1362                    %SNMP::Info::CiscoVTP::FUNCS,
1363                    # Super Dooper MIB - Super Hero Table
1364                    'super_hero_index'  => 'SuperHeroIfIndex',
1365                    'super_hero_name'   => 'SuperHeroIfName',
1366                    'super_hero_powers' => 'SuperHeroIfPowers'
1367                   );
1368
1369
1370        %MUNGE   = (%SNMP::Info::Layer2::MUNGE,
1371                    %SNMP::Info::CiscoVTP::MUNGE,
1372                    'super_hero_powers' => \&munge_powers
1373                   );
1374
1375        # OverRide uptime() method from %SNMP::Info::GLOBALS
1376        sub uptime {
1377            my $sample = shift;
1378
1379            my $name   = $sample->name();
1380
1381            # this is silly but you get the idea
1382            return '600' if defined $name ;
1383        }
1384
1385        # Create our own munge function
1386        sub munge_powers {
1387            my $power = shift;
1388
1389            # Take the returned obscure value and return something useful.
1390            return 'Fire' if $power =~ /reallyhot/i;
1391            return 'Ice'  if $power =~ /reallycold/i;
1392
1393            # Else
1394            return $power;
1395        }
1396
1397        # Copious Documentation here!!!
1398        =head1 NAME
1399        =head1 AUTHOR
1400        =head1 SYNOPSIS
1401        =head1 DESCRIPTION
1402        =head2 Inherited Classes
1403        =head2 Required MIBs
1404        =head1 GLOBALS
1405        =head2 Overrides
1406        =head1 TABLE METHODS
1407        =head2 Overrides
1408        =cut
1409
1410        1; # don't forget this line
1411       ----------------------- snip --------------------------------
1412
1413       Be sure and send the debugged version to
1414       snmp-info-users@lists.sourceforge.net to be included in the next
1415       version of SNMP::Info.
1416

SNMP::INFO INTERNALS

1418   Object Namespace
1419       Internal data is stored with bareword keys. For example $info->{debug}
1420
1421       SNMP Data is stored or marked cached with keys starting with an
1422       underscore.  For example $info->{_name} is the cache for $info->name().
1423
1424       Cached Table data is stored in $info->store() and marked cached per
1425       above.
1426
1427   Package Globals
1428       These set the default value for an object upon creation.
1429
1430       $DEBUG
1431           Default 0.  Sends copious debug info to stdout.  This global sets
1432           the object's debug status in new() unless 'Debug' argument passed
1433           in new().  Change objects' debug status with $info->debug().
1434
1435       $BIGINT
1436           Default 0.   Set to true to have 64 bit counters return
1437           Math::BigInt objects instead of scalar string values.  See note
1438           under Interface Statistics about 64 bit values.
1439
1440       $NOSUCH
1441           Default 1.  Set to false to disable RetryNoSuch option for
1442           SNMP::Session.  Or see method in new() to do it on an object scope.
1443
1444       $REPEATERS
1445           Default 20.  MaxRepeaters for BULKWALK operations.  See "perldoc
1446           SNMP" for more info.  Can change by passing BulkRepeaters option in
1447           new()
1448
1449   Data Munging Callback Subroutines
1450       munge_speed()
1451           Makes human friendly speed ratings using %SPEED_MAP
1452
1453            %SPEED_MAP = (
1454                           '56000'      => '56 kbps',
1455                           '64000'      => '64 kbps',
1456                           '115000'     => '115 kpbs',
1457                           '1500000'    => '1.5 Mbps',
1458                           '1536000'    => 'T1',
1459                           '1544000'    => 'T1',
1460                           '2000000'    => '2.0 Mbps',
1461                           '2048000'    => '2.048 Mbps',
1462                           '3072000'    => 'Dual T1',
1463                           '3088000'    => 'Dual T1',
1464                           '4000000'    => '4.0 Mbps',
1465                           '10000000'   => '10 Mbps',
1466                           '11000000'   => '11 Mbps',
1467                           '20000000'   => '20 Mbps',
1468                           '16000000'   => '16 Mbps',
1469                           '16777216'   => '16 Mbps',
1470                           '44210000'   => 'T3',
1471                           '44736000'   => 'T3',
1472                           '45000000'   => '45 Mbps',
1473                           '45045000'   => 'DS3',
1474                           '46359642'   => 'DS3',
1475                           '51850000'   => 'OC-1',
1476                           '54000000'   => '54 Mbps',
1477                           '64000000'   => '64 Mbps',
1478                           '100000000'  => '100 Mbps',
1479                           '149760000'  => 'ATM on OC-3',
1480                           '155000000'  => 'OC-3',
1481                           '155519000'  => 'OC-3',
1482                           '155520000'  => 'OC-3',
1483                           '400000000'  => '400 Mbps',
1484                           '599040000'  => 'ATM on OC-12',
1485                           '622000000'  => 'OC-12',
1486                           '622080000'  => 'OC-12',
1487                           '1000000000' => '1.0 Gbps',
1488                           '2488000000' => 'OC-48',
1489                        )
1490
1491       munge_highspeed()
1492           Makes human friendly speed ratings for "ifHighSpeed"
1493
1494       munge_ip()
1495           Takes a binary IP and makes it dotted ASCII
1496
1497       munge_mac()
1498           Takes an octet stream (HEX-STRING) and returns a colon separated
1499           ASCII hex string.
1500
1501       munge_prio_mac()
1502           Takes an 8-byte octet stream (HEX-STRING) and returns a colon
1503           separated ASCII hex string.
1504
1505       munge_octet2hex()
1506           Takes a binary octet stream and returns an ASCII hex string
1507
1508       munge_dec2bin()
1509           Takes a binary char and returns its ASCII binary representation
1510
1511       munge_bits
1512           Takes a SNMP2 'BITS' field and returns the ASCII bit string
1513
1514       munge_caps
1515           Takes an octet string and returns an ascii binary string, 7 digits
1516           long, MSB.
1517
1518       munge_counter64
1519           If $BIGINT is set to true, then a Math::BigInt object is returned.
1520           See Math::BigInt for details.
1521
1522       munge_i_up
1523           Net-SNMP tends to load "RFC1213-MIB" first, and so ignores the
1524           updated enumeration for "ifOperStatus" in "IF-MIB".  This munge
1525           handles the "newer" definitions for the enumeration in IF-MIB.
1526
1527           TODO: Get the precedence of MIBs and overriding of MIB data in Net-
1528           SNMP figured out.  Heirarchy/precendence of MIBS in SNMP::Info.
1529
1530       munge_port_list
1531           Takes an octet string representing a set of ports and returns a
1532           reference to an array of binary values each array element
1533           representing a port.
1534
1535           If the element has a value of '1', then that port is included in
1536           the set of ports; the port is not included if it has a value of
1537           '0'.
1538
1539       munge_null()
1540           Removes nulls from a string
1541
1542       munge_e_type()
1543           Takes an OID and return the object name if the right MIB is loaded.
1544
1545   Internally Used Functions
1546       $info->init()
1547           Used internally.  Loads all entries in %MIBS.
1548
1549       $info->args()
1550           Returns a reference to the argument hash supplied to SNMP::Session
1551
1552       $info->class()
1553           Returns the class name of the object.
1554
1555       $info->error_throw(error message)
1556           Stores the error message for use by $info->error()
1557
1558           If $info->debug() is true, then the error message is carped too.
1559
1560       $info->funcs()
1561           Returns a reference to the %FUNCS hash.
1562
1563       $info->globals()
1564           Returns a reference to the %GLOBALS hash.
1565
1566       $info->mibs()
1567           Returns a reference to the %MIBS hash.
1568
1569       $info->munge()
1570           Returns a reference of the %MUNGE hash.
1571
1572       $info->nosuch()
1573           Returns NoSuch value set or not in new()
1574
1575       $info->session()
1576           Gets or Sets the SNMP::Session object.
1577
1578       $info->store(new_store)
1579           Returns or sets hash store for Table functions.
1580
1581           Store is a hash reference in this format :
1582
1583           $info->store = { attribute => { iid => value , iid2 => value2, ...
1584           } };
1585
1586       $info->_global()
1587           Used internally by AUTOLOAD to load dynamic methods from %GLOBALS.
1588
1589           Example: $info->name() calls autoload which calls
1590           $info->_global('name').
1591
1592       $info->_set(attr,val,iid,type)
1593           Used internally by AUTOLOAD to run an SNMP set command for dynamic
1594           methods listed in either %GLOBALS or %FUNCS or a valid mib leaf
1595           from a loaded MIB or the set_multi() method to set multiple
1596           variable in one command.  When run clears attr cache.
1597
1598           Attr is passed as either a scalar for dynamic methods or a
1599           reference to an array or array of arrays when used with
1600           set_multi().
1601
1602           Example:  $info->set_name('dog',3) uses autoload to resolve to
1603           $info->_set('name','dog',3);
1604
1605       $info->set_multi(arrayref)
1606           Used to run an SNMP set command on several new values in the one
1607           request.  Returns the result of $info->_set(method).
1608
1609           Pass either a reference to a 4 element array [<obj>, <iid>, <val>,
1610           <type>] or a reference to an array of 4 element arrays to specify
1611           multiple values.
1612
1613               <obj> - One of the following forms:
1614                   1) leaf identifier (e.g., C<'sysContact'>)
1615                   2) An entry in either %FUNCS, %GLOBALS (e.g., 'contact')
1616               <iid> - The dotted-decimal, instance identifier. For scalar MIB objects
1617                        use '0'
1618               <val>  - The SNMP data value being set (e.g., 'netdisco')
1619               <type> - Optional as the MIB should be loaded.
1620
1621           If one of the set assignments is invalid, then the request will be
1622           rejected without applying any of the new values - regardless of the
1623           order they appear in the list.
1624
1625           Example:
1626               my $vlan_set = [
1627                   ['qb_v_untagged',"$old_vlan_id","$old_untagged_portlist"],
1628                   ['qb_v_egress',"$new_vlan_id","$new_egress_portlist"],
1629                   ['qb_v_egress',"$old_vlan_id","$old_egress_portlist"],
1630                   ['qb_v_untagged',"$new_vlan_id","$new_untagged_portlist"],
1631                   ['qb_i_vlan',"$port","$new_vlan_id"],
1632               ];
1633
1634               $info->set_multi($vlan_set);
1635
1636       $info->load_all()
1637           Debugging routine.  This does not include any overridden method or
1638           method implemented by subroutine.
1639
1640           Runs $info->load_METHOD() for each entry in $info->funcs();
1641
1642           Returns $info->store() -- See store() entry.
1643
1644           Note return value has changed since version 0.3
1645
1646       $info->all()
1647           Runs $info->load_all() once then returns $info->store();
1648
1649           Use $info->load_all() to reload the data.
1650
1651           Note return value has changed since version 0.3
1652
1653       $info->_load_attr()
1654           Used internally by AUTOLOAD to fetch data called from methods
1655           listed in %FUNCS or a MIB Leaf node name.
1656
1657           Supports partial table fetches and single instance table fetches.
1658           See "Partial Table Fetches" in SNMP::Info.
1659
1660           Called from $info->load_METHOD();
1661
1662       $info->_show_attr()
1663           Used internally by AUTOLOAD to return data called by methods listed
1664           in %FUNCS.
1665
1666           Called like $info->METHOD().
1667
1668           The first time ran, it will call $info->load_METHOD().  Every time
1669           after it will return cached data.
1670
1671       $info->snmp_connect_ip(ip)
1672           Returns true or false based upon snmp connectivity to an IP.
1673
1674       modify_port_list(portlist,offset,replacement)
1675           Replaces the specified bit in a port_list array and returns the
1676           packed bitmask
1677
1678   AUTOLOAD
1679       Each entry in either %FUNCS, %GLOBALS, or MIB Leaf node names present
1680       in loaded MIBs are used by AUTOLOAD() to create dynamic methods.
1681
1682       Note that this AUTOLOAD is going to be run for all the classes listed
1683       in the @ISA array in a subclass, so will be called with a variety of
1684       package names.  We check the %FUNCS and %GLOBALS of the package that is
1685       doing the calling at this given instant.
1686
1687       1. Returns unless method is listed in %FUNCS, %GLOBALS, or is MIB Leaf
1688       node name in a loaded MIB for given class.
1689       2. Checks for load_ prefix and if present runs $info->_global(method)
1690       for methods which exist in %GLOBALS or are a single instance MIB Leaf
1691       node name, otherwise runs $info->_load_attr(method) for methods which
1692       exist in %FUNCS or are MIB Leaf node name contained within a table.
1693       This always forces reloading and does not use cached data.
1694       3. Check for set_ prefix and if present runs $info->_set(method).
1695       4. If the method exists in %GLOBALS or is a single instance MIB Leaf
1696       node name it runs $info->_global(method) unless already cached.
1697       5. If the method exists in %FUNCS or is MIB Leaf node name contained
1698       within a table it runs $info->_load_attr(method) if not cached.
1699       6. Otherwise return $info->_show_attr(method).
1700
1701       Override any dynamic method listed in one of these hashes by creating a
1702       subroutine with the same name.
1703
1704       For example to override $info->name() create `` sub name {...}'' in
1705       your subclass.
1706
1708       Changes from SNMP::Info Version 0.7 and on are: Copyright (c) 2003-2009
1709       Max Baker and SNMP::Info Developers All rights reserved.
1710
1711       Original Code is: Copyright (c) 2002-2003, Regents of the University of
1712       California All rights reserved.
1713
1714       Redistribution and use in source and binary forms, with or without
1715       modification, are permitted provided that the following conditions are
1716       met:
1717
1718           * Redistributions of source code must retain the above copyright notice,
1719             this list of conditions and the following disclaimer.
1720           * Redistributions in binary form must reproduce the above copyright
1721             notice, this list of conditions and the following disclaimer in the
1722             documentation and/or other materials provided with the distribution.
1723           * Neither the name of the University of California, Santa Cruz nor the
1724             names of its contributors may be used to endorse or promote products
1725             derived from this software without specific prior written permission.
1726
1727       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
1728       IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1729       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
1730       PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1731       OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1732       SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1733       LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1734       DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1735       THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1736       (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1737       OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1738
1739
1740
1741perl v5.12.0                      2010-05-06                           Info(3)
Impressum