loadrunner监控tomcat

原创
2016/06/18 17:23
阅读数 227
double atof (const char *string); 

Action()
{

    float freememory,totalmemory,maxmemory;

	//web_set_user("admin",lr_decrypt("4993d46de"),"localhost:8089");
	web_set_user("admin","" ,"localhost:8089");

	web_reg_save_param("Free memory",
		"LB=Free memory: ",
		"RB=Total memory:",
		LAST);

	web_reg_save_param("Total memory",
		"LB=Total memory:",
		"RB=Max memory:",
		LAST);

	web_reg_save_param("Max memory",
		"LB=Max memory:",
		"RB=",
		LAST);

	web_url("status", 
		"URL=http://localhost:8089/manager/status", 
		"TargetFrame=", 
		"Resource=0", 
		"RecContentType=text/html", 
		"Referer=", 
		"Snapshot=t1.inf", 
		"Mode=HTML", 
		LAST);

	sleep(5);
	//lr_output_message("%s",lr_eval_string("{Free memory}"));
    freememory=atof(lr_eval_string("{Free memory}"));
	totalmemory=atof(lr_eval_string("{Total memory}"));
	maxmemory=atof(lr_eval_string("{Max memory}"));
    //lr_output_message("%.2f %.2f %.2f",freememory,totalmemory,maxmemory);
  	lr_user_data_point("Tomcat JVM Free memory", freememory);
  	lr_user_data_point("Tomcat JVM Total memory", totalmemory);
  	lr_user_data_point("Tomcat JVM Max memory", maxmemory);
	sleep(5);
	return 0;
}

 

展开阅读全文
加载中

作者的其它热门文章

打赏
0
1 收藏
分享
打赏
0 评论
1 收藏
0
分享
返回顶部
顶部