LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 07-10-2009, 06:41 AM   #1
suran
LQ Newbie
 
Registered: Jan 2009
Posts: 12

Rep: Reputation: 0
formatting iostat output


I've created a monitoring script that sends the following info to our team, sar, swap usage, df output and iostat -nm (nfs usage)

problem is the iostat columns are all wonky. How can i align them all neatly?

i'm doing an iostat -nm 2 4
 
Old 07-10-2009, 08:33 AM   #2
xeleema
Member
 
Registered: Aug 2005
Location: D.i.t.h.o, Texas
Distribution: Slackware 13.x, rhel3/5, Solaris 8-10(sparc), HP-UX 11.x (pa-risc)
Posts: 987
Blog Entries: 4

Rep: Reputation: 249Reputation: 249Reputation: 249
Formatting Output

Greetingz!
Well, there's a quick awk trick you could use to put tabs between all the columns. This will insert a tab between each column;

$ iostat -nm 2 1 | awk '{OFS="\t"}{print $1, $2, $3, $4, $5, $6}'

Or you could opt for a few spaces;

$ iostat -nm 2 1 | awk '{OFS=" "}{print $1, $2, $3, $4, $5, $6}'

Let me know how it goes!

(And feel free to click the thumbs-up if this helps )
 
Old 07-14-2009, 06:02 AM   #3
suran
LQ Newbie
 
Registered: Jan 2009
Posts: 12

Original Poster
Rep: Reputation: 0
almost mate:

Filesystem: rMB_nor/s wMB_nor/s rMB_dir/s wMB_dir/s rMB_svr/s
192.168.100.233:/vol/ca/exports/home 0.00 0.00 0.00 0.00 0.00
192.168.100.233:/vol/ca/exports/nfscommon 0.00 0.00 0.00 0.00 0.00
192.168.100.233:/vol/ca/exports/opt 0.00 0.00 0.00 0.00 0.00
192.168.100.233:/vol/ca/exports/www 0.00 0.00 0.00 0.00 0.00


but the nfscommon is still off the scale
 
Old 07-14-2009, 06:10 AM   #4
suran
LQ Newbie
 
Registered: Jan 2009
Posts: 12

Original Poster
Rep: Reputation: 0
also if you look at the top column the headings they dont align with the values

I want it to look like :

Filesystem: rMB_nor/s wMB_nor/s rMB_dir/s wMB_dir/s rMB_svr/s
192.168.100.233:/vol/ca/exports/home 0.00 0.00 0.00 0.00 0.00

....edited for brevity


I tried increasing the amount of spaces but that didnt work. Wonder if u can increase the tab count?

Last edited by suran; 07-14-2009 at 06:11 AM. Reason: the formatting doesnt appear how i want it, but im sure u get the idea
 
Old 07-14-2009, 08:00 AM   #5
markseger
Member
 
Registered: Jul 2003
Posts: 241

Rep: Reputation: 25
Not exactly the question you asked, but collectl can monitor all the data you mentioned and more, format it up in multiple ways depending on which switches you choose and even send it over a socket if you so desire. It's very lightweight so you can let it run all the time and if you really want to hack it, there's an interface that would allow you to generate output in whatever format you choose.
-mark
 
  


Reply

Tags
formatting, script, text


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is sar & iostat output of svctm accurate Baffled Linux - Server 1 07-09-2009 03:15 PM
Output of iostat bichonfrise74 Linux - Newbie 2 04-25-2009 12:54 PM
mapping mount points to iostat output DotHQ Linux - Enterprise 1 04-18-2007 11:56 AM
Formatting output krock923 Programming 2 06-07-2006 08:26 AM
Formatting output of ls doodar Linux - Newbie 29 07-29-2004 02:25 PM


All times are GMT -5. The time now is 11:52 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration