Bolemo has asked for the wisdom of the Perl Monks concerning the following question:
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.
Then, the different targets (Traceroute commands) are called like this (in parallel):# $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) +;
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# @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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: net::OpenSSH several commands, stdout are mixed up
by salva (Canon) on Sep 17, 2020 at 06:29 UTC | |
by Bolemo (Acolyte) on Sep 17, 2020 at 11:43 UTC | |
by salva (Canon) on Sep 17, 2020 at 20:50 UTC | |
by Bolemo (Acolyte) on Sep 17, 2020 at 23:24 UTC | |
|
Re: net::OpenSSH several commands, stdout are mixed up
by jcb (Parson) on Sep 17, 2020 at 01:27 UTC | |
by salva (Canon) on Sep 17, 2020 at 06:32 UTC |