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