Sha256: 0e0009ff9f5aa8b3796a10600fc9fa97e0fde819a6906d3f57e79b2f17ca425a

Contents?: true

Size: 571 Bytes

Versions: 2

Compression:

Stored size: 571 Bytes

Contents

module Copian
  module Collector
    class CiscoVlansCollector < AbstractCollector # :nodoc:
      def collect
        oid = SNMP::ObjectId.new('1.3.6.1.4.1.9.9.46.1.3.1.1.18.1')
        @manager.walk(oid) do |r|
          r.each do |varbind|
            vlan_id      = varbind.name.index(oid).to_s.to_i
            vlan_ifindex = varbind.value.to_i

            # NOTE: Ignore ids between 1002 and 1005 they are seemingly fake
            next if vlan_id.between?(1002, 1005)
            yield vlan_id, vlan_ifindex
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
copian-1.3.3 lib/copian/collector/cisco/vlans.rb
copian-1.3.2 lib/copian/collector/cisco/vlans.rb