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