Sha256: 320feb3d37fbc558a7609fee7f1ebc59d0fe82d6051f63cef9a872f5156d4f95
Contents?: true
Size: 777 Bytes
Versions: 1
Compression:
Stored size: 777 Bytes
Contents
require "snmpjr/version" require "snmpjr/pdu" require "snmpjr/session" require "snmpjr/target" class Snmpjr def initialize options = {} @host = options.fetch(:host) @port = options.fetch(:port) || 161 @community = options.fetch(:community) end def get oids target = Snmpjr::Target.new.create(:host => @host, :port => @port, :community => @community) case oids.class.to_s when 'String' get_oid(oids, target) when 'Array' oids.map{|oid| get_oid(oid, target) } else raise ArgumentError.new 'You can request a single Oid using a String, or multiple using an Array' end end private def get_oid oid, target pdu = Snmpjr::Pdu.new.create oid Snmpjr::Session.new.send(pdu, target) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
snmpjr-0.1.0-java | lib/snmpjr.rb |