LoadRunner Monitor Tomcat (2012-10-25 14:01:42) reprint
Double atof (const char * string);
Action ()
{
Save JVM Memory values
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);
Save http-8989 Connection Value
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);
A monitor transaction that defines tomcat memory usage;
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);
Use Lr_user_data_point () to add data to the chart
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 Monitoring Tomcat