LoadRunner监控tomcat (2012-10-25 14:01:42)转载▼

double atof (const char * string);
Action()
{  
  // 保存JVM内存数值
   web_reg_save_param("JVM_FreeMemory",
                       "LB=Free memory: ",
                       "RB= MB",
                       "Ord=1",
                       LAST);
    web_reg_save_param("JVM_TotalMemory",
                       "LB=Total memory: ",
                       "RB= MB",
                       "Ord=1",
                       LAST);
    web_reg_save_param("JVM_MaxMemory",
                       "LB=Max memory: ",
                       "RB= MB",
                       "Ord=1",
                       LAST);

//保存http-8989连接数值
    web_reg_save_param("http_MaxThreads",
                       "LB=Max threads: ",
                       "RB= ",
                       "Ord=1",
                       LAST);
    web_reg_save_param("http_CurrentThreadCount",
                       "LB=Current thread count: ",
                       "RB= ",
                       "Ord=1",
                       LAST);
    web_reg_save_param("http_CurrentThreadBusy",
                       "LB=Current thread busy: ",
                       "RB= ",
                       "Ord=1",
                       LAST);
    web_reg_save_param("http_MaxProcessingTime",
                       "LB=Max processing time: ",
                       "RB= ms",
                       "Ord=1",
                       LAST);
    web_reg_save_param("http_ProcessingTime",
                       "LB=Processing time: ",
                       "RB= s",
                       "Ord=1",
                       LAST);
    web_reg_save_param("http_RequestCount",
                       "LB=Request count: ",
                       "RB= ",
                       "Ord=1",
                       LAST);
    web_reg_save_param("http_ErrorCount",
                       "LB=Error count: ",
                       "RB= ",
                       "Ord=1",
                       LAST);
    web_reg_save_param("http_BytesReceived",
                       "LB=Bytes received: ",
                       "RB= MB",
                       "Ord=1",
                       LAST);
    web_reg_save_param("http_BytesSent",
                       "LB=Bytes sent: ",
                       "RB= MB",
                       "Ord=1",
                       LAST);
  //定义tomcat内存使用情况的监视器事务;
lr_start_transaction("status");
web_set_user("admin", "pass","localhost:8989");

web_url("status",
  "URL=http://localhost:8989/manager/status",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=",
  "Snapshot=t1.inf",
  "Mode=HTML",
  LAST);
lr_end_transaction("status", LR_AUTO);
//使用lr_user_data_point()添加数据到图表中去
    lr_user_data_point("Tomcat JVM FreeMemory", atof(lr_eval_string("{JVM_FreeMemory}")));
    lr_user_data_point("Tomcat JVM TotalMemory", atof(lr_eval_string("{JVM_TotalMemory}")));
    lr_user_data_point("Tomcat JVM MaxMemory", atof(lr_eval_string("{JVM_MaxMemory}")));
    lr_user_data_point("Tomcat http MaxThreads", atof(lr_eval_string("{http_MaxThreads}")));
    lr_user_data_point("Tomcat http CurrentThreadCount", atof(lr_eval_string("{http_CurrentThreadCount}")));
    lr_user_data_point("Tomcat http CurrentThreadBusy", atof(lr_eval_string("{http_CurrentThreadBusy}")));
    lr_user_data_point("Tomcat http MaxProcessingTime", atof(lr_eval_string("{http_MaxProcessingTime}")));
    lr_user_data_point("Tomcat http ProcessingTime", atof(lr_eval_string("{http_ProcessingTime}")));
    lr_user_data_point("Tomcat http RequestCount", atof(lr_eval_string("{http_RequestCount}")));
    lr_user_data_point("Tomcat http ErrorCount", atof(lr_eval_string("{http_ErrorCount}")));
    lr_user_data_point("Tomcat http BytesReceived", atof(lr_eval_string("{http_BytesReceived}")));
    lr_user_data_point("Tomcat http BytesSent", atof(lr_eval_string("{http_BytesSent}")));

return 0;
}

