You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by "Derek Gill (dergill)" <de...@cisco.com> on 2008/06/06 13:07:52 UTC
redirect script output to Jmeter listener
Hi,
I have a number of Perl scripts I launch using the beanshell sampler.
The Perl scripts generally do some remote logging and print general
information from a database running on a remote server. Is there anyway
that I can pipe the output of the Perl script so that it is caught in my
Jmeter listener. I can see that it is possible to catch the the Perl
script return value in the listener, but I can't see if it is even
possible to pipe the entire script output back into the Jmeter listener.
Typically I launch the script as follows from the bean shell:
import java.util;
import java.lang;
String test_script = "/usr/bin/perl /root/test.pl \"select count(*) from
CLIENTSESSIONS;\"";
Runtime currentruntime = Runtime.getRuntime();
Process testingprocess = currentruntime.exec(test_script);
testingprocess.waitFor();
Thanks,
Derek.
Derek Gill
Software Test Engineer
IP Communications.
dergill@cisco.com
Phone :+353 91 384650
Cisco Internetworking Ltd.,
Block 10,
Galway Technology Park,
Parkmore,
Galway,
Ireland.
www.cisco.com <http://www.cisco.com/>
This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.
Re: redirect script output to Jmeter listener
Posted by sebb <se...@gmail.com>.
On 06/06/2008, Derek Gill (dergill) <de...@cisco.com> wrote:
>
>
>
> Hi,
>
> I have a number of Perl scripts I launch using the beanshell sampler. The Perl scripts generally do some remote logging and print general information from a database running on a remote server. Is there anyway that I can pipe the output of the Perl script so that it is caught in my Jmeter listener. I can see that it is possible to catch the the Perl script return value in the listener, but I can't see if it is even possible to pipe the entire script output back into the Jmeter listener.
>
This is a Java question.
Provided that you can capture the output from the exec() command, you
can return it from BeanShell.
Have a look at the Process Javadoc, in particular getOutputStream()
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Process.html#getOutputStream()
> Typically I launch the script as follows from the bean shell:
>
> import java.util;
> import java.lang;
>
> String test_script = "/usr/bin/perl /root/test.pl \"select count(*) from CLIENTSESSIONS;\"";
> Runtime currentruntime = Runtime.getRuntime();
> Process testingprocess = currentruntime.exec(test_script);
> testingprocess.waitFor();
>
> Thanks,
> Derek.
>
>
>
>
>
> Derek Gill
> Software Test Engineer
> IP Communications.
>
> dergill@cisco.com
> Phone :+353 91 384650
>
>
> Cisco Internetworking Ltd.,
> Block 10,
> Galway Technology Park,
> Parkmore,
> Galway,
> Ireland.
> www.cisco.com
> This e-mail may contain confidential and privileged material for the sole use of the intended recipient. Any review, use, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply e-mail and delete all copies of this message.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org