Hi,

I am quite new to Perl, and I am using smokeping.

I created a RemoteTraceroutePing Probe based on the RemoteTraceroute one. Basically, the idea is to create a SSH connection to a remote host, and fire regularly traceroute commands and read the output. So far, I was able to have something that works,, and it works with one or two probes, but with more than that, all standard outputs are mixed up.


I do create the connection this way:
# $ssh_sr contains the remote host like user@host open my $def_in, '<', '/dev/null'; $self->{ssh} = Net::OpenSSH->new($ssh_sr, default_stdin_fh => $def_in) +;
Then, the different targets (Traceroute commands) are called like this (in parallel):
# @cmd contains the traceping command to launch remotely via the exist +ing SSH connexion. my $killed; my (undef, $f_stdout, $f_stderr, $pid) = $self->{ssh}->open3(@cmd); while (<$f_stdout>){ # OUTPUT ANALYZED AND PROCESSED HERE $killed = kill(15, $pid); last; } waitpid $pid, 0; close $f_stdout; close $f_stderr;
The problem is, despite that I can launch several traceping simultaneously with individual pids, the f_stdout of one pid is receiving the stdout from others. How can I fix that ? Thank you

In reply to net::OpenSSH several commands, stdout are mixed up by Bolemo

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.