Class: Copian::Collector::CiscoAddressesCollector

Inherits:
AddressesCollector show all
Defined in:
lib/copian/collector/cisco/addresses.rb

Overview

:nodoc:

Constant Summary collapse

IpNetToMediaPhysAddress =

IPv4 only

SNMP::ObjectId.new('1.3.6.1.2.1.4.22.1.2')
IpNetToPhysicalPhysAddresss =

IP version agnostic

SNMP::ObjectId.new('1.3.6.1.2.1.4.35.1.4')

Instance Method Summary collapse

Methods inherited from AbstractCollector

#initialize

Constructor Details

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

Instance Method Details

#collectObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/copian/collector/cisco/addresses.rb', line 7

def collect
  oid = IpNetToMediaPhysAddress

  @manager.walk(oid) do |r|
    r.each do |varbind|
      mac_addr = value_to_mac_address(varbind.value)
      ip_addr  = name_to_ip_address(varbind.name, oid)
      append_mac_and_ip(mac_addr, ip_addr)
    end
  end

  @map.each do |mac, ips|
    yield mac.dup, ips if block_given?
  end
end