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