From: Miroslaw Niegowski Date: 2010-01-19T02:40:19+09:00 Subject: Re: SNMP in rails --00163649a623a19feb047d73d8b3 Content-Type: text/plain; charset=ISO-8859-1 2010/1/18 Atheeq Pasha > > snmpset($row['address']$row['snmp_community_str'],$oid.".".$row['reset_port'],'i','3'); > > snmpget($row['address'],$row['snmp_community_str'],$oid.".".$row['reset_port']); > > Heh, Wrong guess :) From php documentation of snmpset/get: The "type" parameter must be one of the following, depending on the type of variable to set on the SNMP host: i INTEGER u unsigned INTEGER t TIMETICKS a IPADDRESS o OBJID s STRING x HEX STRING d DECIMAL STRING n NULLOBJ b BITS So I think that the following code should work in ruby: require 'snmp' include SNMP manager = Manager.new(:Host => host) varbind = VarBind.new(oid.to_s + "." + row["reset_port"] , Integer.new(3)) manager.set(varbind) # And get: .. response = manager.get(oid.to_s + "." + row["reset_port"]) response.each_varbind do |vb| puts "#{vb.name.to_s} #{vb.value.to_s} #{vb.value.asn1_type}" end manager.close --00163649a623a19feb047d73d8b3--