#=== FUNCTION ================================================================ # NAME: snmp_get # PURPOSE: fetch the Physical Address of the eth0 int # PARAMETERS: $sess, the snmp_session returned by the init. #=============================================================================== sub snmp_get(){ my $snmp_sess = shift; unless ($snmp_sess){ print STDERR "snmp_session object has fallen out of scope\n" if $debug; return; } } $func_map = { INTERFACES => @{'1.3.6.1.2.1.2.2.1.2'}, MACS => @{\&get_ints } } get_ints(){ my @interface_names_oid=$func_map{INTERFACES}; $interfaces_table=$snmp_sess->get_entries(-columns => \@interface_names_oid); if ($interfaces_table){ foreach my $int_oid (keys %{$interfaces_table} ){ ( $int_id ) = ( $int_oid =~ m{\.(\d+)$} ); push(@interfaces_oids, "1.3.6.1.2.1.2.2.1.6.$int_id") if $interfaces_table->{$int_oid}=~m{eth0}; } } } get_macs(){ $snmp_res = $snmp_sess->get_request( -varbindlist => \@interfaces_oids ); }