|XP is just a number|
tshark RTCP capture via PERLby FirtyFree (Initiate)
|on Nov 08, 2011 at 10:48 UTC||Need Help??|
FirtyFree has asked for the
wisdom of the Perl Monks concerning the following question:
Hope everyone here is well :-)
I was hoping someone could give me there expert opinion on the following:
I have a tshark capture setup that will filter RTCP packets and output only the fields that I am interested in specifically "jitter, cumulative packet loss, src host ip, sdes text etc" I want to capture this in a Perl script and write each row of stdout to MySQL.
To cut down on resource utilisation I've added a filter to the tshark capture that means I only list data where the cumulative packet loss is over a specific threshold.
This is how I planned to capture the tshark data and write into MySQL (for example):tshark -i eth2 -o "rtp.heuristic_rtp: TRUE" -R 'rtcp.ssrc.cum_nr >= 50' -V -d udp.port==5005,rtcp -e rtcp.ssrc.fraction -e rtcp.ssrc.jitter -e rtcp.ssrc.cum_nr -e ip.src_host -e rtcp.sdes.text -S -T fields -E separator=, -E quote=d | perl ./tshark-cap.pl
Essentially I was going to write the data row by row using the following method:
Is there a better cleaner way to do this without spamming stdin? can I control tshark completely inside Perl?
I'm quite new to Perl so if you guys could point me in the right direction that would be awesome - the MYSQL part I am comfortable with as I have several scripts that read // write to MySQL DB's.