Class: Copian::Collector::HpPortsCollector

Inherits:
PortsCollector show all
Defined in:
lib/copian/collector/hp/ports.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from AbstractCollector

#initialize

Constructor Details

This class inherits a constructor from Copian::Collector::AbstractCollector

Instance Method Details

#collectObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/copian/collector/hp/ports.rb', line 4

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