我正在使用jmeter在我的sftp服务器应用程序之一上运行负载测试。我如下运行我的jmx脚本
nohup sh jmeter.sh -n -t <jmx_file> -l <jtl_file> &
脚本确实具有简单数据编写器,该文件创建带有结果的csv文件,我使用在jmeter的bin文件夹中的cmd上运行的以下命令将其转换为html。
jmeter -g <csv_path> -o <html_folder>
它在几天前工作,现在如果我运行上述命令,则会出现如下错误
The system cannot find the path specified.
errorlevel=3
Press any key to continue . . .
我的jdk中从1.8_241更新到1.8_251,我也更新了java_home。我是否需要在jmeter中做其他任何事情才能使它工作?
脚本使用的是:
import com.jcraft.jsch.*;
import java.io.*;
class Monitor implements SftpProgressMonitor {
org.apache.jmeter.samplers.SampleResult sampleResult
public Monitor(org.apache.jmeter.samplers.SampleResult sampleResult) {
this.sampleResult = sampleResult
}
@Override
void init(int i, String s, String s1, long l) {
}
@Override
boolean count(long l) {
sampleResult.setBytes(sampleResult.getBytes() + l)
return true
}
@Override
void end() {
}
}
def jsch = new JSch()
def session = jsch.getSession(vars.get("userName"), vars.get("hostIP"), 4000)
session.setConfig("StrictHostKeyChecking", "no")
session.setPassword("user1")
def sftpSession = session.connect()
def channel = session.openChannel("sftp")
channel.connect();
def channelSftp = (ChannelSftp)channel;
log.info("SFTP Connection with host is acquired" + channelSftp)
def fileName = vars.get("fileToName") + Math.random();
channelSftp.get("/XYZ/" + vars.get("fileToGet"), "/ABC/" + fileName + ".txt", new Monitor(SampleResult));
log.info("FileName " +fileName)
session.disconnect()
在Linux上使用nohup运行上述脚本后,在nohup结束时,假设是否获得2200个文件,而在jmeter的日志中,如果我检查只有1045个文件名,它们等于下载的实际文件,现在我不是确定为什么Linux和html报告显示2200。
我在脚本中做任何错误的事情?