Sha256: 3ac0c08151aacaaaa54f0a8b802c5ad2616a565068dac42ab7b8ddff30a41c5b

Contents?: true

Size: 661 Bytes

Versions: 2

Compression:

Stored size: 661 Bytes

Contents

module Copian
  module Collector
    class HpPortsCollector < PortsCollector # :nodoc:
      def collect
        oid = SNMP::ObjectId.new('1.3.6.1.4.1.11.2.14.11.5.1.9.4.2.1.1')
        results = Hash.new

        manager.walk(oid) do |r|
          r.each do |varbind|
            results[varbind.value.to_i] ||= Array.new
            results[varbind.value.to_i] << suboid_to_mac(varbind.name.index(oid))
          end
        end

        results.each do |if_index, addresses|
          yield if_index, addresses
        end
      end
      protected
        def suboid_to_mac(oid)
          super(oid.to_s.gsub(/^[0-9]+\./, ''))
        end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
copian-1.3.3 lib/copian/collector/hp/ports.rb
copian-1.3.2 lib/copian/collector/hp/ports.rb