--0016e6d644f5aeaaed0474e0e87e Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 2009/10/1 Rocir Santiago <rocirleite / gmail.com> > Hi, NicoláÔ. > > Thanks for the reply. My switch works fine with SNMP. It's 3com Baseline > Switch 2226 Plus. Problem is though it may support SNMP protocol it sure won't support all the options (OIDs) the RFC defines. Some switches do support listing known devices, some don't. > My doubt it's about the ruby code to find the MAC > address of each computer "pluged" in my switch. I can figure out some > examples at the doc page of this lib. But when I just try to get the > ifPhysAddress, the application raises an error and I don't know why. > My experience with SNMP si mostly in C++, not Ruby, but it may be helpful to know which exception is your application raising. It may be because the OID is not supported (no such instance exception) or because it's not defined in your code. To assert if the switch does support this OID try using snmpget from console, not from within a program. BTW, if I remember correctly ifPhysAddress will give you the iface's mac internal to the switch, not the mac of the device in that port (there may be many known macs per port too). Regards, -- NicoláÔ Brailovsky - http://nicolasb.com.ar/ > > Here is the code: > > _________ > require 'snmp' > > ifTable_columns = ["ifIndex", "ifDescr", "ifInOctets", "ifOutOctets", > "ifPhysAddress"] > SNMP::Manager.open(:Host => 'xxx.xxx.xxx.xxx') do |manager| > manager.walk(ifTable_columns) do |row| > row.each { |vb| print "\t#{vb.value}" } > puts > end > end > _________ > > I just added the ifPhysAddress to the example in the site. If I just > remove the ifPhysAddress, it works fine. > > > NicoláÔ Brailovsky wrote: > > Rocir, you should first check if your switch supports this > > functionality. If > > it does I'd try to do an snmpwalk through the complete table to find an > > OID > > providing a list of known mac addresses, which will most likely be > > grouped > > by interface (port). > > > > This link may come in handy: http://www.oid-info.com/index.htm > > > > Regards > > > > -- > > NicoláÔ Brailovsky > > - http://nicolasb.com.ar/ > > - http://monosinfinitos.com.ar/ > > > > 2009/10/1 Rocir Santiago <rocirleite / gmail.com> > > -- > Posted via http://www.ruby-forum.com/. > > --0016e6d644f5aeaaed0474e0e87e--