Jmeter-Transfer a file from server ( using ssh sftp) to local - jmeter

I need to copy file from remote server to local and trying it by using SSH SFTP using JMETER.I gave login credentials and in "File Transfer" section , selected
Actions-- PUT
source path -- remote path ( /ftp/xxx/yyy)
Destination -- local path.
Received error as `
java.io.FileNotFoundException: C:\apache-jmeter-5.1.1\bin\ftp\xxx\yyy)
So I changed the Actions-- GET in View results tree for SSH SFTP response I see data of file,
but file is not copied to local directory
Any help would greatly appreciated.

All the parts of the "Destination path" must exist, i.e. you need to create all /ftp/xxx/yyy folder structure using mkdir command like:
mkdir -p /ftp/xxx/yyy
The user which executes JMeter must have write permissions to the destination path, give him the appropriate permissions using chmod command
You need to set "Print file content" to false
More information: Load Testing FTP and SFTP Servers Using JMeter
Also according to JMeter Best Practices you should always be using the latest version of JMeter so consider upgrading to JMeter 5.4.1

Related

Jmeter-SSH SFTP -Permission denied for download file

I am using SSH SFTP sampler to connect to SFTP. I need to download the files from SFTP. i have selected Action-"Get" and source path s SFTP file path location and destination is local folder path. I am getting error Permission denied. The same works if i try Action "ls"
Most probably the user account you're using for establishing SFTP session doesn't have read permission therefore you cannot read file contents hence not able to copy it.
Make sure that the user has read permissions and if this is not the case - provide the permission using chmod command like:
chmod +r your_file
Check out Load Testing FTP and SFTP Servers Using JMeter article for more information.
If you still experience problems - update your question to show SSH SFTP sampler configuration.

PSFTP - File Transfer Not Happening

I want a file to transfer automatically for one server to another server. For that i have installed putty.
Batch File: Transfer.Bat
cd "C:\Program Files\PuTTY"
psftp Username#RemoteServer.com -pw password -b MovementFileTransferScript.txt -be
Text File: MovementFileTransferScript.txt
open RemoteServer.com
put D:/Backup/FULL_DB_BACKUP-DontDelete.txt R:\DB\Backup
quit
In the above text file, D:/ belongs to Source Server and R:/ belongs to destination server.
When i am running the batch file i am getting the below error.
Using username "Username".
Remote working directory is /
psftp: already connected
local: unable to open D:/Backup/FULL_DB_BACKUP-DontDelete.txt
I have checked the permissions of the folders and everything looks good. Can some one let me know what was the issue here.?

Unix script to download file in other server

I have a scenario where I need to write a shell script which has to download a file in a remote directory.
Eg: I logged into Server A and from there my script needs to login to Server B and using wget command it has to download a file.
Any suggestions on this?
Instead of doing an SSH into Server B and then doing a wget, I would suggest that you first download the file onto Server A and then scp it to Server B at the path you want.

Copy folder from an http source to a local directory

I am trying to copy a folder from an http source using the following statement:
FileUtils.cp_r 'http://else.repository.labs/static/lit/MDMInternalTools/', 'c:\Users\Public\Desktop\'
However I get this error:
EINVAL: Invalid argument - https://else.repository.labs/static/lit/MDMInternalTools/
If that's a folder on a server that you have access to via ssh, then you can use scp to copy individual files, or a folder with all subfolders/files, using the -r option. The command will be something like
scp -r username#http://else.repository.labs:/path/to/rails/public/static/lit/MDMInternalTools c:\Users\Public\Desktop
This is assuming you can use scp. It looks like you're in windows, you'll need a decent command-line shell where you can install ssh.
https://en.wikipedia.org/wiki/Secure_copy
You can check if the server supports webdav, have an ftp or an ssh access.
Otherwise your only choice could be to use wget to get a local mirror:
wget -mk http://else.repository.labs/static/lit/MDMInternalTools/

rsyncing using cygwin's rsync from the Windows Command Prompt

I am pushing a local file to a folder in a remote location using cygwin's rsync from the Windows Command Prompt.
The below command
D:\My Folder>C:/cygwin/bin/rsync.exe -avh data.csv ec2-user#someserver.com::~"overhere/"
returns the error, "failed to connect to someserver.com : connection timed out"
When I try the following command to place the file in the remote location root folder,
D:\My Folder>C:/cygwin/bin/rsync.exe -avh data.csv ec2-user#someserver.com~
it says "sending incremental file list" but I am not able to find the file in the root folder in the remote location.
What am I doing wrong?
The timeout most likely occurs because there is no rsync daemon running on the server known as someserver.com.
Using :: after the remote host name will cause rsync to try to connect to the rsync daemon running on that machine. If you use : instead, rsync will attempt a shell access to copy your data.
Your second call to rsync.exe succeeds because rsync.exe -avh data.csv c2-user#someserver.com~ creates a copy of data.csv in your current working directory named ec2-user#someserver.com~.
If you use shell access, you can directly provide the path after the :, if using the rsync daemon, you have to provide the module name as configured in /etc/rsyncd.conf on the server after the ::. So in your case it is either ec2-user#someserver.com:~/overhere/ for shell access or ec2-user#someserver.com::MODULE for the daemon.
But as I suspect that you have no rsync daemon running on the remote machine, you'd have to install and configure it first for the second version to work. The first version will do through normal SSH access.
So as a first attempt you can try: D:\My Folder>C:/cygwin/bin/rsync.exe -avh data.csv ec2-user#someserver.com:overhere/
This will create a folder named overhere in the ec2-user's home directory on someserver.com if it doesn't already exist and copy the local data.csv into that directory.

Resources