simulating sflow output from existing PCAP

19 views
Skip to first unread message

Hanan Shteingart

unread,
Nov 21, 2022, 12:48:42 PM11/21/22
to sFlow
Hi,
I have a PCAP dump file collected from a sniffer (full packets 1:1 rate recording).
I would like to simulate "how it would have been seen if there was an sflow sampler?".
In other words, I would like to get sFlow data as if it was active at time of recording.
Is there a script I can run which will convert PCAP file to sFLOW format?

Thanks,
HS

neil....@inmon.com

unread,
Nov 27, 2022, 3:23:34 PM11/27/22
to sFlow
If you compile the latest sflowtool,  it has an option for this.

cd sflowtool
./boot.sh
./configure
make
sudo make install

and then:

sflowtool -r mypackets.pcap -R 100 -f 127.0.0.1/7777

will sample the packets at 1:100 and send to local UDP port 7777.  You can confirm they are arriving by running:

sflowtool -p 7777

in another window.

I plan to add options to set the agent address (it currently comes out as 0.0.0.0),  and to compress time so you can "playback" at different speeds (or as fast as possible).

The encoding routines in sflow_xdr.h are experimental and have not been tested thoroughly,  so please let me know if you find bugs.
(I was curious to see how efficiently the XDR encoding could be done.  The old sFlow encoding library does a lot of redundant copying and cross-checking.)
Reply all
Reply to author
Forward
0 new messages