Sponsored Content
Full Discussion: Parsing iostat in real time
Top Forums Shell Programming and Scripting Parsing iostat in real time Post 302419662 by fastergrace on Friday 7th of May 2010 05:07:49 PM
Old 05-07-2010
Quote:
Originally Posted by Franklin52
Post the output of the iostat command and the desired output in the csv files.
Sure.

iostat output is below. This particular example is in five second intervals but the script will take in a variable that allows the user to specify whatever time interval in seconds they prefer.
Code:
-bash-3.00$ iostat 5 -x -t
Linux 2.6.9-42.0.3.ELsmp (wombat64)     07/05/10        _x86_64_        (2 CPU)

07/05/10 21:34:16
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
          13.82    0.00    2.16    0.72    0.00   83.31

Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
hda               0.00     3.89    0.11    0.34     5.33    33.92    87.03     0.28  629.52   2.97   0.13
hdb               0.16    20.18    1.14    4.13    81.66   194.55    52.38     1.24  234.53   2.00   1.05

07/05/10 21:34:21
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.40    0.00    0.60    0.10    0.00   98.90

Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
hda               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
hdb               0.00     2.99    0.00    0.80     0.00    30.34    38.00     0.00    1.25   1.25   0.10

07/05/10 21:34:26
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.50    0.00    0.30    0.20    0.00   99.00

Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
hda               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
hdb               0.00     3.60    0.20    0.60     1.60    33.60    44.00     0.00    5.25   5.25   0.42

This is what I'd like the cpu statistics to look like:
Code:
date/time,%user,%nice,%system,%iowait,%steal,%idle
07/05/10 21:34:16,13.82,0.00,2.16,0.72,0.00,83.31
07/05/10 21:34:21,0.40,0.00,0.60,0.10,0.00,98.90
07/05/10 21:34:26,0.50,0.00,0.30,0.20,0.00,99.00

And the device stats:
Code:
date/time,rrqm/s,wrqm/s,r/s,w/s,rsec/s,wsec/s,avgrq-sz,avgqu-sz ,await,svctm,%util
07/05/10 21:34:16,hda,0.00,3.89,0.11,0.34,5.33,33.92,87.03,0.28,629.52,2.97,0.13
07/05/10 21:34:16,hdb,0.16,20.18,1.14,4.13,81.66,194.55,52.38,1.24,234.53,2.00,1.05
07/05/10 21:34:21,hda,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
07/05/10 21:34:21,hdb,0.00,2.99,0.00,0.80,0.00,30.34,38.00,0.00,1.25, 1.25,0.10
07/05/10 21:34:26,hda,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
07/05/10 21:34:26,hdb,0.00,3.60,0.20,0.60,1.60,33.60,44.00,0.00,5.25,5.25,0.42



I can probably figure out how to use sed or awk to parse the strings, honestly my confusion stems more from the logistics of how to take the output and manipulate it in rt. I can run two separate instances of iostat, one which pulls cpu stats (iostat -c) and one which pulls device stats (iostat -d), but it is preferable to parse the output from one.
 

6 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

EPOCH to real time?

hi all :confused: i am wondering if there is a way to convert from EPOCH time to the standard tim, may be using a script or some thing else??????? thanks............................ (5 Replies)
Discussion started by: TheEngineer
5 Replies

2. Solaris

Real time problems

Hi friends, I am new to solaris and looking for a job, when ever i attend interview i get most of the questions on real time problems, every one sak me the same questions what are the problems you face daily.. and what are the types? i know few like, disk extension,swap memory increasing,... (2 Replies)
Discussion started by: kurva
2 Replies

3. Shell Programming and Scripting

Shell script to convert epoch time to real time

Dear experts, I have an epoch time input file such as : - 1302451209564 1302483698948 1302485231072 1302490805383 1302519244700 1302492787481 1302505299145 1302506557022 1302532112140 1302501033105 1302511536485 1302512669550 I need the epoch time above to be converted into real... (4 Replies)
Discussion started by: aismann
4 Replies

4. UNIX for Dummies Questions & Answers

Real time processing

Hi Not sure if this can be achieved by unix , but still would like to know if there is any way by which I can do the below given logic cat sam1 > out1 cat sam2 > out2 when either one of this finished the the next file shd be written in that file, meaning cat sam3 >> out1/out2... (2 Replies)
Discussion started by: Sri3001
2 Replies

5. Shell Programming and Scripting

Parsing iostat data

Hello, I searched the forum and found the parsing iostat data in real time but that does not help me. What I would like to do is to parse the iostat data that has been gathered. Below is an example of the iostat output: System configuration: lcpu=4 drives=5 ent=0.10 paths=20 vdisks=2 ... (11 Replies)
Discussion started by: tommyd
11 Replies

6. Shell Programming and Scripting

Converting real time to epoch time

# date +%s -d "Mon Feb 11 02:26:04" 1360567564 # perl -e 'print scalar localtime(1360567564), "\n";' Mon Feb 11 02:26:04 2013 the epoch conversion is working fine. but one of my application needs 13 digit epoch time as input 1359453135154 rather than 10 digit epoch time 1360567564... (3 Replies)
Discussion started by: vivek d r
3 Replies
All times are GMT -4. The time now is 07:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy