Need to encrypt the password using Jmeter - jmeter

I am making Db connections in my Jmeter script using "JDBC Connection Configuration"(Using both Oracle and MySQL DB), but the DB Password is Visible in the Jmeter Console and in Log File and this a serious security issue as far as my client is concerned
Is there any way to encrypt the password before if password get logged into the Jmeter console/Logfile ?

Don't keep sensitive information like passwords in the .jmx test scripts, if you need to supply a password for a JDBC Connection - use __P() function like:
${__P(password,)}
Once done you can set the password by passing it via -J command-line argument like:
jmeter -Jpassword=my-secret-password -n -t test.jmx -l result.jtl
In this case you will get only ${__P(password,)} in logs even if you have the most verbose level so it will be more or less secure.
More information: Apache JMeter Properties Customization Guide

Related

How to run this command in os process sampler in Jmeter

I have a command something like ssh #*. When I execute this command in CMD it asks for password and upon entering the password, the connection will be successful. Please help me how can I handle this using os process sampler
I don't think you cannot handle this using ssh command as it doesn't allow providing the password as the parameter, it can only open an interactive shell which is not supported by the OS Process Sampler.
So instead of ssh client you need to consider the following alternatives:
Use key-based authentication so you won't have to provide the password
Use sshpass command
Use expect command
Switch to SSH Command sampler which allows execution of arbitrary commands over SSH channel, it supports both password and key-based authentication mechanisms, see How to Run External Commands and Programs Locally and Remotely from JMeter article for more details

JMeter Distributed Runner not able to Generate the Consolidated Reports

When I am running a simple standalone JMeter script using command line as below
jmeter -n -t your_script.jmx
This generates a CSV file which contains all the data related to the execution.
However, when the same JMeter file executed for a distributed load testing with multiple JMeter Server IP addresses which will simulate the given number of users and runs on the target server, I am not able to get the jmeter.csvfile Generated(But the command runs successfully).
The command I have used for distributed execution is
jmeter -n -t script.jmx -R IP_address1, IP_address2,...
Now, I should get a consolidated jmeter.csv file from this execution. But, I am not getting one.
Same is the case with JMeter API DistributedRunner Class- We are not getting the consolidated jmeter.csv file and reports.
This command:
jmeter -n -t your_script.jmx
does not generate any CSV file, you need to add -l command-line argument and provide desired results file location like:
jmeter -n -t your_script.jmx -l jmeter.csv
The same applies for distributed testing:
jmeter -n -t script.jmx -R IP_address1, IP_address2 -l jmeter.csv
If you provide -l command-line argument but still not getting any results most probably your script execution fails on remote slaves somewhere somehow. Follow the below checklist in order to get to the bottom of the script failure:
Inspect jmeter.log file on master machine and jmeter-server.log on the remote slaves, if something goes wrong - most probably you will find the cause in log files
Make sure that JRE version is the same on master and the slaves
Make sure that JMeter version is the same on master and the slaves, it's recommended to use the latest JMeter version where possible
If the test relies on any of the JMeter Plugins - make to install them all onto all slave machines. The plugins can be installed using JMeter Plugins Manager
If your test is using CSV Data Set Config - you will need to copy the CSV file to all slaves manually
If your test needs any additional JMeter Properties you will need to supply the properties via -J or -D command-line arguments on all the machines or via -G command-line arugment on the master

Setting the DB password in JDBC configuration from csv file? JMETER

I am trying to get the datatbase url, password and username from a csv file in the JDBC configuration. The post JDBC requests and query DB.
The main moto is not to touch the .jmx test plan and provide values externally.
How can I do this?
JDBC Connection Configuration is a configuration element therefore it is being executed before any JMeter Variables are initialised.
So the easiest option would be setting url and credentials using __P() function like:
Once done you will be able either to set the properties value in user.properties file (lives in "bin" folder of your JMeter installation) like:
url=jdbc:mysql://localhost:3306/dbname
username=root
password=secret
Or define them through -J command-line option:
jmeter -Jurl=jdbc:mysql://localhost:3306/dbname -Jusername=root -Jpassword=secret -n -t test.jmx -l result.jtl
More information:
Configuring JMeter
Overriding Properties Via The Command Line
Apache JMeter Properties Customization Guide
If you have to use the CSV file you can go for __CSVRead() function, in this case you can get first entry in the csv file as ${__CSVRead(test.csv,0)}, second as ${__CSVRead(test.csv,1)}, etc.

How to record script for putty connected application on Jmeter.

Actually i need to record a script for the application which is connected via putty software.
For opening my application i need to follow below mentioned steps -
1. Click on Putty.exe icon.
2. Enter Hostname.
3. Select SSH as connection type.
4. click on Save.
4. Click on Open button.
I need to record these all steps using jmeter.
Please help me with feasibility and practicality ...
It is not something you can "record", if you need to execute a command on a remote machine it will make more sense to go for plink command from JMeter's OS Process Sampler
Download plink.exe and drop it somewhere to you local drive
Add OS Process Sampler to your Test Plan and configure it like:
Command to execute: cmd
First parameter: /c
Second parameter: `plink.exe username#hostname -pw password command
For example:
c:\jmeter\bin\plink.exe johndoe#localhost -pw secret cowsay "Jmeter is great"
The output will be available as normal Sample Result:
See How to Run External Commands and Programs Locally and Remotely from JMeter article for more details on kicking off 3rd-party programs from JMeter scripts.
You should add JMeter plugin SSH Protocol Support and SSH connect without putty.
SSH Sampler for Jakarta JMeter that executes commands (eg, iostat) over an SSH session, and returns the output
After you add the plugin Add -> Sampler -> SSH Command
And fill the authentication details and write your command in Command field (currently date)

JMeter Parameter Passing in CLI mode is not working with -r (remote) switch

I am trying to pass the Thread count parameter to JMeter in CLI mode. This works perfectly well when the script is running locally. I need to run the script remotely, so I am using the -r switch so that the JMeter script runs on the configured remote clients.
This is my cli command:
jmeter -n -t "C:\ScriptLocation\Sanity_WebV2_Prod.jmx" -r -l c:\CSV\log.jtl -Jusers=4
The intention is that the above command should run the script on remote machine for 4 users (threads). Number of Threads in the thread properties is set to ${__P(users)}.
But the script is actually running only for 1 user (the default values) not for 4 users that is passed as the parameter.
When executed the above mentioned cli command w/o -r switch i.e script executing on the Local machine it is working perfectly fine i.e for 4 users.
Need help in solving this problem. Thanks
Try to use -Gusers option instead of -Jusers one:
-D[prop_name]=[value] - defines a java system property value.
-J[prop name]=[value] - defines a local JMeter property.
-G[prop name]=[value] - defines a JMeter property to be sent to all remote servers.

Resources