All pastes #791564 Raw Edit

Bloody ruby-snmp

public ruby v1 · immutable
·published 2007-11-20 23:20 UTC
rendered paste body
  def query(*args)    t = @manager.get(args)    h[t.varbind_list[0].name.to_s.sub!(/\.\d+$/, '')] = t.varbind_list[0].value.to_s    response = @manager.get_next(args)    response.each_varbind do |vb|      h[vb.name.to_s.sub!(/\.\d+$/, '')] = vb.value.to_s    end    @results = h  end  def query(*args)    h = {}    @manager.walk(args) do |row|      ary = []      row.each do |vb|        key = vb.name.to_s.sub!(/\.\d+$/, '')        unless h.has_key?(key)          h[key] = []        end        h[key].push(vb.value.to_s)      end    end    @results = h end