Project

em-sflow

0.01
No commit activity in last 3 years
No release in over 3 years
EventMachine-powered sFlow Collector
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.12.10
 Project Readme

sFlow Library for EventMachine¶ ↑

Summary¶ ↑

This gem collects, parses, and optionally proxies sampled flow records from network switches and routers. For information about sFlow, refer to www.sflow.org.

Features¶ ↑

Version 1.0.0

  • Ability to parse the following sFlow messages: Raw Packet Header, Generic Interface Counter, Ethernet Interface Counter

  • All other sFlow messages are stubbed out. Their implementation should take no more than a few minutes for someone with access to an sFlow-capable device exporting these message types.

  • Ability to proxy a copy of the sFlow packet to a secondary collector.

Examples¶ ↑

Collector:

c = EventMachine::SFlow::Collector.new(:host => "127.0.0.1")

c.on_sflow do |pkt|
  puts "Got #{pkt.samples.count} samples"

  pkt.samples.each do |sample|
    sample.records.each do |record|
      if record.is_a? EM::SFlow::RawPacketHeader
        puts "Received a sampled packet from #{pkt.agent} of length #{record.header.size}"
      elsif record.is_a? EM::SFlow::GenericInterfaceCounters
        puts "Interface #{record.if_index} on #{pkt.agent} has seen #{record.if_in_octets} inbound bytes, #{record.if_out_octets} outbound bytes"
      end
    end
  end
end

Proxy:

c = EventMachine::SFlow::Collector.new(:host => "127.0.0.1")
c.proxy_to "192.168.1.1"

Multiple callbacks and proxy targets can be defined simultaneously

Change Log¶ ↑

Version 1.0.0:

  • Initial release

Credits¶ ↑

Author: Norman Elton normelton@gmail.com