From 31ddbad108b6c228b36f4ad850b7f2ff6565c0e7 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 2 Sep 2010 21:51:08 -0700 Subject: Remove ifDescr override Net-snmp now generates ifDescr itself, so don't need all the parsing and override stuff --- scripts/snmp/vyatta-snmp.pl | 70 --------------------------------------------- 1 file changed, 70 deletions(-) (limited to 'scripts/snmp/vyatta-snmp.pl') diff --git a/scripts/snmp/vyatta-snmp.pl b/scripts/snmp/vyatta-snmp.pl index d366f1ba..e077482c 100644 --- a/scripts/snmp/vyatta-snmp.pl +++ b/scripts/snmp/vyatta-snmp.pl @@ -60,7 +60,6 @@ sub snmp_start { select $fh; snmp_get_constants(); snmp_get_values(); - snmp_get_descr(); snmp_get_traps(); close $fh; select STDOUT; @@ -250,75 +249,6 @@ EOF } } -# Use ethtool to find businfo -sub ether_businfo { - my $dev = shift; - my $bus; - - open( my $ethtool, "/usr/sbin/ethtool -i $dev 2>/dev/null |" ) - or die "ethtool failed: $!\n"; - - # ethtool -i produces: - # - # driver: sky2 - # version: 1.28 - # firmware-version: N/A - # bus-info: 0000:04:00.0 - while (<$ethtool>) { - chomp; - if (/^bus-info: ([0-9a-f:]+)/) { - $bus = $1; - last; - } - } - close $ethtool; - return $bus; -} - -# Use lspci to find hardware information -sub pci_name { - my $id = shift; - my $vendor = ""; - my $device; - my $revision = ""; - - return unless $id; - - open( my $lspci, '-|', "/usr/bin/lspci -v -mm -s $id") - or die "lspci failed: $!\n"; - - while (<$lspci>) { - chomp; - $vendor = "$1 : " if (/^Vendor:\s*(.*)$/); - $device = $1 if (/^Device:\s*(.*)$/); - $revision = " (rev $1)" if (/^Rev:\s*(.*)$/); - } - close $lspci; - - return unless $device; - return $vendor . $device . $revision; -} - -# Generate interface description information -sub snmp_get_descr { - opendir (my $sysfs, "/sys/class/net") - or die "Could not open /sys/class/net: $!"; - - while (my $dev = readdir $sysfs) { - next if ($dev =~ /^\./); - next unless open (my $ifindex, '<', "/sys/class/net/$dev/ifindex"); - - chomp (my $iif = <$ifindex>); - close $ifindex; - - my $descr = pci_name(ether_businfo($dev)); - next unless $descr; - - print "override ifDescr.$iif octet_str \"$descr\"\n"; - } -} - - # Configure SNMP client parameters sub snmp_client_config { my $config = new Vyatta::Config; -- cgit v1.2.3