Visit Our UNIX and Linux User Community


summing up iostat values in AIX


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting summing up iostat values in AIX
# 1  
Old 10-30-2009
summing up iostat values in AIX

Friends,
I have to run iostat -d on my AIX machine and print the sum of the output in tps column per iteration. can any one pls guide me how to do this using awk. here is the sample output

Code:
 iostat -d 2 2 | awk '!/System/ && !/Disks/ && !/cd[0-9]/ && !/^$/ {print $4}'
2.0
3.0
1.0
3.0

My system contains two hard disks. so output will be
5
4.
can anyone guide me how to do this?
# 2  
Old 10-30-2009
Not the best way to do it, but it'll work....

Code:
$ iostat -d 2 2 | awk '{if(NR > 3 && NR < 6) SUM1 += $2; if(NR > 7 && NR < 10) SUM2 += $2 } END { print "iteration 1:" SUM1 "  iteration 2:" SUM2 }'

iteration 1:7.43  iteration 2:4.96

or

Code:
iostat -d 2 2 | awk '{if(NR > 3 && NR < 6) SUM1 += $2; if(NR > 7 && NR < 10) SUM2 += $2 } END { print SUM1 "\n" SUM2 }'

7.43
4.96

This is simple and won't loop for more iterations.

Previous Thread | Next Thread
Test Your Knowledge in Computers #338
Difficulty: Easy
telnet is considered safer than ssh for most remote login applications.
True or False?

10 More Discussions You Might Find Interesting

1. Solaris

Asvc_t values in iostat output

Noticed that asvc_t values in iostat command outputs are mostly more than 100 in our previous iostat analysis. Also found the following detail from an alternate site IO Bottleneck - Disk performance issue - UnixArena ---- 1. asvc_t average service time of active transactions, in... (2 Replies)
Discussion started by: saraperu
2 Replies

2. Shell Programming and Scripting

Summing up values of rows of numbers

data file contains failed=24 error=23 error=163 failed=36 error=903 i need to get a total count of each value above. i'm looking for the most efficient method to do this as the datafile i provided is just a sample. the actual data can be several hundred thousands of lines. so from... (3 Replies)
Discussion started by: SkySmart
3 Replies

3. UNIX for Advanced & Expert Users

AIX - io info get from "libperfstat" not match "iostat"

Hi, everyone. I need to write a program to get io info based on libperfstat. But the "write time" of a disk is just half of the value get from iostat. I'm confused and can't explain. Help please. How I calculate "write service time per sec": In iostat: write service... (0 Replies)
Discussion started by: jackliang
0 Replies

4. Shell Programming and Scripting

reading a script and summing some values

I need help reading and summing some values in a file that looks like the following. This is an Oracle trace file. Oracle has as utility to do this,but it doesn't work properly unless my sql statement is done. I want to read the file and sum up some values to let me know how the query/job is... (0 Replies)
Discussion started by: guessingo
0 Replies

5. Shell Programming and Scripting

Summing values in columns

Basically I have to process a text file which has been sorted this way: John 12 John 13 John 10 John 900 Peter 20 Peter 30 Peter 32 The first column is a name, and the second an arbitrary value, both delimited by a space. How can I sum them up such that it would become: John 935... (2 Replies)
Discussion started by: Dwee
2 Replies

6. Shell Programming and Scripting

Awk: Summing values with group criteria

Hi Guys, I have a text file with ";" like separator F1;F2;F3;F4;F5 444;100041;IT;GLOB;1800000000 444;100041;TM;GLOB;1000000000 444;10300264;IT;GLOB;2000000000 444;10300264;IT;GLOB;2500000000 I have to sum the cullums F5 for same F2 and F3 collums The result must be: ... (7 Replies)
Discussion started by: gianluca2
7 Replies

7. Shell Programming and Scripting

summing values of a column

I have a file which contains data as below: ----------------------------------------------------------------------------------------------- GSPWeb Statistics for the period of last 20 days... (3 Replies)
Discussion started by: mohsin.quazi
3 Replies

8. UNIX for Dummies Questions & Answers

sar and iostat recommended interval/count values.

Hi, I got a request from a client to check on their server's cpu, memory and disk utilization. Am planning to use the sar and iostat commands to achieve this. The server is used for sending and receiving messages between the stockbrokers, so I was thinking to run the commands during the market... (9 Replies)
Discussion started by: 60doses
9 Replies

9. UNIX for Advanced & Expert Users

Equivalent for iostat -e in AIX HP-UX Linux

iostat -e gives the soft, hard and transport error information in Solaris. What is the equivalent command in the other flavors of Unix AIX HP Linux. Thanks Prasi (1 Reply)
Discussion started by: prasi_in
1 Replies

10. UNIX for Dummies Questions & Answers

Help wantyed to understand iostat -D in AIX 5.3

Hi, I am new to AIX and I am trying to look into a performance issue with an C-Isam based application that uses Asynchronous IO. I ran iostat -D to have a look at the disks and saw what seemed to be some big figures ocurring in the queues section such as waits in the service queue of 3.1... (2 Replies)
Discussion started by: Harpo_HK
2 Replies

Featured Tech Videos