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.70
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::Timetra
878 Alcatel-Lucent SR Class.
879
880 See documentation in SNMP::Info::Layer3::Timetra for details.
881
882 SNMP::Info::Layer3::VyOS
883 Subclass for VyOS routers.
884
885 See documentation in SNMP::Info::Layer3::VyOS for details.
886
887 SNMP::Info::Layer3::VMware
888 Subclass for VMware ESXi hosts.
889
890 See documentation in SNMP::Info::Layer3::VMware for details.
891
892 SNMP::Info::Layer7
893 Generic Layer7 Devices.
894
895 See documentation in SNMP::Info::Layer7 for details.
896
897 SNMP::Info::Layer7::APC
898 Subclass for APC UPS devices.
899
900 See documentation in SNMP::Info::Layer7::APC for details.
901
902 SNMP::Info::Layer7::Arbor
903 Subclass for Arbor appliances.
904
905 See documentation in SNMP::Info::Layer7::Arbor for details.
906
907 SNMP::Info::Layer7::CiscoIPS
908 Subclass for Cisco IPS devices.
909
910 See documentation in SNMP::Info::Layer7::CiscoIPS for details.
911
912 SNMP::Info::Layer7::Gigamon
913 Subclass for Gigamon devices.
914
915 See documentation in SNMP::Info::Layer7::Gigamon for details.
916
917 SNMP::Info::Layer7::Liebert
918 Subclass for Liebert devices.
919
920 See documentation in SNMP::Info::Layer7::Liebert for details.
921
922 SNMP::Info::Layer7::Neoteris
923 Subclass for Pulse Secure / Juniper SSL VPN appliances.
924
925 See documentation in SNMP::Info::Layer7::Neoteris for details.
926
927 SNMP::Info::Layer7::Netscaler
928 Subclass for Citrix Netscaler appliances.
929
930 See documentation in SNMP::Info::Layer7::Netscaler for details.
931
933 Thanks for testing and coding help (in no particular order) to :
934 Alexander Barthel, Andy Ford, Alexander Hartmaier, Andrew Herrick, Alex
935 Kramarov, Bernhard Augenstein, Bradley Baetz, Brian Chow, Brian Wilson,
936 Carlos Vicente, Dana Watanabe, David Pinkoski, David Sieborger, Douglas
937 McKeown, Greg King, Ivan Auger, Jean-Philippe Luiggi, Jeroen van Ingen,
938 Justin Hunter, Kent Hamilton, Matthew Tuttle, Michael Robbert, Mike
939 Hunter, Nicolai Petri, Ralf Gross, Robert Kerr, Nick Nauwelaerts and
940 people listed on the Netdisco README!
941
943 Constructor
944 new()
945 Creates a new object and connects via SNMP::Session.
946
947 my $info = new SNMP::Info( 'Debug' => 1,
948 'AutoSpecify' => 1,
949 'BigInt' => 1,
950 'BulkWalk' => 1,
951 'BulkRepeaters' => 20,
952 'IgnoreNetSNMPConf' => 1,
953 'LoopDetect' => 1,
954 'DestHost' => 'myrouter',
955 'Community' => 'public',
956 'Version' => 2,
957 'MibDirs' => ['dir1','dir2','dir3'],
958 ) or die;
959
960 SNMP::Info Specific Arguments :
961
962 AutoSpecify
963 Returns an object of a more specific device class
964
965 (default 0, which means "off")
966
967 BigInt
968 Return Math::BigInt objects for 64 bit counters. Sets on a
969 global scope, not object.
970
971 (default 0, which means "off")
972
973 BulkWalk
974 Set to 0 to turn off BULKWALK commands for SNMPv2 connections.
975
976 Note that BULKWALK is turned off for Net-SNMP versions 5.1.x
977 because of a bug.
978
979 (default 1, which means "on")
980
981 BulkRepeaters
982 Set number of MaxRepeaters for BULKWALK operation. See
983 "perldoc SNMP" -> bulkwalk() for more info.
984
985 (default 20)
986
987 LoopDetect
988 Detects looping during getnext table column walks by comparing
989 IIDs for each instance. A loop is detected if the same IID is
990 seen more than once and the walk is aborted. Note: This will
991 not detect loops during a bulkwalk operation, Net-SNMP's
992 internal bulkwalk function must detect the loop.
993
994 Set to 0 to turn off loop detection.
995
996 (default 1, which means "on")
997
998 IgnoreNetSNMPConf
999 Net-SNMP version 5.0 and higher read configuration files,
1000 snmp.conf or snmp.local.conf, from /etc/snmp, /usr/share/snmp,
1001 /usr/lib(64)/snmp, or $HOME/.snmp and uses those settings to
1002 automatically parse MIB files, etc.
1003
1004 Set to 1 "on" to ignore Net-SNMP configuration files by
1005 overriding the "SNMPCONFPATH" environmental variable during
1006 object initialization. Note: MibDirs must be defined or Net-
1007 SNMP will not be able to load MIBs and initialize the object.
1008
1009 (default 0, which means "off")
1010
1011 Debug
1012 Prints Lots of debugging messages. Pass 2 to print even more
1013 debugging messages.
1014
1015 (default 0, which means "off")
1016
1017 DebugSNMP
1018 Set $SNMP::debugging level for Net-SNMP.
1019
1020 See SNMP for more details.
1021
1022 MibDirs
1023 Array ref to list of directories in which to look for MIBs.
1024 Note this will be in addition to the ones setup in snmp.conf at
1025 the system level.
1026
1027 (default use net-snmp settings only)
1028
1029 RetryNoSuch
1030 When using SNMP Version 1, try reading values even if they come
1031 back as "no such variable in this MIB". Set to false if so
1032 desired. This feature lets you read SNMPv2 data from an SNMP
1033 version 1 connection, and should probably be left on.
1034
1035 (default 1, which means "on")
1036
1037 Session
1038 SNMP::Session object to use instead of connecting on own.
1039
1040 (default creates session automatically)
1041
1042 Offline
1043 Causes SNMP::Info to avoid network activity and return data
1044 only from its cache. If you ask for something not in the cache,
1045 an error is thrown. See also the "cache()" and "offline()"
1046 methods.
1047
1048 (default 0, which means "online")
1049
1050 Cache
1051 Pass in a HashRef to prime the cache of retrieved data. Useful
1052 for creating an instance in "Offline" mode from a previously
1053 dumped cache. See also the "cache()" method to retrieve a cache
1054 after running actial queries.
1055
1056 OTHER
1057 All other arguments are passed to SNMP::Session.
1058
1059 See SNMP::Session for a list of other possible arguments.
1060
1061 A Note about the wrong Community string or wrong SNMP Version:
1062
1063 If a connection is using the wrong community string or the wrong
1064 SNMP version, the creation of the object will not fail. The device
1065 still answers the call on the SNMP port, but will not return
1066 information. Check the error() method after you create the device
1067 object to see if there was a problem in connecting.
1068
1069 A note about SNMP Versions :
1070
1071 Some older devices don't support SNMP version 2, and will not
1072 return anything when a connection under Version 2 is attempted.
1073
1074 Some newer devices will support Version 1, but will not return all
1075 the data they might have if you had connected under Version 1.
1076
1077 When trying to get info from a new device, you may have to try
1078 version 2 and then fallback to version 1.
1079
1080 update()
1081 Replace the existing session with a new one with updated values,
1082 without re-identifying the device. The only supported changes are
1083 to Community or Context.
1084
1085 Clears the object cache.
1086
1087 This is useful, e.g., when a device supports multiple contexts (via
1088 changes to the Community string, or via the SNMPv3 Context
1089 parameter), but a context that you want to access does not support
1090 the objects (e.g., "sysObjectID", "sysDescr") that we use to
1091 identify the device.
1092
1093 Data is Cached
1094 Methods and subroutines requesting data from a device will only load
1095 the data once, and then return cached versions of that data.
1096
1097 Run $info->load_METHOD() where method is something like 'i_name' to
1098 reload data from a method.
1099
1100 Run $info->clear_cache() to clear the cache to allow reload of both
1101 globals and table methods.
1102
1103 The cache can be retrieved or set using the $info->cache() method. This
1104 works together with the "Offline" option.
1105
1106 Object Scalar Methods
1107 These are for package related data, not directly supplied from SNMP.
1108
1109 $info->clear_cache()
1110 Clears the cached data. This includes GLOBALS data and TABLE
1111 METHOD data.
1112
1113 $info->debug(1)
1114 Returns current debug status, and optionally toggles debugging info
1115 for this object.
1116
1117 $info->offline([1|0])
1118 Returns if offline mode is currently turned on for this object.
1119
1120 Optionally sets the Offline parameter.
1121
1122 $info->cache([new_cache])
1123 Returns a HashRef of all cached data in this object. There will be
1124 a "store" key for table data and then one key for each leaf.
1125
1126 Optionally sets the cache parameters if passed a HashRef.
1127
1128 $info->bulkwalk([1|0])
1129 Returns if bulkwalk is currently turned on for this object.
1130
1131 Optionally sets the bulkwalk parameter.
1132
1133 $info->loopdetect([1|0])
1134 Returns if loopdetect is currently turned on for this object.
1135
1136 Optionally sets the loopdetect parameter.
1137
1138 $info->device_type()
1139 Returns the Subclass name for this device. "SNMP::Info" is
1140 returned if no more specific class is available.
1141
1142 First the device is checked for Layer 3 support and a specific
1143 subclass, then Layer 2 support and subclasses are checked.
1144
1145 This means that Layer 2 / 3 switches and routers will fall under
1146 the SNMP::Info::Layer3 subclasses.
1147
1148 If the device still can be connected to via SNMP::Info, then
1149 SNMP::Info is returned.
1150
1151 $info->error(no_clear)
1152 Returns Error message if there is an error, or undef if there is
1153 not.
1154
1155 Reading the error will clear the error unless you set the no_clear
1156 flag.
1157
1158 $info->has_layer(3)
1159 Returns non-zero if the device has the supplied layer in the OSI
1160 Model
1161
1162 Returns if the device doesn't support the layers() call.
1163
1164 $info->snmp_comm()
1165 Returns SNMP Community string used in connection.
1166
1167 $info->snmp_ver()
1168 Returns SNMP Version used for this connection
1169
1170 $info->specify()
1171 Returns an object of a more-specific subclass.
1172
1173 my $info = new SNMP::Info(...);
1174 # Returns more specific object type
1175 my $specific = $info->specify();
1176
1177 Usually this method is called internally from new(AutoSpecify => 1)
1178
1179 See device_type() entry for how a subclass is chosen.
1180
1181 $info->cisco_comm_indexing()
1182 Returns 0. Is an overridable method used for vlan indexing for
1183 snmp calls on certain Cisco devices.
1184
1185 See
1186 <ftp://ftp.cisco.com/pub/mibs/supportlists/wsc5000/wsc5000-communityIndexing.html>
1187
1188 GLOBALS (Scalar Methods)
1189 These are methods to return scalar data from RFC1213.
1190
1191 Some subset of these is probably available for any network device that
1192 speaks SNMP.
1193
1194 $info->uptime()
1195 Uptime in hundredths of seconds since device became available.
1196
1197 ("sysUpTime")
1198
1199 $info->contact()
1200 ("sysContact")
1201
1202 $info->name()
1203 ("sysName")
1204
1205 $info->location()
1206 ("sysLocation")
1207
1208 $info->layers()
1209 This returns a binary encoded string where each digit represents a
1210 layer of the OSI model served by the device.
1211
1212 eg: 01000010 means layers 2 (physical) and 7 (Application)
1213 are served.
1214
1215 Note: This string is 8 digits long.
1216
1217 See $info->has_layer()
1218
1219 ("sysServices")
1220
1221 $info->ports()
1222 Number of interfaces available on this device.
1223
1224 Not too useful as the number of SNMP interfaces usually does not
1225 correspond with the number of physical ports
1226
1227 ("ifNumber")
1228
1229 $info->ipforwarding()
1230 The indication of whether the entity is acting as an IP gateway
1231
1232 Returns either forwarding or not-forwarding
1233
1234 ("ipForwarding")
1235
1236 Table Methods
1237 Each of these methods returns a hash_reference to a hash keyed on the
1238 interface index in SNMP.
1239
1240 Example : $info->interfaces() might return
1241
1242 { '1.12' => 'FastEthernet/0',
1243 '2.15' => 'FastEthernet/1',
1244 '9.99' => 'FastEthernet/2'
1245 }
1246
1247 The key is what you would see if you were to do an snmpwalk, and in
1248 some cases changes between reboots of the network device.
1249
1250 Partial Table Fetches
1251 If you want to get only a part of an SNMP table or a single instance
1252 from the table and you know the IID for the part of the table that you
1253 want, you can specify it in the call:
1254
1255 $local_routes = $info->ipr_route('192.168.0');
1256
1257 This will only fetch entries in the table that start with 192.168.0,
1258 which in this case are routes on the local network.
1259
1260 Remember that you must supply the partial IID (a numeric OID).
1261
1262 Partial table results are not cached.
1263
1264 Interface Information
1265 $info->interfaces()
1266 This methods is overridden in each subclass to provide a mapping
1267 between the Interface Table Index (iid) and the physical port name.
1268
1269 $info->if_ignore()
1270 Returns a reference to a hash where key values that exist are
1271 interfaces to ignore.
1272
1273 Ignored interfaces are ones that are usually not physical ports or
1274 Virtual Lans (VLANs) such as the Loopback interface, or the CPU
1275 interface.
1276
1277 $info->bulkwalk_no()
1278 Returns 0. Is an overridable method used for turn off bulkwalk for
1279 the device class.
1280
1281 $info->i_index()
1282 Default SNMP IID to Interface index.
1283
1284 ("ifIndex")
1285
1286 $info->i_description()
1287 Description of the interface. Usually a little longer single word
1288 name that is both human and machine friendly. Not always.
1289
1290 ("ifDescr")
1291
1292 $info->i_type()
1293 Interface type, such as Vlan, Ethernet, Serial
1294
1295 ("ifType")
1296
1297 $info->i_mtu()
1298 INTEGER. Interface MTU value.
1299
1300 ("ifMtu")
1301
1302 $info->i_speed()
1303 Speed of the link, human format. See munge_speed() later in
1304 document for details.
1305
1306 ("ifSpeed", "ifHighSpeed" if necessary)
1307
1308 $info->i_speed_raw()
1309 Speed of the link in bits per second without munging. If
1310 i_speed_high is available it will be used and multiplied by
1311 1_000_000.
1312
1313 ("ifSpeed", "ifHighSpeed" if necessary)
1314
1315 $info->i_speed_high()
1316 Speed of a high-speed link, human format. See munge_highspeed()
1317 later in document for details. You should not need to call this
1318 directly, as i_speed() will call it if it needs to.
1319
1320 ("ifHighSpeed")
1321
1322 $info->i_mac()
1323 MAC address of the interface. Note this is just the MAC of the
1324 port, not anything connected to it.
1325
1326 ("ifPhysAddress")
1327
1328 $info->i_up()
1329 Link Status of the interface. Typical values are 'up' and 'down'.
1330
1331 ("ifOperStatus")
1332
1333 $info->i_up_admin()
1334 Administrative status of the port. Typical values are 'enabled'
1335 and 'disabled'.
1336
1337 ("ifAdminStatus")
1338
1339 $info->i_lastchange()
1340 The value of "sysUpTime" when this port last changed states
1341 (up,down).
1342
1343 ("ifLastChange")
1344
1345 $info->i_name()
1346 Interface Name field. Supported by a smaller subset of devices,
1347 this fields is often human set.
1348
1349 ("ifName")
1350
1351 $info->i_alias()
1352 Interface Name field. For certain devices this is a more human
1353 friendly form of i_description(). For others it is a human set
1354 field like i_name().
1355
1356 ("ifAlias")
1357
1358 Interface Statistics
1359 $info->i_octet_in(), $info->i_octets_out(), $info->i_octet_in64(),
1360 $info->i_octets_out64()
1361 Bandwidth.
1362
1363 Number of octets sent/received on the interface including framing
1364 characters.
1365
1366 64 bit version may not exist on all devices.
1367
1368 NOTE: To manipulate 64 bit counters you need to use Math::BigInt,
1369 since the values are too large for a normal Perl scalar. Set the
1370 global $SNMP::Info::BIGINT to 1 , or pass the BigInt value to new()
1371 if you want SNMP::Info to do it for you.
1372
1373 ("ifInOctets") ("ifOutOctets") ("ifHCInOctets") ("ifHCOutOctets")
1374
1375 $info->i_errors_in(), $info->i_errors_out()
1376 Number of packets that contained an error preventing delivery. See
1377 "IF-MIB" for more info.
1378
1379 ("ifInErrors") ("ifOutErrors")
1380
1381 $info->i_pkts_ucast_in(), $info->i_pkts_ucast_out(),
1382 $info->i_pkts_ucast_in64(), $info->i_pkts_ucast_out64()
1383 Number of packets not sent to a multicast or broadcast address.
1384
1385 64 bit version may not exist on all devices.
1386
1387 ("ifInUcastPkts") ("ifOutUcastPkts") ("ifHCInUcastPkts")
1388 ("ifHCOutUcastPkts")
1389
1390 $info->i_pkts_nucast_in(), $info->i_pkts_nucast_out(),
1391 Number of packets sent to a multicast or broadcast address.
1392
1393 These methods are deprecated by i_pkts_multi_in() and
1394 i_pkts_bcast_in() according to "IF-MIB". Actual device usage may
1395 vary.
1396
1397 ("ifInNUcastPkts") ("ifOutNUcastPkts")
1398
1399 $info->i_pkts_multi_in() $info->i_pkts_multi_out(),
1400 $info->i_pkts_multi_in64(), $info->i_pkts_multi_out64()
1401 Number of packets sent to a multicast address.
1402
1403 64 bit version may not exist on all devices.
1404
1405 ("ifInMulticastPkts") ("ifOutMulticastPkts")
1406 ("ifHCInMulticastPkts") ("ifHCOutMulticastPkts")
1407
1408 $info->i_pkts_bcast_in() $info->i_pkts_bcast_out(),
1409 $info->i_pkts_bcast_in64() $info->i_pkts_bcast_out64()
1410 Number of packets sent to a broadcast address on an interface.
1411
1412 64 bit version may not exist on all devices.
1413
1414 ("ifInBroadcastPkts") ("ifOutBroadcastPkts")
1415 ("ifHCInBroadcastPkts") ("ifHCOutBroadcastPkts")
1416
1417 $info->i_discards_in() $info->i_discards_out()
1418 "The number of inbound packets which were chosen to be discarded
1419 even though no errors had been detected to prevent their being
1420 deliverable to a higher-layer protocol. One possible reason for
1421 discarding such a packet could be to free up buffer space."
1422 ("IF-MIB")
1423
1424 ("ifInDiscards") ("ifOutDiscards")
1425
1426 $info->i_bad_proto_in()
1427 "For packet-oriented interfaces, the number of packets received via
1428 the interface which were discarded because of an unknown or
1429 unsupported protocol. For character-oriented or fixed-length
1430 interfaces that support protocol multiplexing the number of
1431 transmission units received via the interface which were discarded
1432 because of an unknown or unsupported protocol. For any interface
1433 that does not support protocol multiplexing, this counter will
1434 always be 0."
1435
1436 ("ifInUnknownProtos")
1437
1438 $info->i_qlen_out()
1439 "The length of the output packet queue (in packets)."
1440
1441 ("ifOutQLen")
1442
1443 $info->i_specific()
1444 See "IF-MIB" for full description
1445
1446 ("ifSpecific")
1447
1448 IPv4 Address Table
1449 Each entry in this table is an IPv4 address in use on this device.
1450 Usually this is implemented in Layer3 Devices. These methods try the
1451 deprecated IPv4 address table "IP-MIB::ipAddrTable" first due to its
1452 prevalence and will try the current "IP-MIB::ipAddressTable" if it
1453 doesn't return any results. "IP-MIB::ipAddressTable" results are
1454 filtered to only return IPv4 unicast addresses and modified to match
1455 the return format of the older table for backwards compatibility.
1456
1457 See documentation in SNMP::Info::IPv6 for IPv6 Address Table.
1458
1459 $info->ip_index()
1460 Maps the IPv4 addresses to the interface index
1461
1462 ("ipAdEntIfIndex") or filtered and index modified
1463 ("ipAddressIfIndex")
1464
1465 $info->ip_table()
1466 Maps the Table to the IPv4 address
1467
1468 ("ipAdEntAddr") or address extracted from ("ipAddressIfIndex")
1469
1470 $info->ip_netmask()
1471 Gives netmask setting for IPv4 table entry.
1472
1473 ("ipAdEntNetMask") or netmask calculated from ("ipAddressPrefix")
1474
1475 $info->ip_broadcast()
1476 Gives the value of the least-significant bit in the IPv4 broadcast
1477 address either 1 or 0.
1478
1479 ("ipAdEntBcastAddr"), there is no equivalent from the
1480 "IP-MIB::ipAddressTable"
1481
1482 IP Routing Table
1483 $info->ipr_route()
1484 The route in question. A value of 0.0.0.0 is the default gateway
1485 route.
1486
1487 ("ipRouteDest")
1488
1489 $info->ipr_if()
1490 The interface (IID) that the route is on. Use interfaces() to map.
1491
1492 ("ipRouteIfIndex")
1493
1494 $info->ipr_1()
1495 Primary routing metric for this route.
1496
1497 ("ipRouteMetric1")
1498
1499 $info->ipr_2()
1500 If metrics are not used, they should be set to -1
1501
1502 ("ipRouteMetric2")
1503
1504 $info->ipr_3()
1505 ("ipRouteMetric3")
1506
1507 $info->ipr_4()
1508 ("ipRouteMetric4")
1509
1510 $info->ipr_5()
1511 ("ipRouteMetric5")
1512
1513 $info->ipr_dest()
1514 From RFC1213:
1515
1516 "The IP address of the next hop of this route.
1517 (In the case of a route bound to an interface
1518 which is realized via a broadcast media, the value
1519 of this field is the agent's IP address on that
1520 interface.)"
1521
1522 ("ipRouteNextHop")
1523
1524 $info->ipr_type()
1525 From RFC1213:
1526
1527 other(1), -- none of the following
1528 invalid(2), -- an invalidated route
1529 -- route to directly
1530 direct(3), -- connected (sub-)network
1531 -- route to a non-local
1532 indirect(4) -- host/network/sub-network
1533
1534
1535 "The type of route. Note that the values
1536 direct(3) and indirect(4) refer to the notion of
1537 direct and indirect routing in the IP
1538 architecture.
1539
1540 Setting this object to the value invalid(2) has
1541 the effect of invalidating the corresponding entry
1542 in the ipRouteTable object. That is, it
1543 effectively disassociates the destination
1544 identified with said entry from the route
1545 identified with said entry. It is an
1546 implementation-specific matter as to whether the
1547 agent removes an invalidated entry from the table.
1548 Accordingly, management stations must be prepared
1549 to receive tabular information from agents that
1550 corresponds to entries not currently in use.
1551 Proper interpretation of such entries requires
1552 examination of the relevant ipRouteType object."
1553
1554 ("ipRouteType")
1555
1556 $info->ipr_proto()
1557 From RFC1213:
1558
1559 other(1), -- none of the following
1560 -- non-protocol information,
1561 -- e.g., manually configured
1562 local(2), -- entries
1563 -- set via a network
1564 netmgmt(3), -- management protocol
1565 -- obtained via ICMP,
1566 icmp(4), -- e.g., Redirect
1567 -- the remaining values are
1568 -- all gateway routing
1569 -- protocols
1570 egp(5),
1571 ggp(6),
1572 hello(7),
1573 rip(8),
1574 is-is(9),
1575 es-is(10),
1576 ciscoIgrp(11),
1577 bbnSpfIgp(12),
1578 ospf(13),
1579 bgp(14)
1580
1581 ("ipRouteProto")
1582
1583 $info->ipr_age()
1584 Seconds since route was last updated or validated.
1585
1586 ("ipRouteAge")
1587
1588 $info->ipr_mask()
1589 Subnet Mask of route. 0.0.0.0 for default gateway.
1590
1591 ("ipRouteMask")
1592
1593 $info->ipr_info()
1594 Reference to MIB definition specific to routing protocol.
1595
1596 ("ipRouteInfo")
1597
1598 Topology Information
1599 Based upon the manufacturer and software version devices may support
1600 some combination of Layer 2 topology protocol information. SNMP::Info
1601 supports querying Link Layer Discovery Protocol (LLDP), Cisco Discovery
1602 Protocol (CDP), SynOptics/Bay/Nortel/Avaya Network Management Protocol
1603 (SONMP), Foundry/Brocade Discovery Protocol (FDP), Extreme Discovery
1604 Protocol (EDP), and Alcatel Mapping Adjacency Protocol (AMAP).
1605
1606 For protocol specific information and implementation:
1607
1608 LLDP: See SNMP::Info::LLDP for details.
1609 CDP: See SNMP::Info::CDP for details.
1610 SONMP: See SNMP::Info::SONMP for details.
1611 FDP: See SNMP::Info::FDP for details.
1612 EDP: See SNMP::Info::EDP for details.
1613 AMAP: See SNMP::Info::AMAP for details.
1614
1615 Topology Capabilities
1616
1617 $info->has_topo()
1618 Reports Layer 2 topology protocols which are supported and running
1619 on a device.
1620
1621 Returns either a reference to an array of protocols, possible
1622 values being: "lldp", "cdp", "sonmp", "fdp", "edp", "amap" or
1623 "undef" if no protocols are supported or running.
1624
1625 Common Topology Table Information
1626
1627 The common topology table methods below will query the device for
1628 information from the specified topology protocols and return a single
1629 hash combining all information. As a result, there may be identical
1630 topology information returned from the two protocols causing duplicate
1631 entries. It is the calling program's responsibility to identify any
1632 duplicate entries and remove duplicates if necessary. If it is
1633 necessary to understand which protocol provided the information,
1634 utilize the protocol specific methods directly rather than the generic
1635 methods.
1636
1637 The methods support partial table fetches by providing a partial as the
1638 first argument.
1639
1640 If a reference to an array is provided as the second argument, those
1641 protocols will be queried for information. The supported array values
1642 are: "lldp", "cdp", "sonmp", "fdp", "edp", "amap".
1643
1644 If nothing is passed in as the second argument, the methods will call
1645 has_topo() to determine supported and running topology protocols on the
1646 device.
1647
1648 $info->c_ip(partial, topology_protocol_arrayref)
1649 Returns reference to hash. Key: iid, Value: remote IPv4 address
1650
1651 If multiple entries exist with the same local port, c_if(), with
1652 the same IPv4 address, c_ip(), it may be a duplicate entry.
1653
1654 If multiple entries exist with the same local port, c_if(), with
1655 different IPv4 addresses, c_ip(), there is either a device in
1656 between two or more devices utilizing a different topology protocol
1657 or multiple devices which are not directly connected.
1658
1659 Use the protocol specific methods to dig deeper.
1660
1661 $info->c_if(partial, topology_protocol_arrayref)
1662 Returns reference to hash. Key: iid, Value: local device port
1663 (interfaces)
1664
1665 $info->c_port(partial, topology_protocol_arrayref)
1666 Returns reference to hash. Key: iid, Value: remote port
1667 (interfaces)
1668
1669 $info->c_id(partial, topology_protocol_arrayref)
1670 Returns reference to hash. Key: iid, Value: string value used to
1671 identify the chassis component associated with the remote system.
1672
1673 Note: SONMP does not return this information.
1674
1675 $info->c_platform(partial, topology_protocol_arrayref)
1676 Returns reference to hash. Key: iid, Value: Remote Device Type
1677
1678 Note: EDP does not provide this information. LLDP uses
1679 ("lldpRemSysDesc") or "lldp_rem_sysname" as the closest match.
1680
1681 $info->c_cap(partial, topology_protocol_arrayref)
1682 Returns reference to hash of arrays. Key: iid, Value: Array of
1683 capabilities supported by the device. See the specific protocol
1684 class for string values which could be elements within the array.
1685
1686 Note: Only CDP and LLDP support this method.
1687
1689 This section explains how to use SNMP::Info to do SNMP Set operations.
1690
1691 $info->set_METHOD($value)
1692 Sets the global METHOD to value. Assumes that iid is .0
1693
1694 Returns if failed, or the return value from SNMP::Session::set()
1695 (snmp_errno)
1696
1697 $info->set_location("Here!");
1698
1699 $info->set_METHOD($value,$iid)
1700 Table Methods. Set iid of method to value.
1701
1702 Returns if failed, or the return value from SNMP::Session::set()
1703 (snmp_errno)
1704
1705 # Disable a port administratively
1706 my %if_map = reverse %{$info->interfaces()}
1707 $info->set_i_up_admin('down', $if_map{'FastEthernet0/0'})
1708 or die "Couldn't disable the port. ",$info->error(1);
1709
1710 NOTE: You must be connected to your device with a "ReadWrite" community
1711 string in order for set operations to work.
1712
1713 NOTE: This will only set data listed in %FUNCS and %GLOBALS. For data
1714 acquired from overridden methods (subroutines) specific set_METHOD()
1715 subroutines will need to be added if they haven't been already.
1716
1718 SNMP::Info will not chirp anything to STDOUT unless there is a serious
1719 error (in which case it will probably die).
1720
1721 To get lots of debug info, set the Debug flag when calling new() or
1722 call $info->debug(1);
1723
1724 When calling a method check the return value. If the return value is
1725 undef then check $info->error()
1726
1727 Beware, calling $info->error() clears the error.
1728
1729 my $name = $info->name() or die "Couldn't get sysName!" . $name->error();
1730
1732 To support a new class (vendor or platform) of device, add a Perl
1733 package with the data structures and methods listed below.
1734
1735 If this seems a little scary, then the SNMP::Info developers are
1736 usually happy to accept the SNMP data from your device and make an
1737 attempt at the class themselves. Usually a "beta" release will go to
1738 CPAN for you to verify the implementation.
1739
1740 Gathering MIB data for SNMP::Info Developers
1741 The preference is to open a pull request in the github project. This
1742 allows all developers to have visibility into the request. Please
1743 include pointers to the applicable platform MIBs. For development we
1744 will need an "snmpwalk" of the device. There is a tool now included in
1745 the SNMP::Info distribution to help with this task, although you'll
1746 most likely need to download the distribution from CPAN as it's
1747 included in the ""contrib/util"" directory.
1748
1749 The utility is named "make_snmpdata.pl". Run it with a command line
1750 like:
1751
1752 ./make_snmpdata.pl -c community -i -d device_ip \
1753 -m /home/netdisco-mibs/rfc:/home/netdisco-mibs/net-snmp:/home/netdisco-mibs/dir3 \
1754 SNMPv2-MIB IF-MIB EtherLike-MIB BRIDGE-MIB Q-BRIDGE-MIB ENTITY-MIB \
1755 POWER-ETHERNET-MIB IPV6-MIB LLDP-MIB DEVICE-SPECIFIC-MIB-NAME(s) > output.txt
1756
1757 This will print to the file every MIB entry with data in a format that
1758 the developers can use to emulate read operations without needing
1759 access to the device. Preference would be to mask any sensitive data
1760 in the output, zip the file, and attach it to the github pull request.
1761 However, if you do not feel comfortable uploading the output to the
1762 tracker you could e-mail it to the developer that has claimed the
1763 ticket.
1764
1765 Data Structures required in new Subclass
1766 A class inheriting this class must implement these data structures :
1767
1768 $INIT
1769 Used to flag if the MIBs have been loaded yet.
1770
1771 %GLOBALS
1772 Contains a hash in the form ( method_name => SNMP MIB leaf name )
1773 These are scalar values such as name, uptime, etc.
1774
1775 To resolve MIB leaf name conflicts between private MIBs, you may
1776 prefix the leaf name with the MIB replacing each - (dash) and :
1777 (colon) with an _ (underscore). For example,
1778 ALTEON_TIGON_SWITCH_MIB__agSoftwareVersion would be used as the
1779 hash value instead of the net-snmp notation
1780 ALTEON-TIGON-SWITCH-MIB::agSoftwareVersion.
1781
1782 When choosing the name for the methods, be aware that other new Sub
1783 Modules might inherit this one to get it's features. Try to choose
1784 a prefix for methods that will give it's own name space inside the
1785 SNMP::Info methods.
1786
1787 %FUNCS
1788 Contains a hash in the form ( method_name => SNMP MIB leaf name)
1789 These are table entries, such as the "ifIndex"
1790
1791 To resolve MIB leaf name conflicts between private MIBs, you may
1792 prefix the leaf name with the MIB replacing each - (dash) and :
1793 (colon) with an _ (underscore). For example,
1794 ALTEON_TS_PHYSICAL_MIB__agPortCurCfgPortName would be used as the
1795 hash value instead of the net-snmp notation
1796 ALTEON-TS-PHYSICAL-MIB::agPortCurCfgPortName.
1797
1798 %MIBS
1799 A list of each mib needed.
1800
1801 ('MIB-NAME' => 'itemToTestForPresence')
1802
1803 The value for each entry should be a MIB object to check for to
1804 make sure that the MIB is present and has loaded correctly.
1805
1806 $info->init() will throw an exception if a MIB does not load.
1807
1808 %MUNGE
1809 A map between method calls (from %FUNCS or %GLOBALS) and subroutine
1810 methods. The subroutine called will be passed the data as it gets
1811 it from SNMP and it should return that same data in a more human
1812 friendly format.
1813
1814 Sample %MUNGE:
1815
1816 (my_ip => \&munge_ip,
1817 my_mac => \&munge_mac,
1818 my_layers => \&munge_dec2bin
1819 )
1820
1821 Sample Subclass
1822 Let's make a sample Layer 2 Device subclass. This class will inherit
1823 the Cisco Vlan module as an example.
1824
1825 ----------------------- snip --------------------------------
1826
1827 # SNMP::Info::Layer2::Sample
1828
1829 package SNMP::Info::Layer2::Sample;
1830
1831 $VERSION = 0.1;
1832
1833 use strict;
1834 use warnings;
1835
1836 use Exporter;
1837 use SNMP::Info::Layer2;
1838 use SNMP::Info::CiscoVTP;
1839
1840 @SNMP::Info::Layer2::Sample::ISA = qw/SNMP::Info::Layer2
1841 SNMP::Info::CiscoVTP Exporter/;
1842 @SNMP::Info::Layer2::Sample::EXPORT_OK = qw//;
1843
1844 our ($VERSION, %FUNCS, %GLOBALS, %MIBS, %MUNGE, $AUTOLOAD, $INIT, $DEBUG);
1845
1846 %MIBS = (%SNMP::Info::Layer2::MIBS,
1847 %SNMP::Info::CiscoVTP::MIBS,
1848 'SUPER-DOOPER-MIB' => 'supermibobject',
1849 );
1850
1851 %GLOBALS = (%SNMP::Info::Layer2::GLOBALS,
1852 %SNMP::Info::CiscoVTP::GLOBALS,
1853 'name' => 'supermib_supername',
1854 'favorite_color' => 'supermib_fav_color_object',
1855 'favorite_movie' => 'supermib_fav_movie_val',
1856 );
1857
1858 %FUNCS = (%SNMP::Info::Layer2::FUNCS,
1859 %SNMP::Info::CiscoVTP::FUNCS,
1860 # Super Dooper MIB - Super Hero Table
1861 'super_hero_index' => 'SuperHeroIfIndex',
1862 'super_hero_name' => 'SuperHeroIfName',
1863 'super_hero_powers' => 'SuperHeroIfPowers',
1864 );
1865
1866
1867 %MUNGE = (%SNMP::Info::Layer2::MUNGE,
1868 %SNMP::Info::CiscoVTP::MUNGE,
1869 'super_hero_powers' => \&munge_powers,
1870 );
1871
1872 # Override uptime() method from %SNMP::Info::GLOBALS
1873 sub uptime {
1874 my $sample = shift;
1875
1876 my $name = $sample->name();
1877
1878 # this is silly but you get the idea
1879 return '600' if defined $name ;
1880 }
1881
1882 # Create our own munge function
1883 sub munge_powers {
1884 my $power = shift;
1885
1886 # Take the returned obscure value and return something useful.
1887 return 'Fire' if $power =~ /reallyhot/i;
1888 return 'Ice' if $power =~ /reallycold/i;
1889
1890 # Else
1891 return $power;
1892 }
1893
1894 # Copious Documentation here!!!
1895 =head1 NAME
1896 =head1 AUTHOR
1897 =head1 SYNOPSIS
1898 =head1 DESCRIPTION
1899 =head2 Inherited Classes
1900 =head2 Required MIBs
1901 =head1 GLOBALS
1902 =head2 Overrides
1903 =head1 TABLE METHODS
1904 =head2 Overrides
1905 =cut
1906
1907 1; # don't forget this line
1908 ----------------------- snip --------------------------------
1909
1911 Object Namespace
1912 Internal data is stored with bareword keys. For example $info->{debug}
1913
1914 SNMP Data is stored or marked cached with keys starting with an
1915 underscore. For example $info->{_name} is the cache for $info->name().
1916
1917 Cached Table data is stored in $info->store() and marked cached per
1918 above.
1919
1920 Package Globals
1921 These set the default value for an object upon creation.
1922
1923 $DEBUG
1924 Default 0. Sends copious debug info to stdout. This global sets
1925 the object's debug status in new() unless 'Debug' argument passed
1926 in new(). Change objects' debug status with $info->debug().
1927
1928 $BIGINT
1929 Default 0. Set to true to have 64 bit counters return
1930 Math::BigInt objects instead of scalar string values. See note
1931 under Interface Statistics about 64 bit values.
1932
1933 $NOSUCH
1934 Default 1. Set to false to disable RetryNoSuch option for
1935 SNMP::Session. Or see method in new() to do it on an object scope.
1936
1937 $REPEATERS
1938 Default 20. MaxRepeaters for BULKWALK operations. See "perldoc
1939 SNMP" for more info. Can change by passing "BulkRepeaters" option
1940 in new()
1941
1942 Data Munging Callback Subroutines
1943 munge_speed()
1944 Makes human friendly speed ratings using %SPEED_MAP.
1945
1946 %SPEED_MAP = (
1947 '56000' => '56 kbps',
1948 '64000' => '64 kbps',
1949 '115000' => '115 kpbs',
1950 '1500000' => '1.5 Mbps',
1951 '1536000' => 'T1',
1952 '1544000' => 'T1',
1953 '2000000' => '2.0 Mbps',
1954 '2048000' => '2.048 Mbps',
1955 '3072000' => 'Dual T1',
1956 '3088000' => 'Dual T1',
1957 '4000000' => '4.0 Mbps',
1958 '10000000' => '10 Mbps',
1959 '11000000' => '11 Mbps',
1960 '20000000' => '20 Mbps',
1961 '16000000' => '16 Mbps',
1962 '16777216' => '16 Mbps',
1963 '44210000' => 'T3',
1964 '44736000' => 'T3',
1965 '45000000' => '45 Mbps',
1966 '45045000' => 'DS3',
1967 '46359642' => 'DS3',
1968 '51850000' => 'OC-1',
1969 '54000000' => '54 Mbps',
1970 '64000000' => '64 Mbps',
1971 '100000000' => '100 Mbps',
1972 '200000000' => '200 Mbps',
1973 '149760000' => 'ATM on OC-3',
1974 '155000000' => 'OC-3',
1975 '155519000' => 'OC-3',
1976 '155520000' => 'OC-3',
1977 '400000000' => '400 Mbps',
1978 '599040000' => 'ATM on OC-12',
1979 '622000000' => 'OC-12',
1980 '622080000' => 'OC-12',
1981 '1000000000' => '1.0 Gbps',
1982 '2000000000' => '2.0 Gbps',
1983 '2488000000' => 'OC-48',
1984 )
1985
1986 Note: high speed interfaces (usually 1 Gbps or faster) have their
1987 link speed in "ifHighSpeed". i_speed() automatically determines
1988 whether to use "ifSpeed" or "ifHighSpeed"; if the latter is used,
1989 the value is munged by munge_highspeed(). SNMP::Info can return
1990 speeds up to terabit levels this way.
1991
1992 munge_highspeed()
1993 Makes human friendly speed ratings for "ifHighSpeed".
1994
1995 munge_ip()
1996 Takes a binary IP and makes it dotted ASCII.
1997
1998 munge_mac()
1999 Takes an octet stream (HEX-STRING) and returns a colon separated
2000 ASCII hex string.
2001
2002 munge_prio_mac()
2003 Takes an 8-byte octet stream (HEX-STRING) and returns a colon
2004 separated ASCII hex string.
2005
2006 munge_prio_port()
2007 Takes an 2-byte octet stream (HEX-STRING) and returns a colon
2008 separated ASCII hex string.
2009
2010 munge_octet2hex()
2011 Takes a binary octet stream and returns an ASCII hex string.
2012
2013 munge_dec2bin()
2014 Takes a binary char and returns its ASCII binary representation.
2015
2016 munge_bits()
2017 Takes a SNMP2 'BITS' field and returns the ASCII bit string.
2018
2019 munge_counter64()
2020 If $BIGINT is set to true, then a Math::BigInt object is returned.
2021 See Math::BigInt for details.
2022
2023 munge_i_up()
2024 Net-SNMP tends to load "RFC1213-MIB" first, and so ignores the
2025 updated enumeration for "ifOperStatus" in "IF-MIB". This munge
2026 handles the "newer" definitions for the enumeration in IF-MIB.
2027
2028 TODO: Get the precedence of MIBs and overriding of MIB data in Net-
2029 SNMP figured out. Hierarchy/precedence of MIBS in SNMP::Info.
2030
2031 munge_port_list()
2032 Takes an octet string representing a set of ports and returns a
2033 reference to an array of binary values each array element
2034 representing a port.
2035
2036 If the element has a value of '1', then that port is included in
2037 the set of ports; the port is not included if it has a value of
2038 '0'.
2039
2040 munge_null()
2041 Removes control characters from a string.
2042
2043 munge_e_type()
2044 Takes an OID and return the object name if the right MIB is loaded.
2045
2046 Internally Used Functions
2047 resolve_desthost()
2048 Takes the SNMP::Session "DestHost" argument and determines if it is
2049 an 'IPv4' or 'IPv6' host. 'IPv6' hosts are prefixed with the
2050 "udp6:" "transport-specifier" as required by the underlying
2051 "Net-SNMP" library. If unable to determine the type of address or
2052 resolve a DNS name, dies with "croak".
2053
2054 $info->init()
2055 Used internally. Loads all entries in %MIBS.
2056
2057 $info->args()
2058 Returns a reference to the argument hash supplied to SNMP::Session
2059
2060 $info->class()
2061 Returns the class name of the object.
2062
2063 $info->error_throw(error message)
2064 Stores the error message for use by $info->error()
2065
2066 If $info->debug() is true, then the error message is carped too.
2067
2068 $info->funcs()
2069 Returns a reference to the %FUNCS hash.
2070
2071 $info->globals()
2072 Returns a reference to the %GLOBALS hash.
2073
2074 $info->mibs()
2075 Returns a reference to the %MIBS hash.
2076
2077 $info->munge()
2078 Returns a reference of the %MUNGE hash.
2079
2080 $info->nosuch()
2081 Returns NoSuch value set or not in new()
2082
2083 $info->session()
2084 Gets or Sets the SNMP::Session object.
2085
2086 $info->store(new_store)
2087 Returns or sets hash store for Table functions.
2088
2089 Store is a hash reference in this format :
2090
2091 $info->store = { attribute => { iid => value , iid2 => value2, ...
2092 } };
2093
2094 $info->_global()
2095 Used internally by AUTOLOAD to create dynamic methods from %GLOBALS
2096 or a single instance MIB Leaf node name from a loaded MIB.
2097
2098 Example: $info->name() on the first call dispatches to AUTOLOAD()
2099 which calls $info->_global('name') creating the method name().
2100
2101 These methods return data as a scalar.
2102
2103 $info->_set(attr,val,iid,type)
2104 Used internally by set_multi() to run an SNMP set command. When
2105 run clears attr cache.
2106
2107 Attr can be passed as either a scalar or a reference to an array or
2108 array of arrays when used with set_multi().
2109
2110 Example: $info->set_name('dog',3) uses autoload to resolve to
2111 $info->_set('name','dog',3);
2112
2113 $info->_make_setter(val,iid)
2114 Used internally by AUTOLOAD to create dynamic methods from either
2115 %GLOBALS, %FUNCS, or a valid mib leaf from a loaded MIB which runs
2116 an SNMP set command. When run clears the attribute cache.
2117
2118 Example: $info->set_name('dog',3) dispatches to autoload to
2119 resolve to $info->_set('name','dog',3) and _make_setter creates the
2120 set_name() method.
2121
2122 $info->set_multi(arrayref)
2123 Used to run an SNMP set command on several new values in the one
2124 request. Returns the result of $info->_set(method).
2125
2126 Pass either a reference to a 4 element array [<obj>, <iid>, <val>,
2127 <type>] or a reference to an array of 4 element arrays to specify
2128 multiple values.
2129
2130 <obj> - One of the following forms:
2131 1) leaf identifier (e.g., C<'sysContact'>)
2132 2) An entry in either %FUNCS, %GLOBALS (e.g., 'contact')
2133 <iid> - The dotted-decimal, instance identifier. For scalar MIB objects
2134 use '0'
2135 <val> - The SNMP data value being set (e.g., 'netdisco')
2136 <type> - Optional as the MIB should be loaded.
2137
2138 If one of the set assignments is invalid, then the request will be
2139 rejected without applying any of the new values - regardless of the
2140 order they appear in the list.
2141
2142 Example:
2143 my $vlan_set = [
2144 ['qb_v_untagged',"$old_vlan_id","$old_untagged_portlist"],
2145 ['qb_v_egress',"$new_vlan_id","$new_egress_portlist"],
2146 ['qb_v_egress',"$old_vlan_id","$old_egress_portlist"],
2147 ['qb_v_untagged',"$new_vlan_id","$new_untagged_portlist"],
2148 ['qb_i_vlan',"$port","$new_vlan_id"],
2149 ];
2150
2151 $info->set_multi($vlan_set);
2152
2153 $info->load_all()
2154 Debugging routine. This does not include any overridden method or
2155 method implemented by subroutine.
2156
2157 Runs $info->load_METHOD() for each entry in $info->funcs();
2158
2159 Returns $info->store() -- See store() entry.
2160
2161 Note return value has changed since version 0.3
2162
2163 $info->all()
2164 Runs $info->load_all() once then returns $info->store();
2165
2166 Use $info->load_all() to reload the data.
2167
2168 Note return value has changed since version 0.3
2169
2170 $info->_load_attr()
2171 Used internally by AUTOLOAD to create dynamic methods from %FUNCS
2172 or a MIB Leaf node name contained within a table of a loaded MIB.
2173
2174 Supports partial table fetches and single instance table fetches.
2175 See "Partial Table Fetches" in SNMP::Info.
2176
2177 These methods return data as a reference to a hash.
2178
2179 $info->_show_attr()
2180 Used internally by AUTOLOAD to return data called by methods listed
2181 in %FUNCS.
2182
2183 $info->snmp_connect_ip(ip)
2184 Returns true or false based upon snmp connectivity to an IP.
2185
2186 modify_port_list(portlist,offset,replacement)
2187 Replaces the specified bit in a port_list array and returns the
2188 packed bitmask
2189
2190 $info->_cache(attr, data)
2191 Cache retrieved data so that if it's asked for again, we use the
2192 cache instead of going back to Net-SNMP. Data is cached inside the
2193 blessed hashref $self.
2194
2195 Accepts the leaf and value (scalar, or hashref for a table). Does
2196 not return anything useful.
2197
2198 $info->_munge(attr, data)
2199 Raw data returned from Net-SNMP might not be formatted correctly or
2200 might have platform-specific bugs or mistakes. The MUNGE feature of
2201 SNMP::Info allows for fixups to take place.
2202
2203 Accepts the leaf and value (scalar, or hashref for a table) and
2204 returns the raw or the munged data, as appropriate. That is, you do
2205 not need to know whether MUNGE is installed, and it's safe to call
2206 this method regardless.
2207
2208 _validate_autoload_method(method)
2209 Used internally by AUTOLOAD to validate that a dynamic method
2210 should be created. Returns the OID of the MIB leaf node the method
2211 will get or set.
2212
2213 1. Returns unless method is listed in %FUNCS, %GLOBALS, or is MIB
2214 Leaf node name in a loaded MIB for given class.
2215 2. Translates the MIB Leaf node name to an OID.
2216 3. Checks to see if the method access type is allowed for the
2217 resolved OID. Write access for set_ methods, read access for
2218 others.
2219 $info->can()
2220 Overrides UNIVERSAL::can() so that objects will correctly report
2221 their capabilities to include dynamic methods generated at run time
2222 via AUTOLOAD.
2223
2224 Calls parent can() first to see if method exists, if not validates
2225 that a method should be created then dispatches to the appropriate
2226 internal method for creation. The newly created method is inserted
2227 into the symbol table returning to AUTOLOAD only for the initial
2228 method call.
2229
2230 Returns undef if the method does not exist and can not be created.
2231
2232 AUTOLOAD
2233 Each entry in either %FUNCS, %GLOBALS, or MIB Leaf node names present
2234 in loaded MIBs are used by AUTOLOAD() to create dynamic methods.
2235 Generated methods are inserted into the symbol table so that subsequent
2236 calls can avoid AUTOLOAD() and dispatch directly.
2237
2238 1. Returns unless method is listed in %FUNCS, %GLOBALS, or is a MIB
2239 Leaf node name in a loaded MIB for given class.
2240 2. If the method exists in %GLOBALS or is a single instance MIB Leaf
2241 node name from a loaded MIB, _global() generates the method.
2242 3. If a set_ prefix is present _make_setter() generates the method.
2243 4. If the method exists in %FUNCS or is a MIB Leaf node name contained
2244 within a table from a loaded MIB, _load_attr() generates the method.
2245 5. A load_ prefix forces reloading of data and does not use cached
2246 data.
2247 6. A _raw suffix returns data ignoring any munge routines.
2248
2249 Override any dynamic method listed in %GLOBALS, %FUNCS, or MIB Leaf
2250 node name a by creating a subroutine with the same name.
2251
2252 For example to override $info->name() create `` sub name {...}'' in
2253 your subclass.
2254
2256 Changes from SNMP::Info Version 0.7 and on are: Copyright (c) 2003-2010
2257 Max Baker and SNMP::Info Developers All rights reserved.
2258
2259 Original Code is: Copyright (c) 2002-2003, Regents of the University of
2260 California All rights reserved.
2261
2262 Redistribution and use in source and binary forms, with or without
2263 modification, are permitted provided that the following conditions are
2264 met:
2265
2266 * Redistributions of source code must retain the above copyright notice,
2267 this list of conditions and the following disclaimer.
2268 * Redistributions in binary form must reproduce the above copyright
2269 notice, this list of conditions and the following disclaimer in the
2270 documentation and/or other materials provided with the distribution.
2271 * Neither the name of the University of California, Santa Cruz nor the
2272 names of its contributors may be used to endorse or promote products
2273 derived from this software without specific prior written permission.
2274
2275 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
2276 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2277 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
2278 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2279 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2280 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2281 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2282 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2283 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2284 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2285 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2286
2287
2288
2289perl v5.32.0 2020-07-28 SNMP::Info(3)