Hi all

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:

while (<STDIN>) { chomp;@qos = split(',',$_); INSERT DATA INTO MYSQL...... }

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.

Thanks


In reply to tshark RTCP capture via PERL by FirtyFree

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.