Performance Testing

How to execute Linux command or shell script from APACHE JMETER


linux1Sometimes it is necessary for the load test to send a Linux command to verify the content/file exists in the remote Linux server. Every time it is not a fair idea to connect remote server by file server browsers like WinSCP, putty etc… as it is a load test. In such situations, JMETER offers a sampler called ‘SSH sampler’. This sampler is introduced to communicate with the Linux server over the ssh shell. It will be definitely useful for both Functional and Performance Testers.

Apache Jmeter’s SSH Sampler:

A sampler which will connect to a Linux server and execute Linux commands

Steps in detail:

1) Download SSH Sampler plugin from google’s website
2) Copy the jar to your local Apache Jmeter’s “lib/ext” folder.

3) Download “jsch-0.1.51.jar” and place it in your local Apache Jmeter’s “lib/” folder.

4) Open Jmeter-> ThreadGroup->Samplers-> SSH Command

5) Give hostname, username, password and the Linux command to be executed

6) Run Jmeter

7) Capture results in ‘View Results Tree’

Here is the image for your reference: