qileilove

          blog已經轉移至github,大家請訪問 http://qaseven.github.io/

          LoadRunner監控tomcat的代碼

            最近想對tomcat的性能指標做監控,于是 想到loadrunner關聯函數的用法,于是做了本次嘗試,沒想到效果還不錯,所以拿出來供大家分享,通過本次測試發現,關聯的作用太強大了~
          Action()
          {
          double atof(const char *string);
          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);
          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);
          web_set_user("tomcat", "123","10.40.15.8:8080");
          lr_think_time(20);
          web_url("status",
          "URL=http://10.40.15.8:8080/manager/status",
          "Resource=0",
          "RecContentType=text/html",
          "Referer=",
          "Snapshot=t1.inf",
          "Mode=HTML",
          LAST);
          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;
          }

          posted on 2014-05-13 16:24 順其自然EVO 閱讀(555) 評論(0)  編輯  收藏 所屬分類: loadrunner

          <2014年5月>
          27282930123
          45678910
          11121314151617
          18192021222324
          25262728293031
          1234567

          導航

          統計

          常用鏈接

          留言簿(55)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 武强县| 化德县| 电白县| 吐鲁番市| 微博| 赫章县| 昌乐县| 惠来县| 天祝| 萍乡市| 凤翔县| 夏河县| 晋中市| 库伦旗| 乳山市| 青海省| 武功县| 平南县| 新建县| 原平市| 上虞市| SHOW| 茂名市| 宝山区| 五寨县| 平昌县| 牡丹江市| 共和县| 东台市| 巴东县| 昔阳县| 福州市| 平果县| 万山特区| 云霄县| 阜南县| 施秉县| 鲁甸县| 凤冈县| 嘉兴市| 盘锦市|