jsch 不能执行ssh命令_Jmeter「第九节」-ssh插件,执行linux命令

此次分享使用的jmeter版本是:5.1

背景

在某项目的高可用测试过程中,有个case,要求针对某些节点频繁断开与重启的过程中,接口的调用是否正常;

但是手动来启动与关闭服务,非常的麻烦,可能还达不到预想的结果,手动执行毕竟还是没有机器快。

于是乎,就想到了jmeter可否执行linux命令呢?

下载及安装

下载相应的jar包,分别存入jmeter相应的目录,如下:

Copy the ApacheJMeter_ssh-1.2.0.jar to $JMETER_HOME/lib/ext directoryCopy the jsch-0.1.55.jar to $JMETER_HOME/lib directory
af564f347e0385a0ec73897268248d54.png

用法:

本次分享只使用到了:SSH Command

UsageUsing the plugin is simple (assuming familiarity with SSH and JMeter):SSH Command1.Create a new Test Plan2.Add a Thread Group3.Add a Sampler > SSH Command4.Specify the host to connect to, port, username and password (unencrypted) or a key file, and a command to execute (such as date)5.Add a Listener > View Results Tree6.Run the testSSH SFTP1.Create a new Test Plan2.Add a Thread Group3.Add a Sampler > SSH SFTP4.Specify the host to connect to, port, username and password (unencrypted) or a key file, and a SFTP command to execute (such as get)5.Specify a source file to download, an output file or to print the content in the test6.Add a Listener > View Results Tree7.Run the test

展示:

下面的内容替换为真实内容即可

4beb6a9a751550f2d6ab6490e182389b.png

多个命令可以分号间隔,比如:cd /data;ls

5646294c002c6ffe11ccd6105f05cc54.png

结果

b21305ab91339133411d929bfc9567ba.png
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值