zoukankan      html  css  js  c++  java
  • LoadRunner 实现监控Tomcat

    LoadRunenr没有监控Tomcat的专用监控器,为了用lr达到监控tomcat的目的可以通过打开Tomcat自带的Status页面之后,利用lr的关联技术得到相关的数据,把数据输出到lr自定义的监控器中。

      1、打开Tomcat的status页面,方法为编辑Tomcat的conf目录下的tomcat-users.xml文件,在文件中添加

    <tomcat-users>
      <role rolename="manager"/>
      <user username="admin" password="pass" roles="manager"/>
    </tomcat-users>

      2、开发lr脚本

    lr_start_transaction("monitor tomcat");
      web_reg_save_param("JVMFreeMemory",
        "LB=Free memory: ",
        "RB= MB",
        "Ord=1",
       LAST);
       web_reg_save_param("JVMTotalMemory",
      "LB=Total memory: ",
      "RB= MB",
      "Ord=1",
       LAST);
     
        web_reg_save_param("JVMMaxMemory",
        "LB=Max memory: ",
        "RB= MB",
        "Ord=1",
        LAST);
     
        web_url("status",
           "URL=http://{ServerName}/manager/status",
           "Resource=0",
           "RecContentType=text/html",
           "Referer=",
           "Snapshot=t1.inf",
           "Mode=HTTP"
        LAST);
     
       lr_end_transaction("monitor tomcat",LR_AUTO);
     
    // Tomcat JVM metrics
      lr_user_data_point("Tomcat JVM Free memory",atof(lr_eval_string("{JVMFreeMemory}")));
      lr_user_data_point("Tomcat JVM Total memory",atof(lr_eval_string("{JVMTotalMemory}")));
       lr_user_data_point("Tomcat JVM Max memory",atof(lr_eval_string("{JVMMaxMemory}")));
  • 相关阅读:
    Mybatis分页插件
    Mybatis代码自动生成
    Spring-Mybatis依赖
    Spring-test单元测试
    Spring-json依赖
    Spring-MVC依赖
    Log4j日志依赖
    Spring数据库连接池依赖
    Spring-JDBC依赖
    Spring依赖
  • 原文地址:https://www.cnblogs.com/yanghj010/p/5455498.html
Copyright © 2011-2022 走看看