0
votes

I have scenario like I need to run one API curl request which is in 12.34.567 after logging into this I have to login one more host 98.76.543.

After logged in to second host I have to run curl -XPOST -H"Content-type:json" http://localhost:8080/test/ --/file Json

Am able to connect using ssh sampler to first host but inside that I have to log one more host. Can anyone please help out from this.

Thanks in advance!

1
On which machine you have installed the JMeter ? - Sariq Shaikh
Hye Sariq I have installed jmeter in my local mac machine - Ivank
The rule is simple, from your machine site should be accessible through http otherwise it won’t be possible to record/automate it. I am not sure about any other approach for the same. - Sariq Shaikh
Hye Sariq, We can access those Host through ssh only. - Ivank
Let's pretend mumbers you give are valid IPs. What are you doing? ssh 12.34.567 from here ssh 98.76.543 and finally curl -XPOST -H"Content-type:json" http://localhost:8080/test/ --/file Json? And you want use jMeter to do perf test? Is it right? - lojza

1 Answers

0
votes

If you can access the host via SSH protocol only you can consider using JMeter SSH Sampler in order to execute arbitrary SSH command, including curl, something like:

enter image description here

If everything goes well you should be able to see the response in the View Results Tree listener, apply Post-Processors, Assertions, etc.

enter image description here

More information: How to Run External Commands and Programs Locally and Remotely from JMeter

SSH Command sampler can be installed as a part of SSH Protocol Support bundle using JMeter Plugins Manager

enter image description here