SNMP::...Layer1(3pm)

πŸ’– SNMP::...Layer1(3pm) πŸ’–

okay bestie, welcome to SNMP::...Layer1(3pm) β€” this is the User Contributed Perl Documentation page for SNMP::Info::Layer1, and yes we are about to make Layer1 devices make sense. sit down, hydrate, let's go 🫢


✨ NAME ✨

SNMP::Info::Layer1 β€” the SNMP interface to network devices that serve Layer1 only. that's it, that's the vibe πŸ’…

πŸŽ€ AUTHOR πŸŽ€

Max Baker β€” icon, legend, wrote this whole thing πŸ’–

🌸 SYNOPSIS 🌸

okay so here's the whole flow, copy it exactly bestie:

# Let SNMP::Info determine the correct subclass for you.
my $l1 = new SNMP::Info(
                         AutoSpecify => 1,
                         Debug       => 1,
                         DestHost    => 'myswitch',
                         Community   => 'public',
                         Version     => 2
                       )
   or die "Can't connect to DestHost.\n";

my $class = $l1->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";

# Let's get some basic Port information
my $interfaces = $l1->interfaces();
my $i_up       = $l1->i_up();
my $i_speed    = $l1->i_speed();

foreach my $iid (keys %$interfaces) {
   my $port  = $interfaces->{$iid};
   my $up    = $i_up->{$iid};
   my $speed = $i_speed->{$iid}
   print "Port $port is $up. Port runs at $speed.\n";
}

(yes you drop in AutoSpecify => 1 and let SNMP::Info pick the subclass for you, it's giving main character energy πŸ‘‘)

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, this class is usually used as a superclass for the more specific device classes hanging out under SNMP::Info::Layer1::*. please read all the docs under SNMP::Info first, bestie, fr fr.

it provides abstraction to the configuration info you can pull off a Layer1 device through SNMP. the info lives in a bunch of MIBs ✨

for speed or debugging purposes you can call the subclass directly β€” but not after you've already determined a more specific class using the method up above. no cap:

my $l1 = new SNMP::Info::Layer1(...);

🌈 Inherited Classes

  • SNMP::Info

⭐ Required MIBs

  • SNMP-REPEATER-MIB
  • the MIBs required for "REQUIREMENTS" in SNMP::Info
  • seriously, see "REQUIREMENTS" in SNMP::Info for its MIB requirements πŸ’œ

πŸ’… GLOBALS πŸ’…

these are the methods that return a scalar value from SNMP.

  • $l1->ports_managed() β€” grabs the number of ports under the interface mib. that's ("ifNumber") πŸ“

πŸ‘‘ Overrides

  • $l1->model() β€” cross references $l1->id() with product IDs. for HP devices it drops 'hpswitch' from the name πŸ’€ for Cisco devices it drops 'sysid' from the name.
  • $l1->vendor() β€” tries to discover the vendor from $l1->model() and $l1->vendor().
  • $l1->ports() β€” adds the values from rptr_ports() and ports_managed(). stacking them, obsessed.
  • $l1->slots() β€” the number of 'groups' in the Repeater MIB, aka ("rptrGroupCapacity").

🧚 Global Methods imported from SNMP::Info

see the documentation in "USAGE" in SNMP::Info for the details, iykyk πŸ’–


🌸 TABLE METHODS 🌸

these are the methods that return tables of information, in the form of a reference to a hash. cute little hashes everywhere πŸ₯°

πŸ’œ Overrides

  • $l1->interfaces() β€” returns a reference to the map between IID and physical Port.
  • $l1->i_up() β€” returns a reference to the map of IIDs to link status.
  • $l1->i_up_admin() β€” returns a reference to the map of IIDs to administrative link status.

πŸŽ€ Repeater MIB

  • $l1->rptr_ports() β€” the number of ports in each group. ("rptrGroupPortCapacity") ✨
  • $l1->rptr_port() β€” the port number in Group. ("rptrPortIndex")
  • $l1->rptr_slot() β€” the Group (slot) Number for a given port. ("rptrPortGroupIndex")
  • $l1->rptr_up_admin() β€” ("rptrPortAdminStatus")
  • $l1->rptr_up() β€” ("rptrPortOperStatus")
  • $l1->rptr_last_src() β€” ("rptrAddrTrackNewLastSrcAddress")

πŸ¦‹ Table Methods imported from SNMP::Info

see the documentation in "USAGE" in SNMP::Info for the details πŸ’–


and that's the whole page bestie, you ate that 🫢 oh also, this was cooked up against perl v5.40.1 and it's dated 2026-02-28 β€” so if you're reading this from the future, hey πŸ‘‹ no cap, love that for you. go forth and SNMP responsibly πŸ’…βœ¨

πŸ“¦ where this page comes from