LoadRunner监控tomcat的更多相关文章

  1. LoadRunner监控Tomcat的几种方法

    通过JConsole监控Tomcat 1.打开tomcat5的bin目录中的catalina.bat文件,在头部注释部分的后面加上: set JAVA_OPTS=%JAVA_OPTS% -Dcom.s ...

  2. LoadRunner如何监控Tomcat性能

    使用LoadRunner做性能测试,一般的直觉是LR只能完成脚本录制和编写模拟用户的请求行为,但是在某些情况下,要监控一些中间件或web服务器的性能时,就不能通过录制脚本来完成了,那么就需要手工来编写 ...

  3. LoadRunner 实现监控Tomcat

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

  4. LR如何监控tomcat性能

    使用LoadRunner做性能测试,一般的直觉是LR只能完成脚本录制和编写模拟用户的请求行为,但是在某些情况下,要监控一些中间件或web服务器的性能时,就不能通过录制脚本来完成了,那么就需要手工来编写 ...

  5. linux上监控tomcat down掉后自动重启tomcat

    p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px "Helvetica Neue"; color: #454545 } p. ...

  6. LoadRunner监控Linux

    rstat协议允许网络上的用户获得同一网络上各机器的性能参数. 需要下载3个包:    (1)rsh-0.17-14.i386.rpm     (2)rsh-server-0.17-14.i386.r ...

  7. 运用JMX监控Tomcat/Java jvisualvm简要说明

    公司线上项目出现了java heap space 然后经过查询知晓了下面工具于是开始了尝试. visualvm能干什么:监控内存泄露,跟踪垃圾回收,执行时内存.cpu分析,线程分析... jvisua ...

  8. 【转】使用JDK自带jvisualvm监控tomcat

    转载地址: http://my.oschina.net/kone/blog/157239 jdk自带有个jvisualvm工具.该工具是用来监控java运行程序的cpu.内存.线程等的使用情况.并且使 ...

  9. Jconsole 监控tomcat

    通过jconsole监控可以获取监控tomcat的相关的数据信息 如何通过代码来获取其中的线程和内存状况呢? 首先要配置好jconsole监控的相关配置,一搜基本就是那一个, 配置配不好的话接下来的工 ...

随机推荐

  1. JAVA集合操作的利器:CollectionUtils

    使用 CollectionUtils 中四个方法之一执行集合操作.这四种分别是 union(),intersection();disjunction(); subtract(); 下列例子就是演示了如 ...

  2. MySQL插入中文数据报错

    在操作数据库插入中文会出现如下错误: ERROR 1366 (HY000): Incorrect string value: '\xC4\xE3\xBA\xC3' for column 'userna ...

  3. 【拓扑排序】【堆】CH Round #57 - Story of the OI Class 查错

    拓扑排序,要让字典序最小,所以把栈改成堆. #include<cstdio> #include<queue> #include<algorithm> using n ...

  4. JavaScript异步编程的Promise模式(转)

    异步模式在web编程中变得越来越重要,对于web主流语言Javascript来说,这种模式实现起来不是很利索,为此,许多Javascript库(比如 jQuery和Dojo)添加了一种称为promis ...

  5. iOS9 HTTPS解决办法

    iOS9引入了新特性App Transport Security (ATS).详情:App Transport Security (ATS) 新特性要求App内访问的网络必须使用HTTPS协议.但是现 ...

  6. Swift中计算String的长度

        extension String {     var length: Int { return countElements(self) }  // Swift 1.1 } extension ...

  7. Mac sublime 编译Python UnicodeEncodeError: 'ascii' codec can't encode characters in position 6-8: ordinal not in range(128)

    刚学Python,想打印个“hello 张林峰”,代码如下: #!/usr/bin/env python3 # -*- coding: utf-8 -*- print('hello 张林峰') 用su ...

  8. How can I create a dump of SQL Server?

    https://blogs.msdn.microsoft.com/askjay/2009/12/29/basic-debugging-concepts-and-setup/ You can creat ...

  9. oracle数据库维护常用操作

    查看用户相关信息 查看数据库里面所有用户,前提是你是有dba权限的帐号,如sys,system select * from dba_users; 查看你能管理的所有用户! select * from ...

  10. 重设Windows 7密码 z

    Restart the computer to boot using the CD. Once the GUI loads, press SHIFT+F10 to bring up the comma ...