1、需要下载一个jar包,放入到lib /ext文件中  JMeterPlugins-Standard.jar

2、在服务器上安装 perfmon server agent

这里监控内存我们使用的是:jp@gc - PerfMon Metrics Collectot

在使用之前,我们需要运行/serverAgent/startAgent.bat这个文件,我们需要将serverAgent目录及下面的文件复制到我们测试的服务器上,然后点击打开

3、 创建监控器时选择如图:

PerfMon Server Agent

Installation

You do not need any root/admin privilege. You can just unzip the the ServerAgent-X.X.X.zip somewhere on the server. Then launch the agent using startAgent.sh script on Unix, or startAgent.bat script on Windows.

The agent is written in Java, so you will need JRE 1.4+ to run it. Note you can create yourself the agent package which includes its own JRE so you don't have to install java on the server (We tested it on windows platform). To do this, just create a JRE folder in the agent folder and copy one installed JRE inside. Change the java command inside the .bat file to the path to the java executable and it will work.

Once the agent is running, you can use the PerfMon Metrics Collector Listener to connect to the agents. You can add multiple servers to monitor, one graph can display several kinds of metrics (cpu, memory, etc...), auto-zooming rows for best view.

Usage

To start the agent, simply run startAgent bat/sh file. It will open UDP/TCP server ports where JMeter will connect and query the metrics. Some information will be printed to standard output, informing you on problems gathering metrics (logging verbosity regulated with --loglevel parameter).

You can specify the listening ports as arguments (0 disables listening), default is 4444:

$ ./startAgent.sh --udp-port 0 --tcp-port 3450
INFO 2011-11-25 19:02:14.315 [kg.apc.p] (): Binding TCP to 3450

You can use the --auto-shutdown option when starting the agent to automatically stop it once the test is finished. It is recommended to use this feature only with TCP connections:

$ undera@undera-HP:/tmp/serverAgent$ ./startAgent.sh --udp-port 0 --auto-shutdown
INFO 2011-11-25 19:48:59.321 [kg.apc.p] (): Agent will shutdown when all clients disconnected
INFO 2011-11-25 19:48:59.424 [kg.apc.p] (): Binding TCP to 4444

You can use the --sysinfo option to view available system objects:

$ ./startAgent.sh --sysinfo
INFO 2011-11-25 19:51:25.517 [kg.apc.p] (): *** Logging available processes ***
INFO 2011-11-25 19:51:25.542 [kg.apc.p] (): Process: pid=24244 name=bash args=-bash
INFO 2011-11-25 19:51:25.543 [kg.apc.p] (): Process: pid=25086 name=dash args=/bin/sh ./startAgent.sh --sysinfo
INFO 2011-11-25 19:51:25.543 [kg.apc.p] (): Process: pid=25088 name=java args=java -jar ./CMDRunner.jar --tool PerfMonAgent --sysinfo
INFO 2011-11-25 19:51:25.549 [kg.apc.p] (): *** Logging available filesystems ***
INFO 2011-11-25 19:51:25.551 [kg.apc.p] (): Filesystem: fs=/dev type=devtmpfs
INFO 2011-11-25 19:51:25.551 [kg.apc.p] (): Filesystem: fs=/ type=ext4
INFO 2011-11-25 19:51:25.551 [kg.apc.p] (): Filesystem: fs=/var/run type=tmpfs
INFO 2011-11-25 19:51:25.551 [kg.apc.p] (): Filesystem: fs=/home type=ext4
INFO 2011-11-25 19:51:25.552 [kg.apc.p] (): Filesystem: fs=/var/lock type=tmpfs
INFO 2011-11-25 19:51:25.552 [kg.apc.p] (): Filesystem: fs=/proc type=proc
INFO 2011-11-25 19:51:25.553 [kg.apc.p] (): *** Logging available network interfaces ***
INFO 2011-11-25 19:51:25.554 [kg.apc.p] (): Network interface: iface=lo addr=127.0.0.1 type=Local Loopback
INFO 2011-11-25 19:51:25.554 [kg.apc.p] (): Network interface: iface=eth0 addr=192.168.0.1 type=Ethernet
INFO 2011-11-25 19:51:25.555 [kg.apc.p] (): *** Done logging sysinfo ***
INFO 2011-11-25 19:51:25.555 [kg.apc.p] (): Binding UDP to 4444
INFO 2011-11-25 19:51:26.560 [kg.apc.p] (): Binding TCP to 4444

