JMeter - The JVM should have exited but did not - jmeter

I have a script which does the following:
Script executes fine in GUI mode:
jmeter -q C:/Users/503289283/Downloads/eml_base.properties -t Service_Names.jmx
When executed in Non-GUI mode i.e.
jmeter -q C:/Users/503289283/Downloads/eml_base.properties -n -t Service_Names.jmx
We receive the below message:
Have added an entry in the log4j2.xml file. Restarted JMeter.
Executed the script again in Non-GUI mode. Still see the same message. Didn't find anything suspicious in the log file.
Not sure where is the issue. Please help.
Regards,
Ajith

Script executes fine in GUI mode:
jmeter -q C:/Users/503289283/Downloads/eml_base.properties -t Service_Names.jmx
it doesn't mean that the "script executes fine", it means that you're just opening Service_Names.jmx test plan in JMeter GUI, the script is being "executed" when you click this button:
Or press CTRL+R
Your test cannot be finished successfully (in fact there are no successful Sample Results) because SSH Command sampler is still waiting for the response from the SSH server.
I don't know what eml status command does and how does the output look like,try running it via new instance of Bash (or whatever is your shell) interpreter as:
/bin/bash -c "eml status"
If the command is interactive, i.e. the output never ends until you press the button, you will need to reconsider your approach.
More information: How to Run External Commands and Programs Locally and Remotely from JMeter

Related

How do I prevent JMeter from exiting upon successful execution of the test?

I am running JMeter version 3.3 in non-GUI mode and I do not want the process to exit upon successful execution of the test.
I have tried running following command:
$ ./bin/jmeter -n -t scenarios/WebTestPlan.jmx -LDEBUG -Jjmeterengine.force.system.exit=false
But it doesn't do the trick. How do I achieve desired behavior?
If basing your approach on time is acceptable and you don't need JMeter report to be generated on Heroku, add a tearDown Thread Group that contains an infinite sleep using Timer.
If you need report, then do a sleep in a shell

Quit Jmeter after tests and save aggregate reports

Yesterday due to some reason my Jmeter Machine crashed and I do not have results.
These results run overnight on a laptop, what I am looking for is, I can quit Jmeter ones tests are done and my reports get saved automatically.
Given you run JMeter in command-line non-GUI mode like:
jmeter -n -t /your/script.jmx -l /test/results.jtl
JMeter should store test execution results in the results.jtl file. When the test is finished you will be able to open the file with the Listener of your choice using "Browse" button and analyze the results.
Even in that case you can loose some data in case of JVM crash, by default JMeter doesn't store each single result, it periodically flushes results data. You can add the next line to user.properties file in order to tell JMeter to store each single result immediately (JMeter restart will be required to pick the property up):
jmeter.save.saveservice.autoflush=true
Alternative way is passing the property via -J command-line argument like:
jmeter -Jjmeter.save.saveservice.autoflush=true -n -t /your/script.jmx -l /test/results.jtl
See Listeners > Default Configuration to learn more about JMeter defaults, what properties are available and what can be changed to make results to look accordingly to your requirements
Run the JMeter always in Non-GUI mode.
Following is the command:
jmeter.bat -n -t Sctipt.jmx -l results.jtl
-l : option to save the results.
When the test is completed, automatically results will be saved in results.jtl file. you can give full path also, otherwise, saves the file in current directory i.e., JMeter folder where 'jmeter.bat' file present.
Don't keep any listeners in the script as they utilizes system resources.

insert delay in jmeter in capturing results

I have a jmeter script which does a remote ssh and executes a R script now I need the jmeter to delay wherein it starts capturing results in the listeners after say 6 seconds how can I achieve that.
I don't think you'll be able to do it using JMeter Test Elements however you can insert a delay on SSH command level using sleep command like:
./your_R_Script && sleep 6
See How to Run External Commands and Programs Locally and Remotely from JMeter for more tips and tricks on how to kick off remote processes from JMeter

Jmeter - running GUI test from terminal

I'm trying to run Jmeter GUI test from terminal (in MAC). instead of running the GUI tests (that work when running from GUI), it created another folder next the existing one - named without underscore. my tests folder is 'Jmeter_Tests' and the terminal run creates 'Jmeter Tests'
the command (running from jmeter bin directory):
./jmeter -n -t /Users/myusername/Jmeter_Tests/SB1.jmx
could the terminal command run the GUI test?
As far as I know there is no way to execute a command line statement to open JMeter GUI mode and then immediately start a test. (Please correct me if that was not your question!)
In most cases you want to run non-gui for real test execution anyway. When using terminal to start a .jmx test plan you must pass the following flags:
%JMETER_HOME%/jmeter -n -t /path/to/test_plan.jmx -l /path/to/desired/output.jtl
Its also suggested to use this as well:
-j /path/to/desired/jmeter_log.txt
For more details, visit this page: JMeter Getting Started - GUI Mode
Edit: To get nice data analysis of a JTL file after a non-gui test run, check out CMDRunner.jar from the JMeter Plugins packages: CMDRunner Man Pages

Running remotely Linux script from Windows and get execution result code

I have the current scenario to deal with:
I have to schedule the backup of my company's Linux-based server (under Suse Linux) with ARCServe R15 (installed on Windows 2003R2SP2).
I know I have the ability in my backup software (ARCServe) to add pre/post execution scripts to my backup-jobs.
If failure of the script, ARCServe would be specified NOT to run the backup-job, and if success, specified to be run. I have no problem with this.
The problem is, I want to make a windows script (to be launched by ARCServe) for executing a Linux script on the cluster:
- If this Linux-script fails, I want my windows-script to fail, so my backup job in ARCServe wouldn't run
- If the Linux-script success, I want my windows-script to end normally with error code 0, so my ARCServe job would run normally.
I've tried creating this batch file (let's call it HPC.bat):
echo ON
start /wait "C:\Program Files\PUTTY\plink.exe" -v -l root -i "C:\IST\admin\scripts\HPC\pri.ppk" [cluster_name] /appli/admin/backup_admin
exit %errorlevel%
If I manually launch this .bat by double-clicking on it, or launching it in a command prompt under Windows, it executes normally and then ends.
If I make it being launched by ARCServe, the script seems never to end.
My job stays in "waiting" status, it seems the execution code of the linux script isn't returned to my batch file, and this one doesn't close.
In my mind, what's happening is plink just opens the connection to the Linux, send the sript execution signal, and then close the connection, so the execution code can't be returned to the batch. Am I right ?
Is what I want to do possible or am I trying something impossible to do ?
So, do I have to proceed differently ?
Do I have to use PUTTY or CygWin instead of plink ?
Please, it's giving me headaches ...
If you install Cygwin, you could do it exactly like you can do it on Linux to Linux, i.e. remotely run a command with ssh someuser#remoteserver.com somecommand
This command will return with the same return code on the calling client, as the command exited with on the remote end. If you use SSH shared keys for authentication instead of passwords, it can also be scripted without user interaction.

Resources