SNMP::...Layer3(3pm)
π SNMP::Info::Layer3 π
okay bestie, welcome to SNMP::Info::Layer3, like the third layer of a cake but make it network devices πβ¨ it's shipped as part of the User Contributed Perl Documentation and it lives at SNMP::...Layer3(3pm) in your man pages, no cap.
β¨ NAME β¨
SNMP::Info::Layer3 β the SNMP Interface to network devices serving Layer3 or Layers 2 & 3 π«Ά
π AUTHOR π
Max Baker
πΈ SYNOPSIS πΈ
okay so here's the whole vibe, copy it, don't improvise:
# Let SNMP::Info determine the correct subclass for you.
my $l3 = new SNMP::Info(
AutoSpecify => 1,
Debug => 1,
DestHost => 'myswitch',
Community => 'public',
Version => 2
)
or die "Can't connect to DestHost.\n";
my $class = $l3->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";
# Let's get some basic Port information
my $interfaces = $l3->interfaces();
my $i_up = $l3->i_up();
my $i_speed = $l3->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";
}
look at her go π
π¦ DESCRIPTION π¦
ngl this class is almost always the superclass situation β more specific device classes under SNMP::Info::Layer3::* inherit from it π so pls pls pls read all the docs under SNMP::Info first, i'm begging.
It gives you generic methods for pulling SNMP data out of Layer 3 network devices, and yes it also handles Layer2+3 devices, we love an overachiever π₯
If you're doing it for speed or for debugging, you can call the subclass directly β but not after you've already used the method up there to figure out a more specific class, that's the rule bestie π«
my $l3 = new SNMP::Info::Layer3(...);
𧬠Inherited Classes
SNMP::InfoSNMP::Info::Bridge(For L2/L3 devices)SNMP::Info::EtherLikeSNMP::Info::EntitySNMP::Info::PowerEthernetSNMP::Info::IPv6SNMP::Info::LLDPSNMP::Info::DocsisHESNMP::Info::AdslLine
family tree is giving β¨royaltyβ¨
π Required MIBs
IP-MIBISIS-MIBOSPF-MIBBGP4-MIB
π Inherited MIBs
these ones aren't ours, they come from the ancestors, go read their requirements:
- See "REQUIREMENTS" in
SNMP::Infofor its MIB requirements. - See "Required MIBs" in
SNMP::Info::Bridgefor its MIB requirements. - See "Required MIBs" in
SNMP::Info::EtherLikefor its MIB requirements. - See "Required MIBs" in
SNMP::Info::Entityfor its MIB requirements. - See "Required MIBs" in
SNMP::Info::PowerEthernetfor its MIB requirements. - See "Required MIBs" in
SNMP::Info::IPv6for its MIB requirements. - See "Required MIBs" in
SNMP::Info::LLDPfor its MIB requirements. - See "Required MIBs" in
SNMP::Info::DocsisHEfor its MIB requirements. - See "Required MIBs" in
SNMP::Info::AdslLinefor its MIB requirements.
β GLOBALS β
these are the methods that return a scalar value straight out of SNMP, simple as, periodt.
$l3->mac()β returns the root port mac address π- (
"ifPhysAddress.1")
- (
$l3->router_ip()β grabs it from here:- (
"ospfRouterId.0")
- (
$l3->bgp_id()β comes from ("bgpIdentifier.0")- Returns the BGP identifier of the local system
$l3->bgp_local_as()β Returns the local autonomous system number π«Ά- (
"bgpLocalAs.0")
- (
π Overrides
these are the ones Layer3 rewrites to do its own thing, main character energy only.
$l3->model()β tries to reference$l3->id()to one of the product MIBs listed above π§- Removes
'cisco'from cisco devices for readability. (so it doesn't read like a brand ad, we get it)
- Removes
$l3->serial()β Returns a serial number if found from ENTITY-MIB and OLD-CISCO-... MIB.$l3->vendor()β Tries to cull a Vendor name from"sysDescr"$l3->root_ip()β Returns the primary IP used to communicate with the device. Returns the first found:OSPF Router ID("ospfRouterId") or anyOSPF Host IP Address("ospfHostIpAddress"). first come first served bestie π
π Globals imported from SNMP::Info
See "USAGE" in SNMP::Info for details.
πΈ Global Methods imported from SNMP::Info::Bridge
See "GLOBALS" in SNMP::Info::Bridge for details.
π Global Methods imported from SNMP::Info::EtherLike
See "GLOBALS" in SNMP::Info::EtherLike for details.
β¨ Global Methods imported from SNMP::Info::Entity
See "GLOBALS" in SNMP::Info::Entity for details.
π Global Methods imported from SNMP::Info:PowerEthernet
See "GLOBALS" in SNMP::Info::PowerEthernet for details.
π¦ Global Methods imported from SNMP::Info::IPv6
See "GLOBALS" in SNMP::Info::IPv6 for details.
π₯ Global Methods imported from SNMP::Info::LLDP
See "GLOBALS" in SNMP::Info::LLDP for details.
π Global Methods imported from SNMP::Info::DocsisHE
See "GLOBALS" in SNMP::Info::DocsisHE for details.
π Global Methods imported from SNMP::Info::AdslLine
See "GLOBALS" in SNMP::Info::AdslLine for details.
π TABLE METHODS π
okay bestie, these are the methods that hand you back tables of info, and the format is always the same: a reference to a hash. slay. π
π Overrides π
$l3->interfaces()β gives you the map between the SNMP Interface Identifier (iid) and the physical port name. π
But heads up, queen: it only returns those iids that have a description listed in $l3->i_description(). no description, no entry. that's the vibe check. β¨
$l3->i_subinterfaces()β hands you a reference to a hash of arrays, where key ="ifIndex"and value = array of"ifIndex". these are the VLAN subinterfaces ("l2vlan"type) hanging off their parent ("ethernetCsmacd"type) interface. it's giving family tree. π³
Example:
my $interfaces = $l3->interfaces();
my $i_subs = $l3->i_subinterfaces();
foreach my $iid (sort keys %$interfaces) {
my $port = $interfaces->{$iid};
my $subs = join(',', sort(map {$interfaces->{$_}} @{$i_subs->{$iid}}));
print "Port: $port has subinterfaces: $subs\n";
}
$l3->i_name()β reference to hash of iid β‘οΈ human set name. π«Ά
Defaults to "ifName", but it checks for an "ifAlias" first. lowkey picky, highkey correct.
$l3->i_duplex()β reference to hash of iid β‘οΈ current link duplex setting.
What it does: maps $l3->el_index() to $l3->el_duplex, then culls out full, half, or auto and sets the map to that value. culling era. βοΈ
Peep SNMP::Info::EtherLike for the el_index() and el_duplex() methods. iykyk.
π IP-MIB Arp Cache Table ("ipNetToMediaTable") π
$l3->at_index()β reference to hash. maps ARP table entries to Interface IIDs ("ipNetToMediaIfIndex").
If the device doesn't support "ipNetToMediaIfIndex", it'll try the deprecated "atIfIndex" instead. backup plan energy. π
$l3->at_paddr()β reference to hash. maps ARP table entries to MAC addresses ("ipNetToMediaPhysAddress").
If the device doesn't support "ipNetToMediaPhysAddress", it'll try the deprecated "atPhysAddress".
$l3->at_netaddr()β reference to hash. maps ARP table entries to IP addresses ("ipNetToMediaNetAddress").
If the device doesn't support "ipNetToMediaNetAddress", it'll try the deprecated "atNetAddress".
π΅ ARP Cache Entries π΅
bestie. listen. the"atTable"has been deprecated since 1991. you should never need to use these methods. like, that's older than most of us. see"ipNetToMediaTable"above instead, fr fr. π
$l3->old_at_index()β reference to map of IID to Arp Cache Entry ("atIfIndex").$l3->old_at_paddr()β reference to hash of Arp Cache Entries to MAC address ("atPhysAddress").$l3->old_at_netaddr()β reference to hash of Arp Cache Entries to IP Address ("atNetAddress").
π°οΈ BGP Peer Table ("bgpPeerTable") π°οΈ
$l3->bgp_peers()β reference to hash of BGP peer β‘οΈ local IP address ("bgpPeerLocalAddr").$l3->bgp_peer_id()β reference to hash of BGP peer β‘οΈ BGP peer identifier ("bgpPeerIdentifier").$l3->bgp_peer_state()β reference to hash of BGP peer β‘οΈ BGP peer state ("bgpPeerState").$l3->bgp_peer_as()β reference to hash of BGP peer β‘οΈ BGP peer autonomous system number ("bgpPeerRemoteAs").$l3->bgp_peer_addr()β reference to hash of BGP peer β‘οΈ BGP peer IP address ("bgpPeerRemoteAddr").$l3->bgp_peer_fsm_est_trans()β reference to hash of BGP peer β‘οΈ the total number of times the BGP FSM transitioned into the established state ("bgpPeerFsmEstablishedTransitions").$l3->bgp_peer_in_tot_msgs()β reference to hash of BGP peer β‘οΈ the total number of messages received from the remote peer on this connection ("bgpPeerInTotalMessages").$l3->bgp_peer_in_upd_el_time()β reference to hash of BGP peer β‘οΈ the elapsed time in seconds since the last BGP UPDATE message was received from the peer ("bgpPeerInUpdateElapsedTime").$l3->bgp_peer_in_upd()β reference to hash of BGP peer β‘οΈ the number of BGP UPDATE messages received on this connection ("bgpPeerInUpdates").$l3->bgp_peer_out_tot_msgs()β reference to hash of BGP peer β‘οΈ the total number of messages transmitted to the remote peer on this connection ("bgpPeerOutTotalMessages").$l3->bgp_peer_out_upd()β reference to hash of BGP peer β‘οΈ the number of BGP UPDATE messages transmitted on this connection ("bgpPeerOutUpdates").
πΊοΈ OSPF Interface Table ("ospfIfTable") πΊοΈ
$l3->ospf_if_ip()β reference to hash of OSPF interface IP addresses ("ospfIfIpAddress").$l3->ospf_if_area()β reference to hash of the OSPF area to which the interfaces connect ("ospfIfAreaId").$l3->ospf_if_type()β reference to hash of the OSPF interfaces' type ("ospfIfType").$l3->ospf_if_hello()β reference to hash of the OSPF interfaces' hello interval ("ospfIfHelloInterval").$l3->ospf_if_dead()β reference to hash of the OSPF interfaces' dead interval ("ospfIfRtrDeadInterval").$l3->ospf_if_admin()β reference to hash of the OSPF interfaces' administrative status ("ospfIfAdminStat").$l3->ospf_if_state()β reference to hash of the OSPF interfaces' state ("ospfIfState").
π€ OSPF Neighbor Table ("ospfNbrTable") π€
$l3->ospf_peers()β reference to hash of IP addresses the neighbor is using in its IP Source Addresses ("ospfNbrIpAddr").$l3->ospf_peer_id()β reference to hash of neighbor Router IDs ("ospfNbrRtrId").$l3->ospf_peer_state()β reference to hash of state of the relationship with the neighbor routers ("ospfNbrState").
π§΅ IS-IS Circuit Table π§΅
$l3->isis_circ_if_idx()β reference to hash of the interface index associated with the IS-IS circuit ("isisCircIfIndex").$l3->isis_circ_admin()β reference to hash of the IS-IS circuit's admin status ("isisCircAdminState").$l3->isis_circ_type()β reference to hash of the IS-IS circuit's type ("isisCircType").$l3->isis_circ_level_type()β reference to hash of the IS-IS circuit's level ("isisCircLevelType").
π IS-IS Adjacency Table π
$l3->isis_adj_id()β reference to hash of the peer id of adjacencies ("isisISAdjNeighSysID").$l3->isis_adj_type()β reference to hash of the type of adjacencies (Level 1 Intermediate System, Level 2 Intermediate System, Level 1+2 Intermediate System, unknown) ("isisISAdjNeighSysType").$l3->isis_adj_usage()β reference to hash of the type of adjacencies in use (undefined, Level 1, Level 2, Level1+2) ("isisISAdjNeighUsage").$l3->isis_adj_ip_type()β reference to hash of type of address (IPv4, IPv6, etc) on adjacencies ("isisISAdjIPAddrType").$l3->isis_adj()β reference to hash of addresses (IPv4, IPv6, etc) on adjacencies. β οΈ note: this returns hash-strings, so for IPs, use$l3->isis_peers()instead.$l3->isis_peers()β reference to hash of addresses (IPv4, IPv6) on adjacencies. converts hash strings fromisis_adjto proper IP (v4 and v6) formatting. glow-up complete. β¨
π¦ Table Methods imported from SNMP::Info π¦
See "USAGE" in SNMP::Info for details.
π Table Methods imported from SNMP::Info::Bridge π
See "TABLE METHODS" in SNMP::Info::Bridge for details.
π Table Methods imported from SNMP::Info::EtherLike π
See "TABLE METHODS" in SNMP::Info::EtherLike for details.
π§© Table Methods imported from SNMP::Info::Entity π§©
See "TABLE METHODS" in SNMP::Info::Entity for details.
β‘ Table Methods imported from SNMP::Info::PowerEthernet β‘
See "TABLE METHODS" in SNMP::Info::PowerEthernet for details.
π Table Methods imported from SNMP::Info::IPv6 π
See "TABLE METHODS" in SNMP::Info::IPv6 for details.
π£ Table Methods imported from SNMP::Info::LLDP π£
See "TABLE METHODS" in SNMP::Info::LLDP for details.
πΊ Table Methods imported from SNMP::Info::DocsisHE πΊ
See "TABLE METHODS" in SNMP::Info::DocsisHE for details.
βοΈ Table Methods imported from SNMP::Info::AdslLine βοΈ
See "TABLE METHODS" in SNMP::Info::AdslLine for details.
and that's the whole page bestie!! π this doc is perl v5.40.1, dated 2026-02-28, and it's straight from the User Contributed Perl Documentation for SNMP::...Layer3(3pm). you absolutely ate that. go forth and poll responsibly. periodt. πβ¨π¦π
π¦ where this page comes from
- ubuntu stonking: libsnmp-info-perl 3.975000-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms