LoadRunner监控tomcat

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;
}

时间: 2024-11-10 23:08:33

LoadRunner监控tomcat的相关文章

LoadRunner监控Tomcat的几种方法

通过JConsole监控Tomcat 1.打开tomcat5的bin目录中的catalina.bat文件,在头部注释部分的后面加上: set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.port=8999 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false 2.修改JMX远程访问授权. 进入JAVA安装目录

LR如何监控tomcat性能

使用LoadRunner做性能测试,一般的直觉是LR只能完成脚本录制和编写模拟用户的请求行为,但是在某些情况下,要监控一些中间件或web服务器的性能时,就不能通过录制脚本来完成了,那么就需要手工来编写脚本,通过LR自带的lr_user_data_point(“”,””)打点函数进行自定义的监控其性能指标. 这里以监控Tomcat web服务器为例. 实现思路: 1.  配置Tomcat登录用户,找到tomcat-6.0.37目录下的/conf/ tomcat-users.xml,添加配置如下:

Zabbix通过JMX监控tomcat——防火墙策略问题分析

一.现 状 对于Zabbix通过JMX来监控tomcat,网络上有很多文章,但大都是相同或类似的,且都是没有设置防火墙的,所以就安装而言百度就行.现在为了服务的安全,是必须开启防火墙的.于是出现了一系列的问题. 二.当前环境 1.Zabbix_server的Zabbix版本是3.0.4,系统是Centos7.0,使用YUM安装. Centos7.0 YUM安装地址:http://blog.csdn.net/reblue520/article/details/52136850 2.Zabbix-s

使用JVisualVM 远程监控Tomcat程序中使用JMX鉴权访问

如何配置JVisualVM远程监控Tomcat程序请参考:http://hiandroidstudio.blog.51cto.com/5902332/1795310 1.配置JMX访问文件     # cd $CATALINA_HOME/conf/     # cp $JAVA_HOME/jre/lib/management/jmxremote.password.template jmxremote.password     # chmod 700 jmxremote.password    (

LoadRunner监控Linux

LoadRunner监控Linux rstat协议允许网络上的用户获得同一网络上各机器的性能参数. 需要下载3个包: (1)rsh-0.17-14.i386.rpm (2)rsh-server-0.17-14.i386.rpm (3)rpc.rstatd-4.0.1.tar.gz 一.安装rsh 查看是否安装并卸载rsh [[email protected] /]#  rpm –qa |grep rsh --查看是否安装rsh [[email protected] /]#  rpm –e + 版

Cacti监控Tomcat服务器实现过程

1 首先去官网上面下载通用的监控模板 一般使用TomcatStats-0.1.zip 模板居多,下载地址: http://forums.cacti.net/download/file.php?id=12310, 在linux服务器上面使用wget下载,wget http://forums.cacti.net/download/file.php?id=12310,报如下错误: 正在连接 forums.cacti.net|173.225.179.10|:80... 已连接. 已发出 HTTP 请求,

阿里云自定义监控tomcat进程数

阿里云提供自定义监控SDK,这有助于我们定制化的根据自身业务来做监控,下面我就根据业务需求来介绍一个简单的自定义监控配置. 阿里提供了2个版本的自定义监控接口:自定义监控SDK(python版) :cms_post.py自定义监控SDK(bash版) :cms_post.sh下载地址:http://help.aliyun.com/knowledge_detail.htm?knowledgeId=5974901 本文使用shell版本做演示       这里说下我的简单需求,我们需要监控ECS服务

Jconsole 监控tomcat

通过jconsole监控可以获取监控tomcat的相关的数据信息 如何通过代码来获取其中的线程和内存状况呢? 首先要配置好jconsole监控的相关配置,一搜基本就是那一个, 配置配不好的话接下来的工作就做不好了,所有要先配置好,然后可以上代码了: 1 package one; 2 3 import java.io.IOException; 4 import java.lang.management.MemoryMXBean; 5 import java.lang.management.Memo

运用JMX监控Tomcat

1.先配Tomcat的启动语句,window下tomcat的bin/catalina.bat(linux为catalina.sh),在头上注释部分(.bat为rem..sh为#)后面加上set JAVA_OPTS=-Dcom.sun.management.jmxremote.port=8999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true (linux为JAVA_