The --interval <seconds> argument can be used to change metrics collection frequency.

Using Server Agent With Other Applications

Server Agent uses simple plain-text protocol, anyone can use agent's capabilities implementing client, based on kg.apc.perfmon.client.Transport interface. If anyone's interested, start the topic on the support forums and I'll describe how to connect third-party client app to agent.

ServerAgent has simple text protocol and can work on UDP and TCP transports. Most of cases will use TCP.

To have your first talk with the agent, start it locally. Then use telnet utility to connect to it:

user@ubuntu:~$ telnet localhost 4444
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

If connection has succeeded, you should see "Accepting new TCP connection" message in ServerAgent console log. Type "test" and press Enter in telnet chat, server should answer with short "Yep":

test
Yep

Type "exit":

exit
Connection closed by foreign host.

That's it. You sending a command line, server answering. Command line consists of command, sometimes with parameters. Parameters are separated from command with a colon sign.

Possible commands are:

  • exit - terminates current client session and closes connection to agent, no parameters
  • test - test if server is alive, no parameters
  • shutdown - terminate all client connections and shutdown agent process, no parameters
  • interval - change metrics reporting interval used in 'metrics' command, single parameter is integer value in seconds. Interval can be changed in the middle of metrics reporting. Example: interval:5
  • metrics - starts automatic metrics collection, parameters are metrics list to collect, described below. Example: metrics:cpu
  • metrics-single - calls single metric collection iteration. Example: metrics-single:memory

Specifying Metrics

Metrics list consists of metric specifications, separated by TAB character. Metric collection output consists of float values, TAB separated. Example:

metrics-single:cpumemory
22.0573689416419457.52359562205553

Each metric specification consists of several fields, colon-separated. Short example:

metrics-single:cpu:idle    memory:free
80.02238388360381 57.52359562205553

Fields number is metric-type specific. Possible metric types are:

  • cpu
  • memory
  • swap
  • disks
  • network
  • tcp
  • tail
  • exec
  • jmx

