Sha256: 4de96260529148d4fd2297f872d62a359182b204c72759462142792b61e9ddf4

Contents?: true

Size: 555 Bytes

Versions: 3

Compression:

Stored size: 555 Bytes

Contents

require "snmpjr/pdu"
require "snmpjr/session"

class Snmpjr
  class Getter

    def initialize target
      @target = target
      @session = Snmpjr::Session.new
    end

    def get_multiple oids
      @session.start
      result = oids.map {|oid|
        send_oid oid
      }
      @session.close
      result
    end

    def get oid
      @session.start
      result = send_oid oid
      @session.close
      result
    end

    private

    def send_oid oid
      pdu = Snmpjr::Pdu.new.create oid
      @session.send(pdu, @target)
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
snmpjr-0.1.4-java lib/snmpjr/getter.rb
snmpjr-0.1.2-java lib/snmpjr/getter.rb
snmpjr-0.1.3-java lib/snmpjr/getter.rb