LoadRunner three ways to monitor Linux

Source: Internet
Author: User
Tags echo date egrep

Method One, LR + SiteScope

Method two, using RSTATD package

1. Download rpc.rstatd-4.0.1.tar.gz

2. Decompression

TAR-ZXVF rpc.rstatd-4.0.1.tar.gz

3. Configuration

./configure

4. Compiling

Make

5. Installation

Make install

6. Start

Rpc.rstatd

7. Adding counters in LoadRunner

Average load: In the last 1 minutes, the average load

CPU UTILIZATION:CPU Utilization

Disk Traffic:disk transfer Rate

Paging Rate: The number of memory pages per second read from disk to physical memory, or from physical memory to the paging file

Swap-in Rate: Number of processes swapped to memory per second

Swap-out Rate: Processes that are swapped out of memory per second

8. Set the service to start automatically (these services are started automatically when Linux starts):

Vi/etc/rc.d/rc.local

Such as:

#rpc. rstatd--Absolute Path

/usr/local/sbin/rpc.rstatd

Method 3, using shell scripts

Use shell scripts to collect Linux resources to write to the CSV file, and then import the CSV file via 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 directory of your want to write the performance data to.
# set SLEEP to the number of seconds want to SLEEP between samples
# set HDD to the number of had disks in your machine.

Log=/home/mark/perfmon/live
sleep=10
hdd=2

htype=$ (uname-s)

Genstat ()
{
now=$ (Date +%s)
While ["$now"-ne "30"]
Do
Sleep 1
now=$ (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 &
Sleep $SLEEP
Done
}

Mkcsv ()
{
Dat=$1

If ["$HTYPE" = = "SunOS"]
Then

#IO CSV
echo date,time,device,r/s,w/s,kr/s,kw/s,wait,actv,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,DEVICE,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
& Nbsp; echo Date,time,r,b,swp,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 has no knowlege of the System $HTYPE"
echo "You'll need to do some tweaking."
Exit
Fi

Case $ 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 from stats"
echo ""
;;
Esac

Reference:

http://www.loadrunnertnt.com/tools/local-unix-monitoring-made-possible/

http://www.badpenguin.co.uk/main/content/view/43/35/

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.