zoukankan      html  css  js  c++  java
  • jmeter ---监控服务器CPU, 内存,网络数据

    JMeter如何收集获得服务器cpu,内存,磁盘,网络等相关资源使用率的信息

    1. JMeter 自带的Monitor Results 监控

    JMeter 自带的Monitor Results 在官网就有资料, (http://jakarta.apache.org/jmeter/usermanual/build-monitor-test-plan.html)

    The monitor was designed to work with the status servlet in Tomcat 5. In theory, any servlet Container that supports JMX (JavaManagement Extension) can port the status servlet to provide the same information.

    这个是原文, 我也没搞太懂,大概就是需要tomcat 或者 支持JMX 的servlet 都可以提供监控服务,详细的我也没有测试,应为我没有这个东西,对tomcat也不熟,所以。。。。

    我大概说一下我的的理解:

    1. 开启服务器自带的显示性能的页面 (官网的例子是 :/manager/status 页面)

    2. 在Jmeter 里面添加访问这个页面

    3. 添加Monitor Result 监视器,就可以读取出相关信息了

    2. 第三方的插件形式监控服务器性能数据

    这个插件非常之利害,使用也是非常之方便,功能也是非常多,这里讲的这个监控服务器性能数据的叫 PerfMon Metrics Collector, 还有其他功能:

        PerfMon Metrics Collector
        Active Threads Over Time
        Response Codes per Second
        Response Times Over Time
        Response Latencies Over Time
        Transactions per Second
        Server Hits per Seconds
        Bytes Throughput Over Time
        Extracted Data Over Time
        Composite Timeline Graph 

    这个是插件的官方地址 :  http://code.google.com/p/jmeter-plugins/,  现在已经V0.5.5了

    我讲下PerfMon Metrics Collector的使用。

    PerffMon 的结构图:

    下面是操作过程:

    1. 下载插件

    2. 解压插件文件, 里面有个JMeterPlugins.jar 把这个文件放到 lib/ext 文件夹下面

    3. 打开bin/Jmeter.properties

    修改 

    jmeter.save.saveservice.thread_counts=true

    插件相关的设置可以添加到 bin/user.properties

    #---------------------------------------------------------------------------
    # JMeter Plugins config (http://code.google.com/p/jmeter-plugins)
    #---------------------------------------------------------------------------
    
    # Enable or disable the gradient paint for graphs. Value is true or false, default is true.
    jmeterPlugin.drawGradient=true
    # Globaly disable final zeroing lines in all graphs. Value is true or false, default is false.
    jmeterPlugin.neverDrawFinalZeroingLines=true
    # Globaly disable current X lines drawing in all concerned graphs. Value is true or false,  default is false.
    jmeterPlugin.neverDrawCurrentX=true
    # Enable or disable graphs Y Axis scaling for better readability. Value is true or false, default is true.
    jmeterPlugin.optimizeYAxis=true
    # Use relative time in time based graphs. Value is true or false, default is true.
    jmeterPlugin.useRelativeTime=true
    # Force csv separator character. Default is ',' if decimal separator is '.', ';' otherwise
    #jmeterPlugin.csvSeparator=;
    # Force csv time format (see http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html)
    #jmeterPlugin.csvTimeFormat=HH:mm:ss
    # Prefix or not plugin items in JMeter menus. Value is true or false, default is true.
    jmeterPlugin.prefixPlugins=true
    # Force line width for all line graphs. Default is '1.0'.
    jmeterPlugin.graphLineWidth=3
    # Draw markers in relevent line graphs. Default is true.
    meterPlugin.drawLineMarker=false

    4. 打开JMeter 看到多了好多以jp@gc- 开头的控件,包括controller, thread 等, 这里要讲的 PerfMon Metrics Collector 就在listener 下面jp@gc-PerfMon Metrics Collector

    5. 在你需要的地方添加 jp@gc-PerfMon Metrics Collector, 点configur, 选择"Save Active Thread Counts" 。

    6.上面这些做完,还有一个非常重要的东西需要做, 那就是在你的服务器端执行一个插件的服务器,这样JMeter 就可以获得相关数据了, 这个服务器就在下载的安装包里面 有个 serverAgent 的文件夹,把它复制到服务器,执行里面的serverAgent.bat

    7. 接下来你就可以在你添加的jp@gc-PerfMon Metrics Collector 里面添加你要监控的服务器了,包括服务器地址,端口默认为4444, 和你要监控的选项了,比如,cpu, 内存,网络吞吐,磁盘吞吐等

    本文转自:  清明-心若淡定    https://www.cnblogs.com/saryli/p/6613202.html
  • 相关阅读:
    网络编程IO模型
    网络编程四层模型
    签到赛--我打的
    签到赛--ipip
    初见RCE(远程命令/代码执行漏洞)
    [ACTF2020 新生赛]Include
    文件上传+[SUCTF 2019]CheckIn
    古典密码,背包密码,RSA
    第八章小结
    第七章小结
  • 原文地址:https://www.cnblogs.com/majunBK/p/9518549.html
Copyright © 2011-2022 走看看