Fields corresponding to each metric type are described at metrics page. Last example (Yep, ServerAgent can be shell exec vulnerability. If you have issue with this, ask me and I'll introduce 'secure' mode, disabling insecure metric types):

metrics-single:exec:/bin/sh:-c:free | grep Mem | awk '{print $7}'
1152488

jmeter 监控服务器的内存,cpu等内容的更多相关文章

  1. Jmeter监控服务器的CPU

    1.Jmeter监控服务器的软件:链接: https://pan.baidu.com/s/1Ag75IXqR2XMe8RpZA4nvHg 密码: yki2 2.(1)Window版本 <1> ...

  2. 『动善时』JMeter基础 — 61、使用JMeter监控服务器

    目录 1.监控插件安装 2.启动监控服务 3.使用JMeter监控服务器 (1)测试计划内包含的元件 (2)HTTP请求界面内容 (3)配置jp@gc-PerfMon Metrics Collecto ...

  3. Jmeter监控服务器笔记

    Jmeter监控服务器-CPU,Memory,Disk,Network性能指标 本文主要说一下如何通过JMeter插件来监控服务器CPU.内存.磁盘.网络等相关资源. 一.下载 首先进入网址https ...

  4. 使用jmeter监控服务器性能指标

    先下载jmeter-ServerAgent Windows下载和Linux下载 https://jmeter-plugins.org/wiki/PerfMon/  找到ServerAgent的下载链接 ...

  5. ubuntu查看系统资源占用(内存,cpu和进程)

    ubuntu查看系统资源占用(内存,cpu和进程) 1  top 查看ubuntu的资源占用的命令为$: top    说明:top命令就可以查看内存,cpu和进程了,很方便 top: 主要参数 d: ...

  6. linux查看内存cpu占用

    linux查看内存cpu占用top 命令  按q退出 可以添加额外选项选择按进程或按用户查看如: top -u gitu PID:进程idPR:进程的优先级别,越小越优先被执行NInice:值VIRT ...

  7. vs中调试程序查看变量在内存中的内容的方法

    vs中调试程序 查看变量在内存中的内容的方法 https://blog.csdn.net/guojg1988/article/details/42922149 原文链接:http://www.sows ...

  8. JMeter监控服务器CPU、内存的方法

    jmeter也可以像loadrunner一样监控服务器CPU.内存等性能参数,不过需要安装一些插件 一.首先下载监控服务器的插件   链接:https://pan.baidu.com/s/1o9Zuw ...

  9. jmeter ---监控服务器CPU, 内存,网络数据

    JMeter如何收集获得服务器cpu,内存,磁盘,网络等相关资源使用率的信息 1. JMeter 自带的Monitor Results 监控 JMeter 自带的Monitor Results 在官网 ...

随机推荐

  1. 360和QQ大战之我见

    腾讯最大的产品QQ,占有了全国6亿活跃用户.在中国互联网拥有不可多得的主导权. 360的产品想了一个办法,以安全为名,做了一个QQ保镖,那么他的步骤如下: 1.我保护你嘛.只要QQ启动,保镖就跟着启动 ...

  2. 使用powershell部署WSP包

    代码如下,先卸载,然后删除,然后添加,然后安装. 卸载之后会重启IIS,所以等待几秒钟,直到卸载完成. 添加snapin $snapin = Get-PSSnapin | Where-Object { ...

  3. 为Windows Azure Web站点添加MIME类型解决文件下载失败的问题

    这几天在倒腾Autodesk 360 Viewer,前面的文章也介绍过了,这将是一个全新的在线模型浏览工具.我做了个实验,把A360Viewer放在一个web 站点,然后发布到Windows Azur ...

  4. android绘制view的过程

    1 android绘制view的过程简单描述  简单描述可以解释为:计算大小(measure),布局坐标计算(layout),绘制到屏幕(draw):            下面看看每一步的动作到底是 ...

  5. HTTP协议基本知识

    Xcode7.0以上版本必须操作:https http 在Info.plist中添加NSAppTransportSecurity类型Dictionary. 在NSAppTransportSecurit ...

  6. js中Prototype属性解释及常用方法

    1.prototype的定义 javascript中的每个对象都有prototype属性,Javascript中对象的prototype属性的解释是:返回对象类型原型的引用. 每一个构造函数都有一个属 ...

  7. CVEH项目观察与思考

    2013-07-01 项目进展: 从启动至今已有三个星期,但是进展甚慢,取得的进展有: A. 封装成库,和HB调用库的接口有些进展,但进未完成 B. 整个框架,类视图,调用视图,只有两三层的进展: C ...

  8. Spring的第一个例子

    Spring 的控制翻转IoC,或者依赖注入.在测试类中没有new一个新对象,对象是从xml文件中注入的. xml文件中的<beans>是一个大容器,里面的<bean>就是容器 ...

  9. Hadoop源码之HDFS(1)--------通信方式

    说起hadoop这个东西,只能说真是个伟大的发明,而本人对cutting大神也是无比的崇拜,记得刚接触hadoop的时候,还觉得这个东西挺多余的,但是现在想想,这个想法略傻逼...... 2006-2 ...

  10. maven 常见错误解决方法

    1. 最重要的一点,使用国内镜像,比如 oschina.net 的镜像: 搜 jar 推荐:http://maven.outofmemory.cn/,速度极快. 2. 错误:Could not res ...