Skip to content

Latest commit

 

History

History
58 lines (39 loc) · 1.28 KB

gnuplot_traffic_pcap.md

File metadata and controls

58 lines (39 loc) · 1.28 KB

Monitoring traffic using Gnuplot

Get the detailed information about the plotting from the below-mentioned websites for Gnuplot and Tcpstat.

Gnuplot

Tcpstat

Data preparation:

Generate pcap for required duration if the original capture file is too large (optional)

timeout 10 tcpdump -r sample-point-F-202001011400.pcap -w sample.pcap

The dataset used above can be downloaded from MAWI Working Group Traffic Archive

Generate the traffic data points

tcpstat -o "%R\t%b\n" -r sample.pcap > stat.dat

Remove the last line from generated data file (to avoid incomplete data point)

sed -i '$ d' stat.dat

Plotting:

Create Gnuplot script

nano gnuplot.script

# Set linestyle 1 to blue (#0060ad)

set term png
set out ARG2
set style line 1 \
    linecolor rgb '#0060ad' \
    linetype 1 linewidth 2 \
    pointtype 7 pointsize 1.5

set format y '%.0s%cb'

plot ARG1 with linespoints linestyle 1
set out

Run Gnuplot

gnuplot -c gnuplot.script stat.dat test.png

test.png