Tuesday, 25 March 2014

Monitor Tomcat with user data

Monitor Tomcat with user data:-

lr_start_transaction("monitor tomcat");
 
/*
<h1>JVM</h1><p> Free memory: 130.99 MB Total memory: 254.18 MB Max memory: 1016.12 MB</p>
*/
 
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_reg_find("Text=/manager", 
 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}")));

No comments:

Post a Comment