1SNMP::Info(3) User Contributed Perl Documentation SNMP::Info(3)
2
3
4
6 SNMP::Info - OO Interface to Network devices and MIBs through SNMP
7
9 SNMP::Info - Version 3.93
10
12 SNMP::Info is maintained by team of Open Source authors headed by Eric
13 Miller, Bill Fenner, Max Baker, Jeroen van Ingen and Oliver Gorwits.
14
15 Please visit <https://github.com/netdisco/snmp-info/> for the most up-
16 to-date list of developers.
17
18 SNMP::Info was originally created at UCSC for the Netdisco project
19 <http://netdisco.org> by Max Baker.
20
22 There are now generic classes for most types of device and so the
23 authors recommend loading SNMP::Info with AutoSpecify, and then
24 reporting to the mail list any missing functionality (such as neighbor
25 discovery tables).
26
28 use SNMP::Info;
29
30 my $info = SNMP::Info->new({
31 # Auto Discover your Device Class (Cisco, Juniper, etc ...)
32 AutoSpecify => 1,
33 Debug => 1,
34
35 # The rest is passed to SNMP::Session
36 DestHost => 'router',
37 Community => 'public',
38 Version => 2
39
40 # Parameter reference for SNMPv3
41 # Version => 3
42 # SecLevel => 'authPriv', # authPriv|authNoPriv|noAuthNoPriv
43 # SecName => 'myuser',
44 # AuthProto => 'MD5', # MD5|SHA
45 # AuthPass => 'authp4ss',
46 # PrivProto => 'DES', # DES|AES
47 # PrivPass => 'pr1vp4ss',
48 });
49
50 my $err = $info->error();
51 die $err if defined $err;
52 # usually a wrong DestHost or Community or Version if you have trouble here
53
54 my $name = $info->name();
55 my $class = $info->class();
56 print "SNMP::Info is using this device class : $class\n";
57
58 # Find out the Duplex status for the ports
59 my $interfaces = $info->interfaces();
60 my $i_duplex = $info->i_duplex();
61
62 # Get CDP Neighbor info
63 my $c_if = $info->c_if();
64 my $c_ip = $info->c_ip();
65 my $c_port = $info->c_port();
66
67 # Print out data per port
68 foreach my $iid (keys %$interfaces){
69 my $duplex = $i_duplex->{$iid};
70 # Print out physical port name, not snmp iid
71 my $port = $interfaces->{$iid};
72
73 print "$port: ";
74 print "$duplex duplex" if defined $duplex;
75
76 # The CDP Table has table entries different than the interface tables.
77 # So we use c_if to get the map from cdp table to interface table.
78
79 my %c_map = reverse %$c_if;
80 my $c_key = $c_map{$iid};
81 unless (defined $c_key) {
82 print "\n\n";
83 next;
84 }
85 my $neighbor_ip = $c_ip->{$c_key};
86 my $neighbor_port = $c_port->{$c_key};
87
88 print " connected to $neighbor_ip / $neighbor_port\n" if defined $neighbor_ip;
89 print "\n";
90
91 }
92
94 Please direct all support, help, and bug requests to the snmp-info-
95 users Mailing List at
96 <http://lists.sourceforge.net/lists/listinfo/snmp-info-users>.
97
99 SNMP::Info gives an object oriented interface to information obtained
100 through SNMP.
101
102 This module is geared towards network devices. Subclasses exist for a
103 number of network devices and common MIBs.
104
105 The idea behind this module is to give a common interface to data from
106 network devices, leaving the device-specific hacks behind the scenes in
107 subclasses.
108
109 In the SYNOPSIS example we fetch the name of all the ports on the
110 device and the duplex setting for that port with two methods --
111 interfaces() and i_duplex().
112
113 The information may be coming from any number of MIB files and is very
114 vendor specific. SNMP::Info provides you a common method for all
115 supported devices.
116
117 Adding support for your own device is easy, and takes little SNMP
118 knowledge.
119
120 The module is not limited to network devices. Any MIB or device can be
121 given an objected oriented front-end by making a module that consists
122 of a couple hashes. See EXTENDING SNMP::INFO.
123
125 1. Net-SNMP
126 To use this module, you must have Net-SNMP installed on your
127 system. More specifically you need the Perl modules that come with
128 it.
129
130 DO NOT INSTALL SNMP:: or Net::SNMP from CPAN!
131
132 The SNMP module is matched to an install of net-snmp, and must be
133 installed from the net-snmp source tree.
134
135 The Perl module "SNMP" is found inside the net-snmp distribution.
136 Go to the perl/ directory of the distribution to install it, or run
137 "./configure --with-perl-modules" from the top directory of the
138 net-snmp distribution.
139
140 Net-SNMP can be found at http://net-snmp.sourceforge.net
141
142 Version 5.3.2 or greater is recommended.
143
144 Versions 5.0.1, 5.0301 and 5.0203 have issues with bulkwalk and are
145 not supported.
146
147 Redhat Users: Some versions that come with certain versions of
148 Redhat/Fedora don't have the Perl library installed. Uninstall the
149 RPM and install by hand.
150
151 2. MIBS
152 SNMP::Info operates on textual descriptors found in MIBs.
153
154 If you are using SNMP::Info separate from Netdisco, download the
155 Netdisco MIB package at
156 <https://github.com/netdisco/netdisco-mibs/releases/latest/>
157
158 Make sure that your snmp.conf is updated to point to your MIB
159 directory and that the MIBs are world-readable.
160
162 1. Use of textual MIB leaf identifier and enumerated values
163 • All values are retrieved via MIB Leaf node names
164
165 For example SNMP::Info has an entry in its %GLOBALS hash for
166 ``sysName'' instead of 1.3.6.1.2.1.1.5.
167
168 • Data returned is in the enumerated value form.
169
170 For Example instead of looking up 1.3.6.1.2.1.2.2.1.3 and
171 getting back 23
172
173 SNMP::Info will ask for "RFC1213-MIB::ifType" and will get back
174 "ppp".
175
176 2. SNMP::Info is easily extended to new devices
177 You can create a new subclass for a device by providing four hashes
178 : %GLOBALS, %MIBS, %FUNCS, and %MUNGE.
179
180 Or you can override any existing methods from a parent class by
181 making a short subroutine.
182
183 See the section EXTENDING SNMP::INFO for more details.
184
185 When you make a new subclass for a device, please be sure to send
186 it back to the developers (via a github pull request or the mailing
187 list) for inclusion in the next version.
188
190 These are the subclasses that implement MIBs and support devices:
191
192 Required MIBs not included in the install instructions above are noted
193 here.
194
195 MIB Subclasses
196 These subclasses implement method to access one or more MIBs. These
197 are not used directly, but rather inherited from device subclasses.
198
199 For more info run "perldoc" on any of the following module names.
200
201 SNMP::Info::AdslLine
202 SNMP Interface to the ADSL-LINE-MIB for ADSL interfaces.
203
204 Requires the ADSL-LINE-MIB, down loadable from Cisco.
205
206 See documentation in SNMP::Info::AdslLine for details.
207
208 SNMP::Info::Aggregate
209 SNMP Interface to IF-MIB "ifStackTable" Aggregated Links
210
211 See documentation in SNMP::Info::Aggregate for details.
212
213 SNMP::Info::Airespace
214 AIRESPACE-WIRELESS-MIB and AIRESPACE-SWITCHING-MIB. Inherited by
215 devices based on the Airespace wireless platform.
216
217 See documentation in SNMP::Info::Airespace for details.
218
219 SNMP::Info::AMAP
220 ALCATEL-IND1-INTERSWITCH-PROTOCOL-MIB. Alcatel Mapping Adjacency
221 Protocol (AMAP) Support.
222
223 See documentation in SNMP::Info::AMAP for details.
224
225 SNMP::Info::Bridge
226 BRIDGE-MIB (RFC1286). Q-BRIDGE-MIB. Inherited by devices with
227 Layer2 support.
228
229 See documentation in SNMP::Info::Bridge for details.
230
231 SNMP::Info::CDP
232 CISCO-CDP-MIB. Cisco Discovery Protocol (CDP) Support. Inherited
233 by Cisco, Enterasys, and HP devices.
234
235 See documentation in SNMP::Info::CDP for details.
236
237 SNMP::Info::CiscoAgg
238 SNMP Interface to Cisco Aggregated Links
239
240 See documentation in SNMP::Info::CiscoAgg for details.
241
242 SNMP::Info::CiscoBGP
243 CISCO-BGP4-MIB. Cisco BGPv4 support. Inherited by Cisco devices
244 with Layer3 support.
245
246 See documentation in SNMP::Info::CiscoBGP for details.
247
248 SNMP::Info::CiscoConfig
249 CISCO-CONFIG-COPY-MIB, CISCO-FLASH-MIB, and OLD-CISCO-SYS-MIB.
250 These OIDs facilitate the writing of configuration files.
251
252 See documentation in SNMP::Info::CiscoConfig for details.
253
254 SNMP::Info::CiscoPortSecurity
255 CISCO-PORT-SECURITY-MIB and CISCO-PAE-MIB.
256
257 See documentation in SNMP::Info::CiscoPortSecurity for details.
258
259 SNMP::Info::CiscoPower
260 CISCO-POWER-ETHERNET-EXT-MIB.
261
262 See documentation in SNMP::Info::CiscoPower for details.
263
264 SNMP::Info::CiscoQOS
265 CISCO-CLASS-BASED-QOS-MIB. A collection of OIDs providing
266 information about a Cisco device's QOS config.
267
268 See documentation in SNMP::Info::CiscoQOS for details.
269
270 SNMP::Info::CiscoRTT
271 CISCO-RTTMON-MIB. A collection of OIDs providing information about
272 a Cisco device's RTT values.
273
274 See documentation in SNMP::Info::CiscoRTT for details.
275
276 SNMP::Info::CiscoStack
277 CISCO-STACK-MIB.
278
279 See documentation in SNMP::Info::CiscoStack for details.
280
281 SNMP::Info::CiscoStats
282 OLD-CISCO-CPU-MIB, CISCO-PROCESS-MIB, and CISCO-MEMORY-POOL-MIB.
283 Provides common interfaces for memory, cpu, and os statistics for
284 Cisco devices.
285
286 See documentation in SNMP::Info::CiscoStats for details.
287
288 SNMP::Info::CiscoStpExtensions
289 CISCO-STP-EXTENSIONS-MIB
290
291 See documentation in SNMP::Info::CiscoStpExtensions for details.
292
293 SNMP::Info::CiscoVTP
294 CISCO-VTP-MIB, CISCO-VLAN-MEMBERSHIP-MIB, CISCO-VLAN-IFTABLE-
295 RELATIONSHIP-MIB
296
297 See documentation in SNMP::Info::CiscoVTP for details.
298
299 SNMP::Info::DocsisCM
300 SNMP Interface for DOCSIS Cable Modems
301
302 See documentation in SNMP::Info::DocsisCM for details.
303
304 SNMP::Info::DocsisHE
305 SNMP Interface for DOCSIS CMTS
306
307 See documentation in SNMP::Info::DocsisHE for details.
308
309 SNMP::Info::EDP
310 Extreme Discovery Protocol. EXTREME-EDP-MIB
311
312 See documentation in SNMP::Info::EDP for details.
313
314 SNMP::Info::Entity
315 ENTITY-MIB. Used for device info in Cisco and other vendors.
316
317 See documentation in SNMP::Info::Entity for details.
318
319 SNMP::Info::EtherLike
320 EtherLike-MIB (RFC1398) - Some Layer3 devices implement this MIB,
321 as well as some Aironet Layer 2 devices (non Cisco).
322
323 See documentation in SNMP::Info::EtherLike for details.
324
325 SNMP::Info::FDP
326 Foundry (Brocade) Discovery Protocol. FOUNDRY-SN-SWITCH-GROUP-MIB
327
328 See documentation in SNMP::Info::FDP for details.
329
330 SNMP::Info::IEEE802_Bridge
331 SNMP Interface to data available through the IEEE8021-Q-BRIDGE-MIB
332
333 See documentation in SNMP::Info::IEEE802_Bridge for details.
334
335 SNMP::Info::IEEE802dot11
336 IEEE802dot11-MIB. A collection of OIDs providing information about
337 standards based 802.11 wireless devices.
338
339 See documentation in SNMP::Info::IEEE802dot11 for details.
340
341 SNMP::Info::IEEE802dot3ad
342 SNMP Interface to IEEE Aggregated Links. IEEE8023-LAG-MIB
343
344 See documentation in SNMP::Info::IEEE802dot3ad for details.
345
346 SNMP::Info::IPv6
347 SNMP Interface for obtaining configured IPv6 addresses and mapping
348 IPv6 addresses to MAC addresses and interfaces, using information
349 from IP-MIB, IPV6-MIB and/or CISCO-IETF-IP-MIB.
350
351 See documentation in SNMP::Info::IPv6 for details.
352
353 SNMP::Info::LLDP
354 LLDP-MIB, LLDP-EXT-DOT1-MIB, and LLDP-EXT-DOT3-MIB. Link Layer
355 Discovery Protocol (LLDP) Support.
356
357 See documentation in SNMP::Info::LLDP for details.
358
359 SNMP::Info::MAU
360 MAU-MIB (RFC2668). Some Layer2 devices use this for extended
361 Ethernet (Medium Attachment Unit) interface information.
362
363 See documentation in SNMP::Info::MAU for details.
364
365 SNMP::Info::MRO
366 Method resolution introspection for SNMP::Info
367
368 See documentation in SNMP::Info::MRO for details.
369
370 SNMP::Info::NortelStack
371 S5-AGENT-MIB, S5-CHASSIS-MIB.
372
373 See documentation in SNMP::Info::NortelStack for details.
374
375 SNMP::Info::PortAccessEntity
376 IEEE8021-PAE-MIB
377
378 See documentation in SNMP::Info::PortAccessEntity for details.
379
380 SNMP::Info::PowerEthernet
381 POWER-ETHERNET-MIB
382
383 See documentation in SNMP::Info::PowerEthernet for details.
384
385 SNMP::Info::RapidCity
386 RAPID-CITY. Inherited by Avaya switches for duplex and VLAN
387 information.
388
389 See documentation in SNMP::Info::RapidCity for details.
390
391 SNMP::Info::SONMP
392 SynOptics Network Management Protocol (SONMP) SYNOPTICS-ROOT-MIB,
393 S5-ETH-MULTISEG-TOPOLOGY-MIB. Inherited by
394 Avaya/Nortel/Bay/Synoptics switches and hubs.
395
396 See documentation in SNMP::Info::SONMP for details.
397
398 Device Subclasses
399 These subclasses inherit from one or more classes to provide a common
400 interface to data obtainable from network devices.
401
402 All the required MIB files are included in the netdisco-mib package.
403 (See Above).
404
405 SNMP::Info::Layer1
406 Generic Layer1 Device subclass.
407
408 See documentation in SNMP::Info::Layer1 for details.
409
410 SNMP::Info::Layer1::Allied
411 Subclass for Allied Telesis Repeaters / Hubs.
412
413 Requires ATI-MIB
414
415 See documentation in SNMP::Info::Layer1::Allied for details.
416
417 SNMP::Info::Layer1::Asante
418 Subclass for Asante 1012 Hubs.
419
420 Requires ASANTE-HUB1012-MIB
421
422 See documentation in SNMP::Info::Layer1::Asante for details.
423
424 SNMP::Info::Layer1::Bayhub
425 Subclass for Nortel/Bay hubs. This includes System 5000, 100
426 series, 200 series, and probably more.
427
428 See documentation in SNMP::Info::Layer1::Bayhub for details.
429
430 SNMP::Info::Layer1::Cyclades
431 Subclass for Cyclades/Avocent terminal servers.
432
433 See documentation in SNMP::Info::Layer1::Cyclades for details.
434
435 SNMP::Info::Layer1::S3000
436 Subclass for Bay/Synoptics hubs. This includes System 3000,
437 281X, and probably more.
438
439 See documentation in SNMP::Info::Layer1::S3000 for details.
440
441 SNMP::Info::Layer2
442 Generic Layer2 Device subclass.
443
444 See documentation in SNMP::Info::Layer2 for details.
445
446 SNMP::Info::Layer2::3Com
447 Subclass for L2 3Com Switches.
448
449 See documentation in SNMP::Info::Layer2::3Com for details.
450
451 SNMP::Info::Layer2::Adtran
452 Subclass for Adtran devices.
453
454 See documentation in SNMP::Info::Layer2::Adtran for details.
455
456 SNMP::Info::Layer2::Aerohive
457 Subclass for Aerohive / Extreme access points.
458
459 See documentation in SNMP::Info::Layer2::Aerohive for details.
460
461 SNMP::Info::Layer2::Airespace
462 Subclass for Cisco (Airespace) wireless controllers.
463
464 See documentation in SNMP::Info::Layer2::Airespace for details.
465
466 SNMP::Info::Layer2::Aironet
467 Class for Cisco Aironet wireless devices that run IOS. See
468 also SNMP::Info::Layer3::Aironet for Aironet devices that don't
469 run IOS.
470
471 See documentation in SNMP::Info::Layer2::Aironet for details.
472
473 SNMP::Info::Layer2::Allied
474 Allied Telesis switches.
475
476 See documentation in SNMP::Info::Layer2::Allied for details.
477
478 SNMP::Info::Layer2::Atmedia
479 Subclass for atmedia encryptors.
480
481 See documentation in SNMP::Info::Layer2::Atmedia for details.
482
483 SNMP::Info::Layer2::Baystack
484 Subclass for Avaya/Nortel/Bay Ethernet Switch/Baystack
485 switches. This includes 303, 304, 350, 380, 410, 420, 425,
486 450, 460, 470 series, 2500 series, 4000 series, 5000 series,
487 Business Ethernet Switch (BES), Business Policy Switch (BPS),
488 VSP 7000 series, and probably others.
489
490 See documentation in SNMP::Info::Layer2::Baystack for details.
491
492 SNMP::Info::Layer2::C1900
493 Subclass for Cisco Catalyst 1900 and 1900c Devices running
494 CatOS.
495
496 See documentation in SNMP::Info::Layer2::C1900 for details.
497
498 SNMP::Info::Layer2::C2900
499 Subclass for Cisco Catalyst 2900, 2950, 3500XL, and 3548
500 devices running IOS.
501
502 See documentation in SNMP::Info::Layer2::C2900 for details.
503
504 SNMP::Info::Layer2::Catalyst
505 Subclass for Cisco Catalyst switches running CatOS. These
506 switches usually report a model number that starts with "wsc".
507 Note that this class does not support everything that has the
508 name Catalyst.
509
510 See documentation in SNMP::Info::Layer2::Catalyst for details.
511
512 SNMP::Info::Layer2::Centillion
513 Subclass for Nortel/Bay Centillion and 5000BH ATM switches.
514
515 See documentation in SNMP::Info::Layer2::Centillion for
516 details.
517
518 SNMP::Info::Layer2::Cisco
519 Generic Cisco subclass for layer 2 devices that are not yet
520 supported in more specific subclasses and the base layer 2
521 Cisco class for other device specific layer 2 Cisco classes.
522
523 See documentation in SNMP::Info::Layer2::Cisco for details.
524
525 SNMP::Info::Layer2::CiscoSB
526 Subclass for Cisco's "Small Business" product line, acquired
527 from Linksys. This currently comprises the Sx300/500 line of
528 switches.
529
530 See documentation in SNMP::Info::Layer2::CiscoSB for details.
531
532 SNMP::Info::Layer2::Exinda
533 Subclass for Exinda / GFI Network Orchestrator traffic shapers.
534
535 See documentation in SNMP::Info::Layer2::Exinda for details.
536
537 SNMP::Info::Layer2::Hirschmann
538 Subclass for Hirschmann switches
539
540 See documentation in SNMP::Info::Layer2::Hirschmann for
541 details.
542
543 SNMP::Info::Layer2::HP
544 Subclass for more recent HP Procurve Switches.
545
546 Requires HP-ICF-OID and ENTITY-MIB downloaded from HP.
547
548 See documentation in SNMP::Info::Layer2::HP for details.
549
550 SNMP::Info::Layer2::HP4000
551 Subclass for older HP Procurve Switches
552
553 Requires HP-ICF-OID and ENTITY-MIB downloaded from HP.
554
555 See documentation in SNMP::Info::Layer2::HP4000 for details.
556
557 SNMP::Info::Layer2::HPVC
558 Subclass for HP Virtual Connect Switches
559
560 See documentation in SNMP::Info::Layer2::HPVC for details.
561
562 SNMP::Info::Layer2::Kentrox
563 Class for Kentrox DataSMART DSU/CSU.
564
565 See documentation in SNMP::Info::Layer2::Kentrox for details.
566
567 SNMP::Info::Layer2::N2270
568 Subclass for Nortel 2270 wireless switches.
569
570 See documentation in SNMP::Info::Layer2::N2270 for details.
571
572 SNMP::Info::Layer2::NAP222x
573 Subclass for Nortel 222x series wireless access points.
574
575 See documentation in SNMP::Info::Layer2::NAP222x for details.
576
577 SNMP::Info::Layer2::Netgear
578 Subclass for Netgear switches
579
580 See documentation in SNMP::Info::Layer2::Netgear for details.
581
582 SNMP::Info::Layer2::Nexans
583 Subclass for Nexans switches
584
585 See documentation in SNMP::Info::Layer2::Nexans for details.
586
587 SNMP::Info::Layer2::NWSS2300
588 SNMP Interface to Avaya (Trapeze) Wireless Controllers
589
590 See documentation in SNMP::Info::Layer2::NWSS2300 for details.
591
592 SNMP::Info::Layer2::Orinoco
593 Subclass for Orinoco/Proxim wireless access points.
594
595 See documentation in SNMP::Info::Layer2::Orinoco for details.
596
597 SNMP::Info::Layer2::Trapeze
598 SNMP Interface to Juniper (Trapeze) Wireless Controllers
599
600 See documentation in SNMP::Info::Layer2::Trapeze for details.
601
602 SNMP::Info::Layer2::Sixnet
603 SNMP Interface to Sixnet industrial switches
604
605 See documentation in SNMP::Info::Layer2::Sixnet for details.
606
607 SNMP::Info::Layer2::Ubiquiti
608 SNMP Interface to Ubiquiti Access Points and other devices
609
610 See documentation in SNMP::Info::Layer2::Ubiquiti for details.
611
612 SNMP::Info::Layer2::ZyXEL_DSLAM
613 Zyxel DSLAMs. Need I say more?
614
615 See documentation in SNMP::Info::Layer2::ZyXEL_DSLAM for
616 details.
617
618 SNMP::Info::Layer3
619 Generic Layer3 and Layer2+3 Device subclass.
620
621 See documentation in SNMP::Info::Layer3 for details.
622
623 SNMP::Info::Layer3::Aironet
624 Subclass for Cisco Aironet wireless access points (AP) not
625 running IOS. These are usually older devices.
626
627 Note SNMP::Info::Layer2::Aironet
628
629 See documentation in SNMP::Info::Layer3::Aironet for details.
630
631 SNMP::Info::Layer3::AlcatelLucent
632 Alcatel-Lucent OmniSwitch Class.
633
634 See documentation in SNMP::Info::Layer3::AlcatelLucent for
635 details.
636
637 SNMP::Info::Layer3::AlteonAD
638 Subclass for Radware Alteon Series ADC switches and Nortel
639 BladeCenter Layer2-3 GbE Switch Modules.
640
641 See documentation in SNMP::Info::Layer3::AlteonAD for details.
642
643 SNMP::Info::Layer3::Altiga
644 See documentation in SNMP::Info::Layer3::Altiga for details.
645
646 SNMP::Info::Layer3::Arista
647 See documentation in SNMP::Info::Layer3::Arista for details.
648
649 SNMP::Info::Layer3::Aruba
650 Subclass for Aruba wireless switches.
651
652 See documentation in SNMP::Info::Layer3::Aruba for details.
653
654 SNMP::Info::Layer3::ArubaCX
655 SNMP Interface to L3 Devices running ArubaOS-CX
656
657 See documentation in SNMP::Info::Layer3::ArubaCX for details.
658
659 SNMP::Info::Layer3::BayRS
660 Subclass for Avaya/Nortel/Bay Multiprotocol/BayRS routers.
661 This includes BCN, BLN, ASN, ARN, AN, 2430, and 5430 routers.
662
663 See documentation in SNMP::Info::Layer3::BayRS for details.
664
665 SNMP::Info::Layer3::BlueCoatSG
666 Subclass for BlueCoat SG series proxy devices.
667
668 See documentation in SNMP::Info::Layer3::BlueCoatSG for
669 details.
670
671 SNMP::Info::Layer3::C3550
672 Subclass for Cisco Catalyst 3550,3540,3560 2/3 switches running
673 IOS.
674
675 See documentation in SNMP::Info::Layer3::C3550 for details.
676
677 SNMP::Info::Layer3::C4000
678 This class covers Catalyst 4000s and 4500s.
679
680 See documentation in SNMP::Info::Layer3::C4000 for details.
681
682 SNMP::Info::Layer3::C6500
683 This class covers Catalyst 6500 series running CatOS or IOS, as
684 well as Catalyst 2960, 2970, 3750 and 3850 series, including
685 blade switches CBS30x0 and CBS31x0 series, all running IOS.
686
687 See documentation in SNMP::Info::Layer3::C6500 for details.
688
689 SNMP::Info::Layer3::CheckPoint
690 Subclass for CheckPoint devices.
691
692 See documentation in SNMP::Info::Layer3::CheckPoint for
693 details.
694
695 SNMP::Info::Layer3::Ciena
696 Subclass for Ciena devices.
697
698 See documentation in SNMP::Info::Layer3::Ciena for details.
699
700 SNMP::Info::Layer3::Cisco
701 This is a simple wrapper around layer 3 for IOS devices and the
702 base layer 3 Cisco class for other device specific layer 3
703 Cisco classes.
704
705 See documentation in SNMP::Info::Layer3::Cisco for details.
706
707 SNMP::Info::Layer3::CiscoASA
708 Subclass for Cisco Adaptive Security Appliances.
709
710 See documentation in SNMP::Info::Layer3::CiscoASA for details.
711
712 SNMP::Info::Layer3::CiscoFWSM
713 Subclass for Cisco Firewall Services Modules.
714
715 See documentation in SNMP::Info::Layer3::CiscoFWSM for details.
716
717 SNMP::Info::Layer3::CiscoSwitch
718 Base class for L3 Cisco switches. See documentation in
719 SNMP::Info::Layer3::CiscoSwitch for details.
720
721 SNMP::Info::Layer3::Contivity
722 Subclass for Avaya/Nortel Contivity/VPN Routers.
723
724 See documentation in SNMP::Info::Layer3::Contivity for details.
725
726 SNMP::Info::Layer3::Cumulus
727 Subclass for Cumulus Networks Routers.
728
729 See documentation in SNMP::Info::Layer3::Cumulus for details.
730
731 SNMP::Info::Layer3::Dell
732 Subclass for Dell PowerConnect switches. The IBM BladeCenter
733 Gigabit Ethernet Switch Module and some Linksys switches also
734 use this module based upon MIB support.
735
736 See documentation in SNMP::Info::Layer3::Dell for details.
737
738 SNMP::Info::Layer3::DLink
739 Subclass for DLink devices.
740
741 See documentation in SNMP::Info::Layer3::DLink for details.
742
743 SNMP::Info::Layer3::Enterasys
744 Subclass for Enterasys devices.
745
746 See documentation in SNMP::Info::Layer3::Enterasys for details.
747
748 SNMP::Info::Layer3::ERX
749 Subclass for Juniper ERX switches.
750
751 See documentation in SNMP::Info::Layer3::ERX for details.
752
753 SNMP::Info::Layer3::Extreme
754 Subclass for Extreme Networks switches.
755
756 See documentation in SNMP::Info::Layer3::Extreme for details.
757
758 SNMP::Info::Layer3::F5
759 Subclass for F5 devices.
760
761 See documentation in SNMP::Info::Layer3::F5 for details.
762
763 SNMP::Info::Layer3::Force10
764 Subclass for Force10 devices.
765
766 See documentation in SNMP::Info::Layer3::Force10 for details.
767
768 SNMP::Info::Layer3::Fortinet
769 Subclass for Fortinet devices.
770
771 See documentation in SNMP::Info::Layer3::Fortinet for details.
772
773 SNMP::Info::Layer3::Foundry
774 Subclass for Brocade (Foundry) Network devices.
775
776 See documentation in SNMP::Info::Layer3::Foundry for details.
777
778 SNMP::Info::Layer3::Genua
779 Subclass for Genua security devices.
780
781 See documentation in SNMP::Info::Layer3::Genua for details.
782
783 SNMP::Info::Layer3::H3C
784 SNMP Interface to Layer 3 Devices, H3C & HP A-series.
785
786 See documentation in SNMP::Info::Layer3::H3C for details.
787
788 SNMP::Info::Layer3::HP9300
789 Subclass for HP network devices which Foundry Networks was the
790 Original Equipment Manufacturer (OEM) such as the HP ProCurve
791 9300 and 6300 series.
792
793 See documentation in SNMP::Info::Layer3::HP9300 for details.
794
795 SNMP::Info::Layer3::Huawei
796 SNMP Interface to Huawei Layer 3 switches and routers.
797
798 See documentation in SNMP::Info::Layer3::Huawei for details.
799
800 SNMP::Info::Layer3::IBMGbTor
801 SNMP Interface to IBM Rackswitch (formerly Blade Network
802 Technologies) network devices. Lenovo acquired these from IBM
803 and is now selling them under the Lenovo brand.
804
805 See documentation in SNMP::Info::Layer3::IBMGbTor for details.
806
807 SNMP::Info::Layer3::Juniper
808 Subclass for Juniper devices.
809
810 See documentation in SNMP::Info::Layer3::Juniper for details.
811
812 SNMP::Info::Layer3::Lantronix
813 Subclass for Lantronix devices.
814
815 See documentation in SNMP::Info::Layer3::Lantronix for details.
816
817 SNMP::Info::Layer3::Lenovo
818 Subclass for Lenovo switches running CNOS.
819
820 See documentation in SNMP::Info::Layer3::Lenovo for details.
821
822 SNMP::Info::Layer3::Microsoft
823 Subclass for Generic Microsoft Routers running Microsoft
824 Windows OS.
825
826 See documentation in SNMP::Info::Layer3::Microsoft for details.
827
828 SNMP::Info::Layer3::Mikrotik
829 Subclass for Mikrotik devices running RouterOS.
830
831 See documentation in SNMP::Info::Layer3::Mikrotik for details.
832
833 SNMP::Info::Layer3::N1600
834 Subclass for Avaya/Nortel Ethernet Routing Switch 1600 series.
835
836 See documentation in SNMP::Info::Layer3::N1600 for details.
837
838 SNMP::Info::Layer3::Netonix
839 Subclass for Netonix switches.
840
841 See documentation in SNMP::Info::Layer3::Netonix for details.
842
843 SNMP::Info::Layer3::NetSNMP
844 Subclass for host systems running Net-SNMP.
845
846 See documentation in SNMP::Info::Layer3::NetSNMP for details.
847
848 SNMP::Info::Layer3::Netscreen
849 Subclass for Juniper NetScreen.
850
851 See documentation in SNMP::Info::Layer3::Netscreen for details.
852
853 SNMP::Info::Layer3::Nexus
854 Subclass for Cisco Nexus devices running NX-OS.
855
856 See documentation in SNMP::Info::Layer3::Nexus for details.
857
858 SNMP::Info::Layer3::OneAccess
859 Subclass for OneAccess routers.
860
861 See documentation in SNMP::Info::Layer3::OneAccess for details.
862
863 SNMP::Info::Layer3::PacketFront
864 Subclass for PacketFront DRG series CPE.
865
866 See documentation in SNMP::Info::Layer3::PacketFront for
867 details.
868
869 SNMP::Info::Layer3::PaloAlto
870 Subclass for Palo Alto firewalls.
871
872 See documentation in SNMP::Info::Layer3::PaloAlto for details.
873
874 SNMP::Info::Layer3::Passport
875 Subclass for Avaya/Nortel Ethernet Routing Switch/Passport 8000
876 series, Accelar, and VSP 9000 series switches.
877
878 See documentation in SNMP::Info::Layer3::Passport for details.
879
880 SNMP::Info::Layer3::Pf
881 Subclass for FreeBSD-Based Firewalls using Pf /Pf Sense
882
883 See documentation in SNMP::Info::Layer3::Pf for details.
884
885 SNMP::Info::Layer3::Pica8
886 Subclass for Pica8 devices.
887
888 See documentation in SNMP::Info::Layer3::Pica8 for details.
889
890 SNMP::Info::Layer3::Redlion
891 Subclass for redlion routers.
892
893 See documentation in SNMP::Info::Layer3::Redlion for details.
894
895 SNMP::Info::Layer3::Scalance
896 Subclass for Siemens Scalance devices.
897
898 See documentation in SNMP::Info::Layer3::Scalance for details.
899
900 SNMP::Info::Layer3::SonicWALL
901 Subclass for generic SonicWALL devices.
902
903 See documentation in SNMP::Info::Layer3::SonicWALL for details.
904
905 SNMP::Info::Layer3::Steelfusion
906 Subclass for Riverbed Steelfusion WAN optimization appliances.
907
908 See documentation in SNMP::Info::Layer3::Steelfusion for
909 details.
910
911 SNMP::Info::Layer3::Steelhead
912 Subclass for Riverbed Steelhead WAN optimization appliances.
913
914 See documentation in SNMP::Info::Layer3::Steelhead for details.
915
916 SNMP::Info::Layer3::SteelheadEx
917 Subclass for Riverbed SteelheadEx WAN optimization appliances.
918
919 See documentation in SNMP::Info::Layer3::SteelheadEx for
920 details.
921
922 SNMP::Info::Layer3::Sun
923 Subclass for Generic Sun Routers running SunOS.
924
925 See documentation in SNMP::Info::Layer3::Sun for details.
926
927 SNMP::Info::Layer3::Tasman
928 Subclass for Avaya Secure Routers.
929
930 See documentation in SNMP::Info::Layer3::Tasman for details.
931
932 SNMP::Info::Layer3::Teltonika
933 Subclass for Teltonika RUT9xx series routers.
934
935 See documentation in SNMP::Info::Layer3::Teltonika for details.
936
937 SNMP::Info::Layer3::Timetra
938 Alcatel-Lucent SR Class.
939
940 See documentation in SNMP::Info::Layer3::Timetra for details.
941
942 SNMP::Info::Layer3::VyOS
943 Subclass for VyOS routers.
944
945 See documentation in SNMP::Info::Layer3::VyOS for details.
946
947 SNMP::Info::Layer3::VMware
948 Subclass for VMware ESXi hosts.
949
950 See documentation in SNMP::Info::Layer3::VMware for details.
951
952 SNMP::Info::Layer3::Whiterabbit
953 Subclass for whiterabbit devices.
954
955 See documentation in SNMP::Info::Layer3::Whiterabbit for
956 details.
957
958 SNMP::Info::Layer7
959 Generic Layer7 Devices.
960
961 See documentation in SNMP::Info::Layer7 for details.
962
963 SNMP::Info::Layer7::APC
964 Subclass for APC UPS devices.
965
966 See documentation in SNMP::Info::Layer7::APC for details.
967
968 SNMP::Info::Layer7::Arbor
969 Subclass for Arbor appliances.
970
971 See documentation in SNMP::Info::Layer7::Arbor for details.
972
973 SNMP::Info::Layer7::CiscoIPS
974 Subclass for Cisco IPS devices.
975
976 See documentation in SNMP::Info::Layer7::CiscoIPS for details.
977
978 SNMP::Info::Layer7::Gigamon
979 Subclass for Gigamon devices.
980
981 See documentation in SNMP::Info::Layer7::Gigamon for details.
982
983 SNMP::Info::Layer7::HWGroup
984 Subclass for HW Group devices.
985
986 See documentation in SNMP::Info::Layer7::HWGroup for details.
987
988 SNMP::Info::Layer7::Liebert
989 Subclass for Liebert devices.
990
991 See documentation in SNMP::Info::Layer7::Liebert for details.
992
993 SNMP::Info::Layer7::Neoteris
994 Subclass for Pulse Secure / Juniper SSL VPN appliances.
995
996 See documentation in SNMP::Info::Layer7::Neoteris for details.
997
998 SNMP::Info::Layer7::Netscaler
999 Subclass for Citrix Netscaler appliances.
1000
1001 See documentation in SNMP::Info::Layer7::Netscaler for details.
1002
1004 Thanks for testing and coding help (in no particular order) to :
1005 Alexander Barthel, Andy Ford, Alexander Hartmaier, Andrew Herrick, Alex
1006 Kramarov, Bernhard Augenstein, Bradley Baetz, Brian Chow, Brian Wilson,
1007 Carlos Vicente, Dana Watanabe, David Pinkoski, David Sieborger, Douglas
1008 McKeown, Greg King, Ivan Auger, Jean-Philippe Luiggi, Jeroen van Ingen,
1009 Justin Hunter, Kent Hamilton, Matthew Tuttle, Michael Robbert, Mike
1010 Hunter, Nicolai Petri, Ralf Gross, Robert Kerr, Nick Nauwelaerts and
1011 people listed on the Netdisco README!
1012
1014 Constructor
1015 new()
1016 Creates a new object and connects via SNMP::Session.
1017
1018 Always returns an SNMP::Info instance, and you should always check
1019 for error() as in SYNOPSIS above to be sure of success.
1020
1021 Will take a bare list of key/value options but we recommend a HASH
1022 ref as in the example below and SYNOPSIS, to catch syntax errors.
1023
1024 my $info = SNMP::Info->({ 'Debug' => 1,
1025 'AutoSpecify' => 1,
1026 'BigInt' => 1,
1027 'BulkWalk' => 1,
1028 'BulkRepeaters' => 20,
1029 'LoopDetect' => 1,
1030 'IgnoreNetSNMPConf' => 1,
1031 'DestHost' => 'myrouter',
1032 'Community' => 'public',
1033 'Version' => 2,
1034 'MibDirs' => ['dir1','dir2','dir3'],
1035 });
1036
1037 SNMP::Info Specific Arguments :
1038
1039 AutoSpecify
1040 Returns an object of a more specific device class
1041
1042 (default 0, which means "off")
1043
1044 BigInt
1045 Return Math::BigInt objects for 64 bit counters. Sets on a
1046 global scope, not object.
1047
1048 (default 0, which means "off")
1049
1050 BulkWalk
1051 Set to 0 to turn off BULKWALK commands for SNMPv2 connections.
1052
1053 Note that BULKWALK is turned off for Net-SNMP versions 5.1.x
1054 because of a bug.
1055
1056 (default 1, which means "on")
1057
1058 BulkRepeaters
1059 Set number of MaxRepeaters for BULKWALK operation. See
1060 "perldoc SNMP" -> bulkwalk() for more info.
1061
1062 (default 20)
1063
1064 LoopDetect
1065 Detects looping during getnext table column walks by comparing
1066 IIDs for each instance. A loop is detected if the same IID is
1067 seen more than once and the walk is aborted. Note: This will
1068 not detect loops during a bulkwalk operation, Net-SNMP's
1069 internal bulkwalk function must detect the loop.
1070
1071 Set to 0 to turn off loop detection.
1072
1073 (default 1, which means "on")
1074
1075 IgnoreNetSNMPConf
1076 Net-SNMP version 5.0 and higher read configuration files,
1077 snmp.conf or snmp.local.conf, from /etc/snmp, /usr/share/snmp,
1078 /usr/lib(64)/snmp, or $HOME/.snmp and uses those settings to
1079 automatically parse MIB files, etc.
1080
1081 Set to 1 "on" to ignore Net-SNMP configuration files by
1082 overriding the "SNMPCONFPATH" environmental variable during
1083 object initialization. Note: MibDirs must be defined or Net-
1084 SNMP will not be able to load MIBs and initialize the object.
1085
1086 (default 0, which means "off")
1087
1088 Debug
1089 Prints Lots of debugging messages. Pass 2 to print even more
1090 debugging messages.
1091
1092 (default 0, which means "off")
1093
1094 DebugSNMP
1095 Set $SNMP::debugging level for Net-SNMP.
1096
1097 See SNMP for more details.
1098
1099 MibDirs
1100 Array ref to list of directories in which to look for MIBs.
1101 Note this will be in addition to the ones setup in snmp.conf at
1102 the system level.
1103
1104 (default use net-snmp settings only)
1105
1106 RetryNoSuch
1107 When using SNMP Version 1, try reading values even if they come
1108 back as "no such variable in this MIB". Set to false if so
1109 desired. This feature lets you read SNMPv2 data from an SNMP
1110 version 1 connection, and should probably be left on.
1111
1112 (default 1, which means "on")
1113
1114 Session
1115 SNMP::Session object to use instead of connecting on own.
1116
1117 (default creates session automatically)
1118
1119 Offline
1120 Causes SNMP::Info to avoid network activity and return data
1121 only from its cache. If you ask for something not in the cache,
1122 an error is thrown. See also the cache() and offline()
1123 methods.
1124
1125 (default 0, which means "online")
1126
1127 Cache
1128 Pass in a HashRef to prime the cache of retrieved data. Useful
1129 for creating an instance in "Offline" mode from a previously
1130 dumped cache. See also the cache() method to retrieve a cache
1131 after running actial queries.
1132
1133 OTHER
1134 All other arguments are passed to SNMP::Session.
1135
1136 See SNMP::Session for a list of other possible arguments.
1137
1138 A Note about the wrong Community string or wrong SNMP Version:
1139
1140 If a connection is using the wrong community string or the wrong
1141 SNMP version, the creation of the object will not fail. The device
1142 still answers the call on the SNMP port, but will not return
1143 information. Check the error() method after you create the device
1144 object to see if there was a problem in connecting.
1145
1146 A note about SNMP Versions :
1147
1148 Some older devices don't support SNMP version 2, and will not
1149 return anything when a connection under Version 2 is attempted.
1150
1151 Some newer devices will support Version 1, but will not return all
1152 the data they might have if you had connected under Version 1.
1153
1154 When trying to get info from a new device, you may have to try
1155 version 2 and then fallback to version 1.
1156
1157 update()
1158 Replace the existing session with a new one with updated values,
1159 without re-identifying the device. The only supported changes are
1160 to Community or Context.
1161
1162 Clears the object cache.
1163
1164 This is useful, e.g., when a device supports multiple contexts (via
1165 changes to the Community string, or via the SNMPv3 Context
1166 parameter), but a context that you want to access does not support
1167 the objects (e.g., "sysObjectID", "sysDescr") that we use to
1168 identify the device.
1169
1170 Data is Cached
1171 Methods and subroutines requesting data from a device will only load
1172 the data once, and then return cached versions of that data.
1173
1174 Run $info->load_METHOD() where method is something like 'i_name' to
1175 reload data from a method.
1176
1177 Run $info->clear_cache() to clear the cache to allow reload of both
1178 globals and table methods.
1179
1180 The cache can be retrieved or set using the $info->cache() method. This
1181 works together with the "Offline" option.
1182
1183 Object Scalar Methods
1184 These are for package related data, not directly supplied from SNMP.
1185
1186 $info->clear_cache()
1187 Clears the cached data. This includes GLOBALS data and TABLE
1188 METHOD data.
1189
1190 $info->debug(1)
1191 Returns current debug status, and optionally toggles debugging info
1192 for this object.
1193
1194 $info->offline([1|0])
1195 Returns if offline mode is currently turned on for this object.
1196
1197 Optionally sets the Offline parameter.
1198
1199 $info->cache([new_cache])
1200 Returns a HashRef of all cached data in this object. There will be
1201 a "store" key for table data and then one key for each leaf.
1202
1203 Optionally sets the cache parameters if passed a HashRef.
1204
1205 $info->bulkwalk([1|0])
1206 Returns if bulkwalk is currently turned on for this object.
1207
1208 Optionally sets the bulkwalk parameter.
1209
1210 $info->loopdetect([1|0])
1211 Returns if loopdetect is currently turned on for this object.
1212
1213 Optionally sets the loopdetect parameter.
1214
1215 $info->device_type()
1216 Returns the Subclass name for this device. "SNMP::Info" is
1217 returned if no more specific class is available.
1218
1219 First the device is checked for Layer 3 support and a specific
1220 subclass, then Layer 2 support and subclasses are checked.
1221
1222 This means that Layer 2 / 3 switches and routers will fall under
1223 the SNMP::Info::Layer3 subclasses.
1224
1225 If the device still can be connected to via SNMP::Info, then
1226 SNMP::Info is returned.
1227
1228 $info->error(no_clear)
1229 Returns Error message if there is an error, or undef if there is
1230 not.
1231
1232 Reading the error will clear the error unless you set the no_clear
1233 flag.
1234
1235 $info->has_layer(3)
1236 Returns non-zero if the device has the supplied layer in the OSI
1237 Model
1238
1239 Returns if the device doesn't support the layers() call.
1240
1241 $info->snmp_comm()
1242 Returns SNMP Community string used in connection.
1243
1244 $info->snmp_ver()
1245 Returns SNMP Version used for this connection
1246
1247 $info->specify()
1248 Returns an object of a more-specific subclass.
1249
1250 my $info = new SNMP::Info(...);
1251 # Returns more specific object type
1252 my $specific = $info->specify();
1253
1254 Usually this method is called internally from new(AutoSpecify => 1)
1255
1256 See device_type() entry for how a subclass is chosen.
1257
1258 $info->cisco_comm_indexing()
1259 Returns 0. Is an overridable method used for vlan indexing for
1260 snmp calls on certain Cisco devices.
1261
1262 See
1263 <ftp://ftp.cisco.com/pub/mibs/supportlists/wsc5000/wsc5000-communityIndexing.html>
1264
1265 GLOBALS (Scalar Methods)
1266 These are methods to return scalar data from RFC1213.
1267
1268 Some subset of these is probably available for any network device that
1269 speaks SNMP.
1270
1271 $info->uptime()
1272 Uptime in hundredths of seconds since device became available.
1273
1274 ("sysUpTime")
1275
1276 $info->contact()
1277 ("sysContact")
1278
1279 $info->name()
1280 ("sysName")
1281
1282 $info->location()
1283 ("sysLocation")
1284
1285 $info->layers()
1286 This returns a binary encoded string where each digit represents a
1287 layer of the OSI model served by the device.
1288
1289 eg: 01000010 means layers 2 (physical) and 7 (Application)
1290 are served.
1291
1292 Note: This string is 8 digits long.
1293
1294 See $info->has_layer()
1295
1296 ("sysServices")
1297
1298 $info->ports()
1299 Number of interfaces available on this device.
1300
1301 Not too useful as the number of SNMP interfaces usually does not
1302 correspond with the number of physical ports
1303
1304 ("ifNumber")
1305
1306 $info->ipforwarding()
1307 The indication of whether the entity is acting as an IP gateway
1308
1309 Returns either forwarding or not-forwarding
1310
1311 ("ipForwarding")
1312
1313 Table Methods
1314 Each of these methods returns a hash_reference to a hash keyed on the
1315 interface index in SNMP.
1316
1317 Example : $info->interfaces() might return
1318
1319 { '1.12' => 'FastEthernet/0',
1320 '2.15' => 'FastEthernet/1',
1321 '9.99' => 'FastEthernet/2'
1322 }
1323
1324 The key is what you would see if you were to do an snmpwalk, and in
1325 some cases changes between reboots of the network device.
1326
1327 Partial Table Fetches
1328 If you want to get only a part of an SNMP table or a single instance
1329 from the table and you know the IID for the part of the table that you
1330 want, you can specify it in the call:
1331
1332 $local_routes = $info->ipr_route('192.168.0');
1333
1334 This will only fetch entries in the table that start with 192.168.0,
1335 which in this case are routes on the local network.
1336
1337 Remember that you must supply the partial IID (a numeric OID).
1338
1339 Partial table results are not cached.
1340
1341 Interface Information
1342 $info->interfaces()
1343 This methods is overridden in each subclass to provide a mapping
1344 between the Interface Table Index (iid) and the physical port name.
1345
1346 $info->if_ignore()
1347 Returns a reference to a hash where key values that exist are
1348 interfaces to ignore.
1349
1350 Ignored interfaces are ones that are usually not physical ports or
1351 Virtual Lans (VLANs) such as the Loopback interface, or the CPU
1352 interface.
1353
1354 $info->bulkwalk_no()
1355 Returns 0. Is an overridable method used for turn off bulkwalk for
1356 the device class.
1357
1358 $info->i_index()
1359 Default SNMP IID to Interface index.
1360
1361 ("ifIndex")
1362
1363 $info->i_description()
1364 Description of the interface. Usually a little longer single word
1365 name that is both human and machine friendly. Not always.
1366
1367 ("ifDescr")
1368
1369 $info->i_type()
1370 Interface type, such as Vlan, Ethernet, Serial
1371
1372 ("ifType")
1373
1374 $info->i_mtu()
1375 INTEGER. Interface MTU value.
1376
1377 ("ifMtu")
1378
1379 $info->i_speed()
1380 Speed of the link, human format. See munge_speed() later in
1381 document for details.
1382
1383 ("ifSpeed", "ifHighSpeed" if necessary)
1384
1385 $info->i_speed_raw()
1386 Speed of the link in bits per second without munging. If
1387 i_speed_high is available it will be used and multiplied by
1388 1_000_000.
1389
1390 ("ifSpeed", "ifHighSpeed" if necessary)
1391
1392 $info->i_speed_high()
1393 Speed of a high-speed link, human format. See munge_highspeed()
1394 later in document for details. You should not need to call this
1395 directly, as i_speed() will call it if it needs to.
1396
1397 ("ifHighSpeed")
1398
1399 $info->i_mac()
1400 MAC address of the interface. Note this is just the MAC of the
1401 port, not anything connected to it.
1402
1403 ("ifPhysAddress")
1404
1405 $info->i_up()
1406 Link Status of the interface. Typical values are 'up' and 'down'.
1407
1408 ("ifOperStatus")
1409
1410 $info->i_up_admin()
1411 Administrative status of the port. Typical values are 'enabled'
1412 and 'disabled'.
1413
1414 ("ifAdminStatus")
1415
1416 $info->i_lastchange()
1417 The value of "sysUpTime" when this port last changed states
1418 (up,down).
1419
1420 ("ifLastChange")
1421
1422 $info->i_name()
1423 Interface Name field. Supported by a smaller subset of devices,
1424 this fields is often human set.
1425
1426 ("ifName")
1427
1428 $info->i_alias()
1429 Interface Name field. For certain devices this is a more human
1430 friendly form of i_description(). For others it is a human set
1431 field like i_name().
1432
1433 ("ifAlias")
1434
1435 Interface Statistics
1436 $info->i_octet_in(), $info->i_octets_out(), $info->i_octet_in64(),
1437 $info->i_octets_out64()
1438 Bandwidth.
1439
1440 Number of octets sent/received on the interface including framing
1441 characters.
1442
1443 64 bit version may not exist on all devices.
1444
1445 NOTE: To manipulate 64 bit counters you need to use Math::BigInt,
1446 since the values are too large for a normal Perl scalar. Set the
1447 global $SNMP::Info::BIGINT to 1 , or pass the BigInt value to new()
1448 if you want SNMP::Info to do it for you.
1449
1450 ("ifInOctets") ("ifOutOctets") ("ifHCInOctets") ("ifHCOutOctets")
1451
1452 $info->i_errors_in(), $info->i_errors_out()
1453 Number of packets that contained an error preventing delivery. See
1454 "IF-MIB" for more info.
1455
1456 ("ifInErrors") ("ifOutErrors")
1457
1458 $info->i_pkts_ucast_in(), $info->i_pkts_ucast_out(),
1459 $info->i_pkts_ucast_in64(), $info->i_pkts_ucast_out64()
1460 Number of packets not sent to a multicast or broadcast address.
1461
1462 64 bit version may not exist on all devices.
1463
1464 ("ifInUcastPkts") ("ifOutUcastPkts") ("ifHCInUcastPkts")
1465 ("ifHCOutUcastPkts")
1466
1467 $info->i_pkts_nucast_in(), $info->i_pkts_nucast_out(),
1468 Number of packets sent to a multicast or broadcast address.
1469
1470 These methods are deprecated by i_pkts_multi_in() and
1471 i_pkts_bcast_in() according to "IF-MIB". Actual device usage may
1472 vary.
1473
1474 ("ifInNUcastPkts") ("ifOutNUcastPkts")
1475
1476 $info->i_pkts_multi_in() $info->i_pkts_multi_out(),
1477 $info->i_pkts_multi_in64(), $info->i_pkts_multi_out64()
1478 Number of packets sent to a multicast address.
1479
1480 64 bit version may not exist on all devices.
1481
1482 ("ifInMulticastPkts") ("ifOutMulticastPkts")
1483 ("ifHCInMulticastPkts") ("ifHCOutMulticastPkts")
1484
1485 $info->i_pkts_bcast_in() $info->i_pkts_bcast_out(),
1486 $info->i_pkts_bcast_in64() $info->i_pkts_bcast_out64()
1487 Number of packets sent to a broadcast address on an interface.
1488
1489 64 bit version may not exist on all devices.
1490
1491 ("ifInBroadcastPkts") ("ifOutBroadcastPkts")
1492 ("ifHCInBroadcastPkts") ("ifHCOutBroadcastPkts")
1493
1494 $info->i_discards_in() $info->i_discards_out()
1495 "The number of inbound packets which were chosen to be discarded
1496 even though no errors had been detected to prevent their being
1497 deliverable to a higher-layer protocol. One possible reason for
1498 discarding such a packet could be to free up buffer space."
1499 ("IF-MIB")
1500
1501 ("ifInDiscards") ("ifOutDiscards")
1502
1503 $info->i_bad_proto_in()
1504 "For packet-oriented interfaces, the number of packets received via
1505 the interface which were discarded because of an unknown or
1506 unsupported protocol. For character-oriented or fixed-length
1507 interfaces that support protocol multiplexing the number of
1508 transmission units received via the interface which were discarded
1509 because of an unknown or unsupported protocol. For any interface
1510 that does not support protocol multiplexing, this counter will
1511 always be 0."
1512
1513 ("ifInUnknownProtos")
1514
1515 $info->i_qlen_out()
1516 "The length of the output packet queue (in packets)."
1517
1518 ("ifOutQLen")
1519
1520 $info->i_specific()
1521 See "IF-MIB" for full description
1522
1523 ("ifSpecific")
1524
1525 IPv4 Address Table
1526 Each entry in this table is an IPv4 address in use on this device.
1527 Usually this is implemented in Layer3 Devices. These methods try the
1528 deprecated IPv4 address table "IP-MIB::ipAddrTable" first due to its
1529 prevalence and will try the current "IP-MIB::ipAddressTable" if it
1530 doesn't return any results. "IP-MIB::ipAddressTable" results are
1531 filtered to only return IPv4 unicast addresses and modified to match
1532 the return format of the older table for backwards compatibility.
1533
1534 See documentation in SNMP::Info::IPv6 for IPv6 Address Table.
1535
1536 $info->ip_index()
1537 Maps the IPv4 addresses to the interface index
1538
1539 ("ipAdEntIfIndex") or filtered and index modified
1540 ("ipAddressIfIndex")
1541
1542 $info->ip_table()
1543 Maps the Table to the IPv4 address
1544
1545 ("ipAdEntAddr") or address extracted from ("ipAddressIfIndex")
1546
1547 $info->ip_netmask()
1548 Gives netmask setting for IPv4 table entry.
1549
1550 ("ipAdEntNetMask") or netmask calculated from ("ipAddressPrefix")
1551
1552 $info->ip_broadcast()
1553 Gives the value of the least-significant bit in the IPv4 broadcast
1554 address either 1 or 0.
1555
1556 ("ipAdEntBcastAddr"), there is no equivalent from the
1557 "IP-MIB::ipAddressTable"
1558
1559 IP Routing Table
1560 $info->ipr_route()
1561 The route in question. A value of 0.0.0.0 is the default gateway
1562 route.
1563
1564 ("ipRouteDest")
1565
1566 $info->ipr_if()
1567 The interface (IID) that the route is on. Use interfaces() to map.
1568
1569 ("ipRouteIfIndex")
1570
1571 $info->ipr_1()
1572 Primary routing metric for this route.
1573
1574 ("ipRouteMetric1")
1575
1576 $info->ipr_2()
1577 If metrics are not used, they should be set to -1
1578
1579 ("ipRouteMetric2")
1580
1581 $info->ipr_3()
1582 ("ipRouteMetric3")
1583
1584 $info->ipr_4()
1585 ("ipRouteMetric4")
1586
1587 $info->ipr_5()
1588 ("ipRouteMetric5")
1589
1590 $info->ipr_dest()
1591 From RFC1213:
1592
1593 "The IP address of the next hop of this route.
1594 (In the case of a route bound to an interface
1595 which is realized via a broadcast media, the value
1596 of this field is the agent's IP address on that
1597 interface.)"
1598
1599 ("ipRouteNextHop")
1600
1601 $info->ipr_type()
1602 From RFC1213:
1603
1604 other(1), -- none of the following
1605 invalid(2), -- an invalidated route
1606 -- route to directly
1607 direct(3), -- connected (sub-)network
1608 -- route to a non-local
1609 indirect(4) -- host/network/sub-network
1610
1611
1612 "The type of route. Note that the values
1613 direct(3) and indirect(4) refer to the notion of
1614 direct and indirect routing in the IP
1615 architecture.
1616
1617 Setting this object to the value invalid(2) has
1618 the effect of invalidating the corresponding entry
1619 in the ipRouteTable object. That is, it
1620 effectively disassociates the destination
1621 identified with said entry from the route
1622 identified with said entry. It is an
1623 implementation-specific matter as to whether the
1624 agent removes an invalidated entry from the table.
1625 Accordingly, management stations must be prepared
1626 to receive tabular information from agents that
1627 corresponds to entries not currently in use.
1628 Proper interpretation of such entries requires
1629 examination of the relevant ipRouteType object."
1630
1631 ("ipRouteType")
1632
1633 $info->ipr_proto()
1634 From RFC1213:
1635
1636 other(1), -- none of the following
1637 -- non-protocol information,
1638 -- e.g., manually configured
1639 local(2), -- entries
1640 -- set via a network
1641 netmgmt(3), -- management protocol
1642 -- obtained via ICMP,
1643 icmp(4), -- e.g., Redirect
1644 -- the remaining values are
1645 -- all gateway routing
1646 -- protocols
1647 egp(5),
1648 ggp(6),
1649 hello(7),
1650 rip(8),
1651 is-is(9),
1652 es-is(10),
1653 ciscoIgrp(11),
1654 bbnSpfIgp(12),
1655 ospf(13),
1656 bgp(14)
1657
1658 ("ipRouteProto")
1659
1660 $info->ipr_age()
1661 Seconds since route was last updated or validated.
1662
1663 ("ipRouteAge")
1664
1665 $info->ipr_mask()
1666 Subnet Mask of route. 0.0.0.0 for default gateway.
1667
1668 ("ipRouteMask")
1669
1670 $info->ipr_info()
1671 Reference to MIB definition specific to routing protocol.
1672
1673 ("ipRouteInfo")
1674
1675 Topology Information
1676 Based upon the manufacturer and software version devices may support
1677 some combination of Layer 2 topology protocol information. SNMP::Info
1678 supports querying Link Layer Discovery Protocol (LLDP), Cisco Discovery
1679 Protocol (CDP), SynOptics/Bay/Nortel/Avaya Network Management Protocol
1680 (SONMP), Foundry/Brocade Discovery Protocol (FDP), Extreme Discovery
1681 Protocol (EDP), and Alcatel Mapping Adjacency Protocol (AMAP).
1682
1683 For protocol specific information and implementation:
1684
1685 AMAP: See SNMP::Info::AMAP for details.
1686 CDP: See SNMP::Info::CDP for details.
1687 EDP: See SNMP::Info::EDP for details.
1688 FDP: See SNMP::Info::FDP for details.
1689 LLDP: See SNMP::Info::LLDP for details.
1690 SONMP: See SNMP::Info::SONMP for details.
1691
1692 Topology Capabilities
1693
1694 $info->has_topo()
1695 Reports Layer 2 topology protocols which are supported and running
1696 on a device.
1697
1698 Returns either a reference to an array of protocols, possible
1699 values being: "lldp", "cdp", "sonmp", "fdp", "edp", "amap" or
1700 "undef" if no protocols are supported or running.
1701
1702 Common Topology Table Information
1703
1704 The common topology table methods below will query the device for
1705 information from the specified topology protocols and return a single
1706 hash combining all information. As a result, there may be identical
1707 topology information returned from the two protocols causing duplicate
1708 entries. It is the calling program's responsibility to identify any
1709 duplicate entries and remove duplicates if necessary. If it is
1710 necessary to understand which protocol provided the information,
1711 utilize the protocol specific methods directly rather than the generic
1712 methods.
1713
1714 The methods support partial table fetches by providing a partial as the
1715 first argument.
1716
1717 If a reference to an array is provided as the second argument, those
1718 protocols will be queried for information. The supported array values
1719 are: "lldp", "cdp", "sonmp", "fdp", "edp", "amap".
1720
1721 If nothing is passed in as the second argument, the methods will call
1722 has_topo() to determine supported and running topology protocols on the
1723 device.
1724
1725 $info->c_ip(partial, topology_protocol_arrayref)
1726 Returns reference to hash. Key: iid, Value: remote IPv4 address
1727
1728 If multiple entries exist with the same local port, c_if(), with
1729 the same IPv4 address, c_ip(), it may be a duplicate entry.
1730
1731 If multiple entries exist with the same local port, c_if(), with
1732 different IPv4 addresses, c_ip(), there is either a device in
1733 between two or more devices utilizing a different topology protocol
1734 or multiple devices which are not directly connected.
1735
1736 Use the protocol specific methods to dig deeper.
1737
1738 $info->c_if(partial, topology_protocol_arrayref)
1739 Returns reference to hash. Key: iid, Value: local device port
1740 (interfaces)
1741
1742 $info->c_port(partial, topology_protocol_arrayref)
1743 Returns reference to hash. Key: iid, Value: remote port
1744 (interfaces)
1745
1746 $info->c_id(partial, topology_protocol_arrayref)
1747 Returns reference to hash. Key: iid, Value: string value used to
1748 identify the chassis component associated with the remote system.
1749
1750 Note: SONMP does not return this information.
1751
1752 $info->c_platform(partial, topology_protocol_arrayref)
1753 Returns reference to hash. Key: iid, Value: Remote Device Type
1754
1755 Note: EDP does not provide this information. LLDP uses
1756 ("lldpRemSysDesc") or "lldp_rem_sysname" as the closest match.
1757
1758 $info->c_cap(partial, topology_protocol_arrayref)
1759 Returns reference to hash of arrays. Key: iid, Value: Array of
1760 capabilities supported by the device. See the specific protocol
1761 class for string values which could be elements within the array.
1762
1763 Note: Only CDP and LLDP support this method.
1764
1766 This section explains how to use SNMP::Info to do SNMP Set operations.
1767
1768 $info->set_METHOD($value)
1769 Sets the global METHOD to value. Assumes that iid is .0
1770
1771 Returns if failed, or the return value from SNMP::Session::set()
1772 (snmp_errno)
1773
1774 $info->set_location("Here!");
1775
1776 $info->set_METHOD($value,$iid)
1777 Table Methods. Set iid of method to value.
1778
1779 Returns if failed, or the return value from SNMP::Session::set()
1780 (snmp_errno)
1781
1782 # Disable a port administratively
1783 my %if_map = reverse %{$info->interfaces()}
1784 $info->set_i_up_admin('down', $if_map{'FastEthernet0/0'})
1785 or die "Couldn't disable the port. ",$info->error(1);
1786
1787 NOTE: You must be connected to your device with a "ReadWrite" community
1788 string in order for set operations to work.
1789
1790 NOTE: This will only set data listed in %FUNCS and %GLOBALS. For data
1791 acquired from overridden methods (subroutines) specific set_METHOD()
1792 subroutines will need to be added if they haven't been already.
1793
1795 SNMP::Info will not chirp anything to STDOUT unless there is a serious
1796 error (in which case it will probably die).
1797
1798 To get lots of debug info, set the Debug flag when calling new() or
1799 call $info->debug(1);
1800
1801 When calling a method check the return value. If the return value is
1802 undef then check $info->error()
1803
1804 Beware, calling $info->error() clears the error.
1805
1806 my $name = $info->name() or die "Couldn't get sysName!" . $name->error();
1807
1809 To support a new class (vendor or platform) of device, add a Perl
1810 package with the data structures and methods listed below.
1811
1812 If this seems a little scary, then the SNMP::Info developers are
1813 usually happy to accept the SNMP data from your device and make an
1814 attempt at the class themselves. Usually a "beta" release will go to
1815 CPAN for you to verify the implementation.
1816
1817 Gathering MIB data for SNMP::Info Developers
1818 The preference is to open a pull request in the github project. This
1819 allows all developers to have visibility into the request. Please
1820 include pointers to the applicable platform MIBs. For development we
1821 will need an "snmpwalk" of the device. There is a tool now included in
1822 the SNMP::Info distribution to help with this task, although you'll
1823 most likely need to download the distribution from CPAN as it's
1824 included in the ""contrib/util"" directory.
1825
1826 The utility is named "make_snmpdata.pl". Run it with a command line
1827 like:
1828
1829 ./make_snmpdata.pl -c community -i -d device_ip \
1830 -m /home/netdisco-mibs/rfc:/home/netdisco-mibs/net-snmp:/home/netdisco-mibs/dir3 \
1831 SNMPv2-MIB IF-MIB EtherLike-MIB BRIDGE-MIB Q-BRIDGE-MIB ENTITY-MIB \
1832 POWER-ETHERNET-MIB IPV6-MIB LLDP-MIB DEVICE-SPECIFIC-MIB-NAME(s) > output.txt
1833
1834 This will print to the file every MIB entry with data in a format that
1835 the developers can use to emulate read operations without needing
1836 access to the device. Preference would be to mask any sensitive data
1837 in the output, zip the file, and attach it to the github pull request.
1838 However, if you do not feel comfortable uploading the output to the
1839 tracker you could e-mail it to the developer that has claimed the
1840 ticket.
1841
1842 Data Structures required in new Subclass
1843 A class inheriting this class must implement these data structures :
1844
1845 $INIT
1846 Used to flag if the MIBs have been loaded yet.
1847
1848 %GLOBALS
1849 Contains a hash in the form ( method_name => SNMP MIB leaf name )
1850 These are scalar values such as name, uptime, etc.
1851
1852 To resolve MIB leaf name conflicts between private MIBs, you may
1853 prefix the leaf name with the MIB replacing each - (dash) and :
1854 (colon) with an _ (underscore). For example,
1855 ALTEON_TIGON_SWITCH_MIB__agSoftwareVersion would be used as the
1856 hash value instead of the net-snmp notation
1857 ALTEON-TIGON-SWITCH-MIB::agSoftwareVersion.
1858
1859 When choosing the name for the methods, be aware that other new Sub
1860 Modules might inherit this one to get it's features. Try to choose
1861 a prefix for methods that will give it's own name space inside the
1862 SNMP::Info methods.
1863
1864 %FUNCS
1865 Contains a hash in the form ( method_name => SNMP MIB leaf name)
1866 These are table entries, such as the "ifIndex"
1867
1868 To resolve MIB leaf name conflicts between private MIBs, you may
1869 prefix the leaf name with the MIB replacing each - (dash) and :
1870 (colon) with an _ (underscore). For example,
1871 ALTEON_TS_PHYSICAL_MIB__agPortCurCfgPortName would be used as the
1872 hash value instead of the net-snmp notation
1873 ALTEON-TS-PHYSICAL-MIB::agPortCurCfgPortName.
1874
1875 %MIBS
1876 A list of each mib needed.
1877
1878 ('MIB-NAME' => 'itemToTestForPresence')
1879
1880 The value for each entry should be a MIB object to check for to
1881 make sure that the MIB is present and has loaded correctly.
1882
1883 $info->init() will throw an exception if a MIB does not load.
1884
1885 %MUNGE
1886 A map between method calls (from %FUNCS or %GLOBALS) and subroutine
1887 methods. The subroutine called will be passed the data as it gets
1888 it from SNMP and it should return that same data in a more human
1889 friendly format.
1890
1891 Sample %MUNGE:
1892
1893 (my_ip => \&munge_ip,
1894 my_mac => \&munge_mac,
1895 my_layers => \&munge_dec2bin
1896 )
1897
1898 Sample Subclass
1899 Let's make a sample Layer 2 Device subclass. This class will inherit
1900 the Cisco Vlan module as an example.
1901
1902 ----------------------- snip --------------------------------
1903
1904 # SNMP::Info::Layer2::Sample
1905
1906 package SNMP::Info::Layer2::Sample;
1907
1908 $VERSION = 0.1;
1909
1910 use strict;
1911 use warnings;
1912
1913 use Exporter;
1914 use SNMP::Info::Layer2;
1915 use SNMP::Info::CiscoVTP;
1916
1917 @SNMP::Info::Layer2::Sample::ISA = qw/SNMP::Info::Layer2
1918 SNMP::Info::CiscoVTP Exporter/;
1919 @SNMP::Info::Layer2::Sample::EXPORT_OK = qw//;
1920
1921 our ($VERSION, %FUNCS, %GLOBALS, %MIBS, %MUNGE, $AUTOLOAD, $INIT, $DEBUG);
1922
1923 %MIBS = (%SNMP::Info::Layer2::MIBS,
1924 %SNMP::Info::CiscoVTP::MIBS,
1925 'SUPER-DOOPER-MIB' => 'supermibobject',
1926 );
1927
1928 %GLOBALS = (%SNMP::Info::Layer2::GLOBALS,
1929 %SNMP::Info::CiscoVTP::GLOBALS,
1930 'name' => 'supermib_supername',
1931 'favorite_color' => 'supermib_fav_color_object',
1932 'favorite_movie' => 'supermib_fav_movie_val',
1933 );
1934
1935 %FUNCS = (%SNMP::Info::Layer2::FUNCS,
1936 %SNMP::Info::CiscoVTP::FUNCS,
1937 # Super Dooper MIB - Super Hero Table
1938 'super_hero_index' => 'SuperHeroIfIndex',
1939 'super_hero_name' => 'SuperHeroIfName',
1940 'super_hero_powers' => 'SuperHeroIfPowers',
1941 );
1942
1943
1944 %MUNGE = (%SNMP::Info::Layer2::MUNGE,
1945 %SNMP::Info::CiscoVTP::MUNGE,
1946 'super_hero_powers' => \&munge_powers,
1947 );
1948
1949 # Override uptime() method from %SNMP::Info::GLOBALS
1950 sub uptime {
1951 my $sample = shift;
1952
1953 my $name = $sample->name();
1954
1955 # this is silly but you get the idea
1956 return '600' if defined $name ;
1957 }
1958
1959 # Create our own munge function
1960 sub munge_powers {
1961 my $power = shift;
1962
1963 # Take the returned obscure value and return something useful.
1964 return 'Fire' if $power =~ /reallyhot/i;
1965 return 'Ice' if $power =~ /reallycold/i;
1966
1967 # Else
1968 return $power;
1969 }
1970
1971 # Copious Documentation here!!!
1972 =head1 NAME
1973 =head1 AUTHOR
1974 =head1 SYNOPSIS
1975 =head1 DESCRIPTION
1976 =head2 Inherited Classes
1977 =head2 Required MIBs
1978 =head1 GLOBALS
1979 =head2 Overrides
1980 =head1 TABLE METHODS
1981 =head2 Overrides
1982 =cut
1983
1984 1; # don't forget this line
1985 ----------------------- snip --------------------------------
1986
1988 Object Namespace
1989 Internal data is stored with bareword keys. For example $info->{debug}
1990
1991 SNMP Data is stored or marked cached with keys starting with an
1992 underscore. For example $info->{_name} is the cache for $info->name().
1993
1994 Cached Table data is stored in $info->store() and marked cached per
1995 above.
1996
1997 Package Globals
1998 These set the default value for an object upon creation.
1999
2000 $DEBUG
2001 Default 0. Sends copious debug info to stdout. This global sets
2002 the object's debug status in new() unless 'Debug' argument passed
2003 in new(). Change objects' debug status with $info->debug().
2004
2005 $BIGINT
2006 Default 0. Set to true to have 64 bit counters return
2007 Math::BigInt objects instead of scalar string values. See note
2008 under Interface Statistics about 64 bit values.
2009
2010 $NOSUCH
2011 Default 1. Set to false to disable RetryNoSuch option for
2012 SNMP::Session. Or see method in new() to do it on an object scope.
2013
2014 $REPEATERS
2015 Default 20. MaxRepeaters for BULKWALK operations. See "perldoc
2016 SNMP" for more info. Can change by passing "BulkRepeaters" option
2017 in new()
2018
2019 Data Munging Callback Subroutines
2020 munge_speed()
2021 Makes human friendly speed ratings using %SPEED_MAP.
2022
2023 %SPEED_MAP = (
2024 '56000' => '56 kbps',
2025 '64000' => '64 kbps',
2026 '115000' => '115 kbps',
2027 '1500000' => '1.5 Mbps',
2028 '1536000' => 'T1',
2029 '1544000' => 'T1',
2030 '2000000' => '2.0 Mbps',
2031 '2048000' => '2.048 Mbps',
2032 '3072000' => 'Dual T1',
2033 '3088000' => 'Dual T1',
2034 '4000000' => '4.0 Mbps',
2035 '10000000' => '10 Mbps',
2036 '11000000' => '11 Mbps',
2037 '16000000' => '16 Mbps',
2038 '16777216' => '16 Mbps',
2039 '20000000' => '20 Mbps',
2040 '44210000' => 'T3',
2041 '44736000' => 'T3',
2042 '45000000' => '45 Mbps',
2043 '45045000' => 'DS3',
2044 '46359642' => 'DS3',
2045 '51850000' => 'OC-1',
2046 '54000000' => '54 Mbps',
2047 '64000000' => '64 Mbps',
2048 '100000000' => '100 Mbps',
2049 '149760000' => 'ATM on OC-3',
2050 '155000000' => 'OC-3',
2051 '155519000' => 'OC-3',
2052 '155520000' => 'OC-3',
2053 '200000000' => '200 Mbps',
2054 '400000000' => '400 Mbps',
2055 '599040000' => 'ATM on OC-12',
2056 '622000000' => 'OC-12',
2057 '622080000' => 'OC-12',
2058 '1000000000' => '1.0 Gbps',
2059 '2000000000' => '2.0 Gbps',
2060 '2488000000' => 'OC-48',
2061 )
2062
2063 Note: high speed interfaces (usually 1 Gbps or faster) have their
2064 link speed in "ifHighSpeed". i_speed() automatically determines
2065 whether to use "ifSpeed" or "ifHighSpeed"; if the latter is used,
2066 the value is munged by munge_highspeed(). SNMP::Info can return
2067 speeds up to terabit levels this way.
2068
2069 munge_highspeed()
2070 Makes human friendly speed ratings for "ifHighSpeed".
2071
2072 munge_ip()
2073 Takes a binary IP and makes it dotted ASCII.
2074
2075 munge_inetaddress
2076 Takes a binary IP address as defined by the SNMP InetAddress type
2077 and returns it as human readable string;
2078
2079 munge_mac()
2080 Takes an octet stream (HEX-STRING) and returns a colon separated
2081 ASCII hex string.
2082
2083 munge_prio_mac()
2084 Takes an 8-byte octet stream (HEX-STRING) and returns a colon
2085 separated ASCII hex string.
2086
2087 munge_prio_port()
2088 Takes an 2-byte octet stream (HEX-STRING) and returns a colon
2089 separated ASCII hex string.
2090
2091 munge_octet2hex()
2092 Takes a binary octet stream and returns an ASCII hex string.
2093
2094 munge_dec2bin()
2095 Takes a binary char and returns its ASCII binary representation.
2096
2097 munge_bits()
2098 Takes a SNMP2 'BITS' field and returns the ASCII bit string.
2099
2100 munge_counter64()
2101 If $BIGINT is set to true, then a Math::BigInt object is returned.
2102 See Math::BigInt for details.
2103
2104 munge_i_up()
2105 Net-SNMP tends to load "RFC1213-MIB" first, and so ignores the
2106 updated enumeration for "ifOperStatus" in "IF-MIB". This munge
2107 handles the "newer" definitions for the enumeration in IF-MIB.
2108
2109 TODO: Get the precedence of MIBs and overriding of MIB data in Net-
2110 SNMP figured out. Hierarchy/precedence of MIBS in SNMP::Info.
2111
2112 munge_port_list()
2113 Takes an octet string representing a set of ports and returns a
2114 reference to an array of binary values each array element
2115 representing a port.
2116
2117 If the element has a value of '1', then that port is included in
2118 the set of ports; the port is not included if it has a value of
2119 '0'.
2120
2121 munge_null()
2122 Removes control characters from a string.
2123
2124 munge_e_type()
2125 Takes an OID and return the object name if the right MIB is loaded.
2126
2127 Internally Used Functions
2128 resolve_desthost()
2129 Takes the SNMP::Session "DestHost" argument and determines if it is
2130 an 'IPv4' or 'IPv6' host. 'IPv6' hosts are prefixed with the
2131 "udp6:" "transport-specifier" as required by the underlying
2132 "Net-SNMP" library. If unable to determine the type of address or
2133 resolve a DNS name, dies with "croak".
2134
2135 $info->init()
2136 Used internally. Loads all entries in %MIBS.
2137
2138 $info->args()
2139 Returns a reference to the argument hash supplied to SNMP::Session
2140
2141 $info->class()
2142 Returns the class name of the object.
2143
2144 $info->error_throw(error message)
2145 Stores the error message for use by $info->error()
2146
2147 If $info->debug() is true, then the error message is carped too.
2148
2149 $info->funcs()
2150 Returns a reference to the %FUNCS hash.
2151
2152 $info->globals()
2153 Returns a reference to the %GLOBALS hash.
2154
2155 $info->mibs()
2156 Returns a reference to the %MIBS hash.
2157
2158 $info->munge()
2159 Returns a reference of the %MUNGE hash.
2160
2161 $info->nosuch()
2162 Returns NoSuch value set or not in new()
2163
2164 $info->session()
2165 Gets or Sets the SNMP::Session object.
2166
2167 $info->store(new_store)
2168 Returns or sets hash store for Table functions.
2169
2170 Store is a hash reference in this format :
2171
2172 $info->store = { attribute => { iid => value , iid2 => value2, ...
2173 } };
2174
2175 $info->_global()
2176 Used internally by AUTOLOAD to create dynamic methods from %GLOBALS
2177 or a single instance MIB Leaf node name from a loaded MIB.
2178
2179 Example: $info->name() on the first call dispatches to AUTOLOAD()
2180 which calls $info->_global('name') creating the method name().
2181
2182 These methods return data as a scalar.
2183
2184 $info->_set(attr,val,iid,type)
2185 Used internally by set_multi() to run an SNMP set command. When
2186 run clears attr cache.
2187
2188 Attr can be passed as either a scalar or a reference to an array or
2189 array of arrays when used with set_multi().
2190
2191 Example: $info->set_name('dog',3) uses autoload to resolve to
2192 $info->_set('name','dog',3);
2193
2194 $info->_make_setter(val,iid)
2195 Used internally by AUTOLOAD to create dynamic methods from either
2196 %GLOBALS, %FUNCS, or a valid mib leaf from a loaded MIB which runs
2197 an SNMP set command. When run clears the attribute cache.
2198
2199 Example: $info->set_name('dog',3) dispatches to autoload to
2200 resolve to $info->_set('name','dog',3) and _make_setter creates the
2201 set_name() method.
2202
2203 $info->set_multi(arrayref)
2204 Used to run an SNMP set command on several new values in the one
2205 request. Returns the result of $info->_set(method).
2206
2207 Pass either a reference to a 4 element array [<obj>, <iid>, <val>,
2208 <type>] or a reference to an array of 4 element arrays to specify
2209 multiple values.
2210
2211 <obj> - One of the following forms:
2212 1) leaf identifier (e.g., C<'sysContact'>)
2213 2) An entry in either %FUNCS, %GLOBALS (e.g., 'contact')
2214 <iid> - The dotted-decimal, instance identifier. For scalar MIB objects
2215 use '0'
2216 <val> - The SNMP data value being set (e.g., 'netdisco')
2217 <type> - Optional as the MIB should be loaded.
2218
2219 If one of the set assignments is invalid, then the request will be
2220 rejected without applying any of the new values - regardless of the
2221 order they appear in the list.
2222
2223 Example:
2224 my $vlan_set = [
2225 ['qb_v_untagged',"$old_vlan_id","$old_untagged_portlist"],
2226 ['qb_v_egress',"$new_vlan_id","$new_egress_portlist"],
2227 ['qb_v_egress',"$old_vlan_id","$old_egress_portlist"],
2228 ['qb_v_untagged',"$new_vlan_id","$new_untagged_portlist"],
2229 ['qb_i_vlan',"$port","$new_vlan_id"],
2230 ];
2231
2232 $info->set_multi($vlan_set);
2233
2234 $info->load_all()
2235 Debugging routine. This does not include any overridden method or
2236 method implemented by subroutine.
2237
2238 Runs $info->load_METHOD() for each entry in $info->funcs();
2239
2240 Returns $info->store() -- See store() entry.
2241
2242 Note return value has changed since version 0.3
2243
2244 $info->all()
2245 Runs $info->load_all() once then returns $info->store();
2246
2247 Use $info->load_all() to reload the data.
2248
2249 Note return value has changed since version 0.3
2250
2251 $info->_load_attr()
2252 Used internally by AUTOLOAD to create dynamic methods from %FUNCS
2253 or a MIB Leaf node name contained within a table of a loaded MIB.
2254
2255 Supports partial table fetches and single instance table fetches.
2256 See "Partial Table Fetches" in SNMP::Info.
2257
2258 These methods return data as a reference to a hash.
2259
2260 $info->_show_attr()
2261 Used internally by AUTOLOAD to return data called by methods listed
2262 in %FUNCS.
2263
2264 $info->snmp_connect_ip(ip)
2265 Returns true or false based upon snmp connectivity to an IP.
2266
2267 modify_port_list(portlist,offset,replacement)
2268 Replaces the specified bit in a port_list array and returns the
2269 packed bitmask
2270
2271 $info->_cache(attr, data)
2272 Cache retrieved data so that if it's asked for again, we use the
2273 cache instead of going back to Net-SNMP. Data is cached inside the
2274 blessed hashref $self.
2275
2276 Accepts the leaf and value (scalar, or hashref for a table). Does
2277 not return anything useful.
2278
2279 $info->_munge(attr, data)
2280 Raw data returned from Net-SNMP might not be formatted correctly or
2281 might have platform-specific bugs or mistakes. The MUNGE feature of
2282 SNMP::Info allows for fixups to take place.
2283
2284 Accepts the leaf and value (scalar, or hashref for a table) and
2285 returns the raw or the munged data, as appropriate. That is, you do
2286 not need to know whether MUNGE is installed, and it's safe to call
2287 this method regardless.
2288
2289 _validate_autoload_method(method)
2290 Used internally by AUTOLOAD to validate that a dynamic method
2291 should be created. Returns the OID of the MIB leaf node the method
2292 will get or set.
2293
2294 1. Returns unless method is listed in %FUNCS, %GLOBALS, or is MIB
2295 Leaf node name in a loaded MIB for given class.
2296 2. Translates the MIB Leaf node name to an OID.
2297 3. Checks to see if the method access type is allowed for the
2298 resolved OID. Write access for set_ methods, read access for
2299 others.
2300 $info->can()
2301 Overrides UNIVERSAL::can() so that objects will correctly report
2302 their capabilities to include dynamic methods generated at run time
2303 via AUTOLOAD.
2304
2305 Calls parent can() first to see if method exists, if not validates
2306 that a method should be created then dispatches to the appropriate
2307 internal method for creation.
2308
2309 Returns undef if the method does not exist and can not be created.
2310
2311 AUTOLOAD
2312 Each entry in either %FUNCS, %GLOBALS, or MIB Leaf node names present
2313 in loaded MIBs are used by AUTOLOAD() to create dynamic methods.
2314
2315 1. Returns unless method is listed in %FUNCS, %GLOBALS, or is a MIB
2316 Leaf node name in a loaded MIB for given class.
2317 2. If the method exists in %GLOBALS or is a single instance MIB Leaf
2318 node name from a loaded MIB, _global() generates the method.
2319 3. If a set_ prefix is present _make_setter() generates the method.
2320 4. If the method exists in %FUNCS or is a MIB Leaf node name contained
2321 within a table from a loaded MIB, _load_attr() generates the method.
2322 5. A load_ prefix forces reloading of data and does not use cached
2323 data.
2324 6. A _raw suffix returns data ignoring any munge routines.
2325
2326 Override any dynamic method listed in %GLOBALS, %FUNCS, or MIB Leaf
2327 node name a by creating a subroutine with the same name.
2328
2329 For example to override $info->name() create `` sub name {...}'' in
2330 your subclass.
2331
2333 Changes from SNMP::Info Version 0.7 and on are: Copyright (c) 2003-2010
2334 Max Baker and SNMP::Info Developers All rights reserved.
2335
2336 Original Code is: Copyright (c) 2002-2003, Regents of the University of
2337 California All rights reserved.
2338
2339 Redistribution and use in source and binary forms, with or without
2340 modification, are permitted provided that the following conditions are
2341 met:
2342
2343 * Redistributions of source code must retain the above copyright notice,
2344 this list of conditions and the following disclaimer.
2345 * Redistributions in binary form must reproduce the above copyright
2346 notice, this list of conditions and the following disclaimer in the
2347 documentation and/or other materials provided with the distribution.
2348 * Neither the name of the University of California, Santa Cruz nor the
2349 names of its contributors may be used to endorse or promote products
2350 derived from this software without specific prior written permission.
2351
2352 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
2353 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2354 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
2355 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2356 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2357 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2358 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2359 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2360 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2361 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2362 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2363
2364
2365
2366perl v5.36.1 2023-07-17 SNMP::Info(3)