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