How to pass slrum command (sinfo) in os process sampler using jmeter - jmeter

I have to make a jmeter script to connect putty and provide host name and click on connect which will open a cmd asking for user name and pwd.
Post which I have to type slrum command that is sinfo and it will retrieve data and finally an exit.
I have used plink to achieve the same.
In command parameter of os sampler,
/C
Plink -ssh user#host -pw password
I am able to successfully connect to putty and reach till pwd entry.
On typing slrum command in cmd manually,it is fetching result but the same sinfo when am trying to achieve through os process sampler it is giving error as sinfo command not found.
How to provide sinfo command from os process sampler to fetch correct output.

I don't know what is slrum or sinfo but I can think about some possible reasons:
You're logging into a session which doesn't call shell scripts to set the relevant PATH environment variable, i.e. this issue suggests to add /usr/local/bin to your PATH. I'm not sure how your installation looks like but you could try to use the full path like:
/usr/local/bin/sinfo
or whatever
You might want to pass -ssh key to your plink to force to use SSH protocol
And last but not the least, there is SSH Command plugin which don't require 3rd-party executables
Demo:
More information: How to Run External Commands and Programs Locally and Remotely from JMeter

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

SSH tectia, how to run batch commands?

I have tectia ssh server in a windows environment.
When I use sftpg3 -B cmd.txt username#host that works fine. The only problem is that it doesnt let me execute files remotely, it only lets me move files. It reads the commands from cmd.txt but since I cant execute anything it ignores the commands.
Well when I do the same thing but use sshg3, it doesnt recognize the -B flag at all.
SSHG3 -B cmd.txt username#host
cmd.txt' is not recognized as an internal or external command,
operable program or batch file.
I've tried putting -B "cmd.txt"
I tried just putting the cmd.txt contents in the same script instead of housing them in cmd.txt and getting rid of -B, but it doesnt run them that way either.
The docs dont have much to go off of. All it says is use -B for batch processing.
Contents of cmd.txt:
D:
cd Library
cd Backup
parseLibrary.cmd
exit
Trying to sshg3 into a host, navigate to a path and run a batch file on that host.
Any ideas?
-B, --batch-mode
Uses batch mode. Fails authentication if it requires user interaction on the terminal.
Using batch mode requires that you have previously saved the server host key on the client and set up a non-interactive method for user authentication (for example, host-based authentication or public-key authentication without a passphrase).
It does use public key authentication, there is no user interaction needed on the terminal.
Noticed this on the docs for sftpg3
-B [ - | batch_file ]
The -B - option enables reading from the standard input. This option is useful when you want to launch processes with sftpg3 and redirect the stdin pipes.
By defining the name of a batch_file as an attribute, you can execute SFTP commands from the given file in batch mode. The file can contain any allowed SFTP commands. For a description of the commands, see the section called “Commands”.
Using batch mode requires that you have previously saved the server host key on the client and set up a non-interactive method for user authentication (for example, host-based authentication or public-key authentication without a passphrase).
I'm guessing batch file is different than batch mode?
*I figured it out. You have to use the -B flag for every command you want to execute.
I figured it out. You have to use the -B flag for every command you want to execute.
sshg3 user#host -B dir -B ipconfig -B etc.cmd

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)

PSEXEC returning garbage result. Why?

I want to run a script on a remote windows 2008 server using PSEXEC of PSTOOLs..
I have installed PSTOOLs on my local machine and can run the PSEXEC command successfully as well. I connect to the remote server through it and it even picks up the script placed there. However, all I get is some sort of garbage values. And after that it states that the intended network is no longer available, which it is because I can see it and access it through the GUI.
I must mention that when I execute that script manually in the remote server it works fine. I am using windows remote desktop utility to connect to the server.
Am I using PSEXEC the correct way? Or is the intended function of PSEXEC the same as what I am trying to do?
First you should have a look at the help page
You must use -w to specify the remote working dir, and you can't call a .bat directly, you have to call cmd.exe. So try this
psexec \\remoteserver -w "c:\users\admin\desktop\" cmd.exe /c youbatch.bat

how to connect to a remote server using ssh and getting the information

I'm trying to write a shell script using bash. I have multiple servers and each servers have multiple apps runnings on it. Each server also has specific app scripts to check/stop/start etc. All I want to do is that, do a ssh and connect to the remote server.
Which I'm also able to do sucessfully and exceute the commands also..
In some instance I need to check some process status on a remote machine, the app sepecific scripts already does that. But using my ssh when i try to execute that script I dont get any info ( it gets executed but no info is passed ). How do i get the information from the remote host and display on the local host here.
Any help on this is really appreciated.
Regards,
Senny
You can run remote commands and get results locally by passing the command as a string to ssh.
In your script, you can do:
CMD_OUT=$(ssh user#remote_host "/path/to/script argument")
The command will be run remotely and the output store in the CMD_OUT variable. You can then parse the output in your script to get the results you want.
To simplify usage of your script, you might want to set up passwordless ssh so you don't have to type your password each time the script tries to run a remote command.

Resources