Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-04-24 09:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found