Is it possible to login to Linux/AWS instance using ssh key in Jmeter? - jmeter

Is it possible to login to Linux/AWS instance using ssh key in Jmeter?
We have to login to Linux system which has (login to the machines which are created using a public/private key) by using Jmeter and perform few actions.
Please guide.

Yes, You can accomplished this using SSH Command sampler.
Download plugin manager https://jmeter-plugins.org/install/Install/ and place the jar in your jmeter/lib/ext folder.
Open Jmeter >> Options >> Plugin Manager >>Install SSH Protocol Support
Restart Jmeter and add thread group, SSH command sampler and View result tree listener to your test plan
Enter the command you want to execute under command section and check the result in the listener.

Related

Connect to Jenkins server via SSH

I was wondering if I can ssh a local instance of Jenkins. When I go to Jenkins CLI menu in the UI, there's a comment saying the below:
You can access various features in Jenkins through a command-line
tool. See the documentation for more details of this feature. To get
started, download jenkins-cli.jar, and run it as follows:
java -jar jenkins-cli.jar -s http://localhost:8080/ -webSocket help
So I tried it and it worked but it only gave a list of limited commands which I can execute. So I searched more and found I can use -ssh instead of -webSocket but I get the same result as -webSocket.
What I want to do is accessing the Jenkins bash so I can test my build scripts.
I'm trying
ssh 127.0.0.1 -p 23 // I set this port in the settings
but I keep getting :
shell request failed on channel 0
is it impossible what I'm trying to do? if not, how can I achieve it?

JMeter - Add Client side Certificate and key

How can we add a client-side certificate and key to JMeter Script?
Every time I'm navigating to JMeter -> Options -> SSL Manager and browsing the Certificate and entering the password then it's only allowing me to run the script successfully, else I'm getting the forbidden error access denied.
I have tried the below steps, but still facing the same issue:
Added below lines in JMeter properties:
javax.net.ssl.keyStoreType=pkcs12
javax.net.ssl.keyStore=C:\certs\mycert.p12
javax.net.ssl.keyStorePassword=password
Tried using the JSR223 Sampler in JMeter script but still no luck.
Thanks in advance.
Forget about jmeter.properties file, any customization of JMeter Properties should be done in user.properties file or in a separate copy of jmeter.properties which needs to be passed to JMeter via -p command-line argument
In your case you're trying to change System Properties so you need to put these lines to system.properties file
JMeter restart will be required to pick the properties up
More information:
Configuring JMeter
How to Set Your JMeter Load Test to Use Client Side Certificates

Jmeter OS Process sampler is not executing in bash mode

My scenario is like, Initially i need to connect to a server through ssh command. once i connected to it enter into bash mode by typing 'bash' command then need to execute few more commands.
I have used Os Process sampler to do this and executed in docker container
Issue 1:) Getting "pseudo-terminal will not be allocated because stdin is not a terminal" error while doing ssh to that particular server.
enter image description here
Issue 2:-) Failed to execute the command in bash mode
enter image description here
Can you please help me on this
If your "ssh" command assumes entering the password - you won't be able to achieve this because the password has to be supplied interactively.
If you need to execute a command (or several commmans) on the remove machine over SSH connection it's better to consider using SSH Command sampler (can be installed as a part of the SSH Protocol Support bundle using JMeter Plugins Manager
Once the plugin is installed you can use it for executing your commands over SSH channel:
More information: How to Run External Commands and Programs Locally and Remotely from JMeter

Jmeter server.bat file error

Please give me solution for the below error.
Could not find ApacheJmeter_core.jar ... ... Trying JMETER_HOME=.. Found ApacheJMeter_core.jar Created remote object: UnicastServerRef [liveRef: [endpoint:192.168.8.108:50019 ,objID:[-30cb105c:15ca098204b:-7fff, 5736149660821635846]]]
I tried the below way also, am not able to launch
"I just hard coded the path in my jmeter_server.bat."
Am doing testing now.. if any one knows please update here.
This is not an error at all, it means that you successfully launched a JMeter slave which is now waiting for a command from the JMeter master.
So now you need to start JMeter Master using one of the following approaches:
Pass slave IP address via -R command-line argument like:
jmeter -R 192.168.8.108 -n -t test.jmx -l result.jtl
Define remote_hosts JMeter Property by adding the next line to user.properties file on JMeter Master node:
remote_hosts=192.168.8.108
References:
JMeter Distributed Testing Step-by-step
Apache JMeter Properties Customization Guide
If you need just to open JMeter GUI you will need to launch jmeter.bat script or alternatively directly call java from JMeter's "bin" folder like:
java -jar ApacheJMeter.jar

execute a Linux command on a EC2 instance using Jmeter ssh sampler

I’m trying to execute a Linux command from my local windows server to remote EC2 instance using Jmeter ssh sampler plug in ,what is the way to connect to ec2 with my private key file and send the command?
Follow next simple steps:
From JMeter SSH Sampler Releases page:
Download latest version of ApacheJMeter_ssh-x.x.x.jar and drop it to /lib/ext folder of your JMeter installation
Download jsch-x.x.x.jar and drop it to /lib folder of your JMeter installation
Restart JMeter to pick the jars up
Add SSH Command Sampler to your Test Plan - there will be "Client certificate" input section where you can specify private key and password if needed
See How to Run External Commands and Programs Locally and Remotely from JMeter guide for more detailed information on the topic.

Resources