Capture the data in Linux .While doing load test.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Capture the data in Linux .While doing load test.
# 1  
Old 11-13-2012
Capture the data in Linux .While doing load test.

Hi All,

I am trying to capture the data in linux .While doing load test.
is there's any sample script please help me.

Linux test4 2.6.18-308.8.1.el5 #1 SMP Fri May 4 16:43:02 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux


Thanks,
# 2  
Old 11-13-2012
Not sure if this is what you're looking for - you could redirect the output to a file, if you want it for posterior use.

Code:
$ command arguments > file

Please provide more details.. inputs, data samples, desired output..
# 3  
Old 11-13-2012
Capture the data in Linux .While doing load test.

Hi Balajesuri,

When we are doing the load test. script has to capture the data and save it some xxx location. After the load test i have to send other developer .

if the load is high it has to send alert to mail. is there's any sample script available.

i am a new bie to scripting.

Thanks,
# 4  
Old 11-14-2012
Basic one to check load:

Code:
#!/bin/bash

LOAD_VALUE=`cat /proc/loadavg | sed 's/\./ /' | awk '{print $1}'`

if [ $LOAD_VALUE -gt "6" ]; then
       mail -s “PANIC” someone@somedomain.com
fi



Replace the value "6" for one that apply to you.

Last edited by braniak; 11-14-2012 at 12:27 PM..
# 5  
Old 11-14-2012
Thank you so much braniak.

I have a small doubt how to capture the data while performing the load test. I have to review the captured data later


Regards,
# 6  
Old 11-19-2012
Quote:
Originally Posted by sam1226
Thank you so much braniak.

I have a small doubt how to capture the data while performing the load test. I have to review the captured data later


Regards,
As I said, this is a simple way to do it, and it's not sofisticated at all.. Smilie

In your main script, that will execute some sort of commands, put the "touch" command at the beginning, execute the load.sh in background and put the "rm -rf" at the end:


Code:
#!/bin/bash

touch /tmp/load.pid # Create the "control" file.

./load.sh & # Execute the load.sh in background.

comandos(){
ls
sleep 5
ls -lhtr
sleep 5
}

comandos

sleep 1

comandos

rm -rf /tmp/load.pid # Remove the "control" file.

exit 0


Then, create the load.sh like this:

Code:
#!/bin/bash

while [ -e /tmp/load.pid ]
        do
        LOAD_VALUE=`cat /proc/loadavg | sed 's/\./ /' | awk '{print $1}'`

                if [ $LOAD_VALUE -gt "6" ]; then
                        echo "`date` - $LOAD_VALUE" >> load.log
                        mail -s "PANIC" someone@somedomain.com
                        exit 1
                else
                        echo "`date` - $LOAD_VALUE" >> load.log
                fi
        sleep 5
        done
exit 0


Last edited by braniak; 11-19-2012 at 09:36 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Capture a block of data

Hi, I was trying a script to cature all data between 12-05-09 06:00:00 to 12-05-09 23:59:59 from a huge file. (i.e. Skip all data between 00:00:00 to 05:59:59) TOKEN-1 12-05-09 00:00:00 MAIPR no_OMDB_key #000995 > .. .. .. TOKEN-1 12-05-09 06:00:00 TRUNK 358 #04988 > .. .. TOKEN-1 12-05-09... (2 Replies)
Discussion started by: vanand420
2 Replies

2. UNIX for Advanced & Expert Users

capture data from matched string/line

Hi, I have a query as follows : suppose I am matching a string in a file say "start from here" and I want to pick up 'n' number of lines () from the matched string. Is there any way to do that ? 1) going forward I want to do this for every match for the above string 2) or limit this to... (2 Replies)
Discussion started by: sumoka
2 Replies

3. UNIX for Advanced & Expert Users

Memory load test

is there a program out there that will put a memory load on my HP_ux 11.11 box. I need to stress mem/swap to setup memory thresholds for my monitoring software. I am using Nimbus to monitor memory and swap. glance is telling me that memory is never past 70 percent however nimbus will page out ... (1 Reply)
Discussion started by: myork
1 Replies

4. Shell Programming and Scripting

Capture two set of data to same line...simple

I would like to capture output from two commands to a test file on the same line... I want to get a file with all Applications and the Version of it...here are the two commands I use to get the output. To get Application list I use ls -1 /Applications/ |grep .app >>... (3 Replies)
Discussion started by: elbombillo
3 Replies

5. Shell Programming and Scripting

Capture data in a file

How to capture the rows in a file after executing the store procedure using the perl scripts? (0 Replies)
Discussion started by: vinay123
0 Replies

6. UNIX for Dummies Questions & Answers

Howto capture data from rs232port andpull data into oracle database-9i automatically

Hi, i willbe very much grateful to u if u help me out.. if i simply connect pbx machine to printer by serial port RS232 then we find this view: But i want to capture this data into database automatically when the pbx is running.The table in database will contain similar to this view inthe... (1 Reply)
Discussion started by: boss
1 Replies

7. Shell Programming and Scripting

Need help in wrting Load Script for a Load-Resume type of load.

hi all need your help. I am wrting a script that will load data into the table. then on another load will append the data into the existing table. Regards Ankit (1 Reply)
Discussion started by: ankitgupta
1 Replies

8. Shell Programming and Scripting

Multiple loops for Load test

Hi All, I am trying to write a bash script that will read a list of numbers from a file, then it needs to use netcat to create a socket connection and pass header/request. I need to limit it to 100 connections. So, after the first set of 100 are fineshed, I need to loop and do it again with... (0 Replies)
Discussion started by: willdev
0 Replies

9. Shell Programming and Scripting

Capture POST data

Is it possible to capture data posted from a Web Form?? I mean when data in the form on a webpage is send via POST method and not GET method. Can it be captured! (1 Reply)
Discussion started by: azmathshaikh
1 Replies
Login or Register to Ask a Question