关闭

LR监控JVM

351人阅读 评论(0) 收藏 举报

double atof (const char *string);
//¶¨ÒåtomcatÄÚ´æʹÓÃÇé¿öµÄ¼àÊÓÆ÷ÊÂÎñ£»
lr_start_transaction("monitor tomcat"); 

//±£´æ3¸ö²ÎÊý£»
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);

/**
   <h1>http-8080</h1><p> Max threads: 150 Min spare threads: 25 Max spare threads: 75 Current
   thread count: 25 Current thread busy: 2<br>
   Max processing time: 78 ms Processing time: 0.124 s
   Request count: 11 Error count: 3 Bytes received: 0.00 MB Bytes sent: 0.03 MB</p>
*/
 web_reg_save_param("HTTPMaxThreads",
    "LB=Max threads: ",
    "RB= ",
    "Ord=2",
    LAST);
 web_reg_save_param("HTTPCurrentThreadCount",
    "LB=Max threads: ",
    "RB= ",
    "Ord=2",
    LAST);
 web_reg_save_param("HTTPCurrentThreadBusy",
    "LB=Current thread busy: ",
    "RB= ",
    "Ord=2",
    LAST);

 

 /*
   <h1>jk-8009</h1><p> Max threads: 200 Min spare threads: 4 Max spare threads: 50 Current thread count: 8 Current thread busy: 6
   <br> Max processing time: 8031 ms Processing time: 199.1 s Request count: 11279 Error count: 426 Bytes received: 0.00 MB Bytes sent: 100.88 MB</p>
  */

   web_reg_save_param("JKMaxThreads",
    "LB=Max threads: ",
    "RB= ",
    "Ord=1",
    LAST);

 web_reg_save_param("JKCurrentThreadCount",
    "LB=Max threads: ",
    "RB= ",
    "Ord=1",
    LAST);
 web_reg_save_param("JKCurrentThreadBusy",
    "LB=Current thread busy: ",
    "RB= ",
    "Ord=1",
    LAST);

 

 

 

//ͨ¹ýLRÈ¥·ÃÎÊtomcat¼à¿ØÒ³
web_set_user("admin","123456","192.168.1.30:8898");

web_url("status",
 "URL=http://192.168.1.30:8898/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£¨£©Ìí¼ÓÊý¾Ýµ½Í¼±íÖÐÈ¥
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}")));
lr_user_data_point("Tomcat JVM Avalaible memory", (atof(lr_eval_string("{JVMMaxMemory}"))-atof(lr_eval_string("{JVMTotalMemory}"))+atof(lr_eval_string("{JVMFreeMemory}"))));

 

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:106812次
    • 积分:1454
    • 等级:
    • 排名:千里之外
    • 原创:16篇
    • 转载:148篇
    • 译文:0篇
    • 评论:3条
    最新评论