I want to execute one of the commands in a router, where the command won't display anything, to be more clear, here is the command

router> monitor traffic interface ae10 matching "tcp port 179" size 1500 write-file capture.pcap

when you issue the above command, here is the response from the router

Address resolution is ON. Use <no-resolve> to avoid any reverse lookup delay. Address resolution timeout is 4s. Listening on ae10, capture size 1500 bytes

In the above output for the command " monitor traffic interface ae10 matching "tcp port 179" size 1500 write-file capture.pcap", it will listen for some packet and store in pcap file, the command will/should stop only when we send CTRL_C

I tried one internal command, of our company, here is the following code and error

$rh2->cmd(mode=>'cli', cmd=>"monitor traffic interface ae10 ma +tching \"tcp port 179\" size 1500 write-file capture.pcap"); $rh2->send_control_char(char=>'CTRL_C', timeout=>2400);

the code gives the following error

Feb 17 21:26:35 [INFO ] [sherlock.1] [cmd] monitor traffic interface a +e10 matching "tcp port 179" size 1500 write-file capture.pcap Feb 17 21:27:35 [ERROR] [sherlock.1] JT::Device::_send: No pattern mat +ched during 'monitor traffic interface ae10 matching "tcp port 179" s +ize 1500 write-file capture.pcap' from patterns: [ '-re', '^(?:{(?:ma +ster|backup)(?:.*)}[\r\n]*)?(?:\[edit[^\]]*\]\s+)??JT_53_sherlock:\s* +' ] Feb 17 21:27:35 [ERROR] [sherlock.1] Device did not respond as expecte +d.Please refer the expect file Feb 17 21:27:35 [ERROR] Expected patterns are : -re ^(?:{(?:master|bac +kup)(?:.*)}[\r\n]*)?(?:\[edit[^\]]*\]\s+)??JT_53_sherlock:\s*

Is there a way to solve this using any perl commands


In reply to Send control break in PERL by Anonymous Monk

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.