LoadRunner three ways to monitor Linux

Source: Internet
Author: User
Tags echo date egrep

Method One, LR + Sitescope/nmon method Two, using RSTATD package 1, download rpc.rstatd-4.0.1.tar.gz2, extract tar-zxvf rpc.rstatd-4.0.1.tar.gz3, configuration. Configure4, compile make5, install make install6, start Rpc.rstatd7, add counters in LoadRunner average load: In the last 1 minutes, the average load CPU UTILIZATION:CPU Usage Disk Traffic:disk Transfer rate paging rates: reads from disk to physical memory per second, or memory pages written to paging files from physical memory swap-in rate: Number of processes exchanged to memory per second swap-out rate : Process 8 per second swapped out of memory, set services to start automatically (these services are started automatically when Linux starts): vi/etc/rc.d/rc.local: #rpc. rstatd--absolute Path/usr/local/sbin/rpc.rst ATD Method 3, use shell scripts to collect Linux resources from the shell script to write to the CSV file, and then import the CSV file through the analysis of LR (tools-extenal monitors-import Data ... The shell script looks like this: #!/bin/bash# (C) 2006 Mark Boddington, http://www.badpenguin.co.uk# Licensed under the GNU GPL Version 2.# * Version 0.2 *****# TODO--Create CSV parsing rules for the netstat.# * * * * Configuration *****# set LOG to the dire Ctory want to write the performance data to.# set sleep to the number of seconds you want to SLEEP between samples# SE T HDD to the number of had disks in your machine. log=/home/mark/perfmon/livesleep=10hdd=2htype=$ (uname-s) Genstat () {now=$ (date +%s) while ["$now"-ne "+"] do sleep 1 n ow=$ (date +%s) done while:;  Do dat=$ (date +%y%m%d,%h:%m:%s) day=$ (date +%y%m%d) Iostat-x 1 2 | Sed-e "s/^/(. */)/$dat/1/" | grep "[0-9]/." | Tail-${HDD} >> ${log}/io.${day}.log & Vmstat 1 2 | awk "{print/" $dat/",/$0}" | Tail-1 >> ${log}/vm.${day}.log & Netstat-i | Grep-v Iface | awk "{print/" $dat/",/$0}" >> ${log}/netstat.${day}.log & Uptime >> ${log}/uptime.${day}.log & SL Eep $SLEEP done}mkcsv () {dat=$1 if ["$HTYPE" = = "SunOS"] then #IO CSV echo Date,time,device,r/s,w/s,kr/s,kw/s,wait,ac Tv,wsvc_t,asvc_t,%w,%b > ${log}/io.${dat}.csv Cat ${log}/io.${dat}.log | Egrep-v "Extended|device" | awk ' {ofs= ', '; print $1,$12,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11} ' >> ${log}/io.${dat}.csv #VM csv echo date,time,k[r ],k[b],k[w],swap,free,pg[re],pg[mf],pg[pi],pg[po],pg[fr],pg[de],pg[sr],m0,m1,m2,m1,inteRupt,syscall,ctxswt,cpu[us],cpu[sys],cpu[idl] > ${log}/vm.${dat}.csv cat ${log}/vm.${dat}.log | awk ' {for (l=1;l<23;l++) {printf ("%s,", $l)}, Print $23} ' >> ${log}/vm.${dat}.csv #uptime csv echo time,users , 5min,10min,15min > ${log}/uptime.${dat}.csv cat ${log}/uptime.${dat}.log | awk ' {ofs= ', '; if ($6 ~/^[hm][ri]/) {print $1,$7,$11$12$13} else if ($6 ~/^user/) {print $1,$5,$9$10$11} else {pri NT $1,$6,$10$11$12}} ' >> ${log}/uptime.${dat}.csv elif ["$HTYPE" = = "Linux"] then #IO csv echo "Date,time,devic  E,rrqm/s,wrqm/s,r/s,w/s,rsec/s,wsec/s,rkb/s,wkb/s,avgrq-sz,avgqu-sz,await,svctm,%util "> ${LOG}/io.${dat}.csv Cat ${log}/io.${dat}.log | Egrep-v "Extended|device" | awk ' {for (l=1;l<15;l++) {printf ("%s,", $l)}, print $ ' >> ${log}/io.${dat}.csv #VM csv echo date,time,r,b,s Wp,free,buff,cache,si,so,bi,bo,in,cs,us,sy,id,wa > ${log}/vm.${dat}.csv Cat ${log}/vm.${dat}.log | awk ' {for (l=1;l<17;l++) {printf ("%s,", $l)}; print $17 } ' >> ${log}/vm.${dat}.csv #uptime csv echo time,users,5min,10min,15min > ${log}/uptime.${dat}.csv cat ${log} /uptime.${dat}.log | awk ' {ofs= ', '; if ($4 ~/^min/) {print $1,$5,$9$10$11} else {print $1,$4,$8$9$10}} ' >> ${log}/uptime.${dat}.cs V Else echo "Hmmm-an unexpected error occured.  Have the host type? fi}if ["$HTYPE"! = "SunOS"-a "$HTYPE"! = "Linux"] then echo "Error-this script have no knowlege of the System $HTYPE" echo "You'll need to does some tweaking." Exitficase "in Run" GENSTAT;; CSV) if [$#-lt 2] then echo "Error-you must supply a date in the form YYYYMMDD" Exit fi mkcsv $;; *) echo-e ":::: Usage::::" ECHO-E "$ run:collect Stats" ECHO-E "$ csv yyyymmdd:generate csv FR Om stats "echo" ";; Esac

LoadRunner three ways to monitor Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.