![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| capture shell output in cron entry | steve72 | UNIX for Dummies Questions & Answers | 5 | 04-17-2008 12:00 PM |
| Capture ufsdump/ufsrestore output | Tornado | Shell Programming and Scripting | 2 | 03-31-2008 11:47 PM |
| Capture output to file and printer | rdasari | UNIX for Advanced & Expert Users | 1 | 01-16-2008 03:57 PM |
| Capture scp output | Tornado | Shell Programming and Scripting | 7 | 12-06-2007 10:16 PM |
| Capture output from interactive script | MizzGail | Shell Programming and Scripting | 6 | 04-04-2002 06:24 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
script to capture certain output
Hi All,
I want to create a script that capture only Date & Time, Current CPU % usage, Disk % usage, Mem % usage and Top process based on this output; Data Collected: 05/17/08 17:19:49 Refresh Interval: 600 seconds GlancePlus Started/Reset: 05/17/08 08:19:45 B3692A GlancePlus C.03.72.00 17:29:49 UXAMSK01 9000/800 Current Avg High ------------------------------------------------------------------------------- CPU Util SSUUUUU | 16% 9% 22% Disk Util F | 1% 5% 12% Mem Util SSSSSSSSSSUUUUUUUUBBBBB | 46% 45% 46% Swap Util UUUURRRRR | 17% 16% 17% ------------------------------------------------------------------------------- IO BY FILE SYSTEM Users= 8 Idx File System Device Type Logl IO Phys IO -------------------------------------------------------------------------------- 1 / /dev/vg00/lvol3 vxfs 24.8/ 25.1 0.5/ 0.5 2 /stand /dev/vg00/lvol1 hfs 0.0/ 0.0 0.0/ 0.0 3 /var /dev/vg00/lvol8 vxfs 0.2/ 0.3 1.9/ 2.1 4 /usr /dev/vg00/lvol7 vxfs 35.2/ 17.7 0.9/ 0.7 5 /tmp /dev/vg00/lvol4 vxfs 0.0/ 0.0 0.0/ 0.0 6 /opt /dev/vg00/lvol6 vxfs 40.2/ 40.2 0.9/ 1.0 7 /nsm /dev/vg00/lvol10 vxfs 0.5/ 0.6 0.4/ 0.3 8 /home /dev/vg00/lvol5 vxfs 0.0/ 0.0 0.0/ 0.0 9 /app/oracle9i /dev/vg00/lvol9 vxfs 0.0/ 0.0 0.0/ 0.0 10 /BTM/aramis /dev/vgaramis/lvol1 vxfs 1092/674.8 30.8/ 91.1 11 /BTB/aramis /dev/vgbtb/lvol1 vxfs 0.0/ 0.0 0.0/ 0.0 12 swap device /dev/vg00/lvol2 hfs 0.0/ 0.0 0.0/ 0.0 Top disk user: PID 11053, s_server 10.0 IOs/sec S - Select a Disk Any advise? |
|
||||
|
Hi bakunin,
I've tested the script, and this is the output that I received; B3692A GlancePlus C.03.72.00 08:19:46 UXAMSK01 9000/800 Current Avg High I want the output to be like this; Data Collected: 05/17/08 17:19:49 UXAMSK01 Current ------------------------------------------------------------------------------- CPU 16% Disk 1% Mem 46% Top disk user: PID 11053, s_server 10.0 IOs/sec S - Select a Disk Is it possible? |
|
||||
|
Hm, i have tried the script with the following file, on which it does (almost - the "...Current..."-line is missing) exactly that: Code:
Data Collected: 05/17/08 17:19:49 Refresh Interval: 600 seconds GlancePlus Started/Reset: 05/17/08 08:19:45 B3692A GlancePlus C.03.72.00 17:29:49 UXAMSK01 9000/800 Current Avg High ------------------------------------------------------------------------------- CPU Util SSUUUUU | 16% 9% 22% Disk Util F | 1% 5% 12% Mem Util SSSSSSSSSSUUUUUUUUBBBBB | 46% 45% 46% Swap Util UUUURRRRR | 17% 16% 17% ------------------------------------------------------------------------------- IO BY FILE SYSTEM Users= 8 Idx File System Device Type Logl IO Phys IO -------------------------------------------------------------------------------- 1 / /dev/vg00/lvol3 vxfs 24.8/ 25.1 0.5/ 0.5 2 /stand /dev/vg00/lvol1 hfs 0.0/ 0.0 0.0/ 0.0 3 /var /dev/vg00/lvol8 vxfs 0.2/ 0.3 1.9/ 2.1 4 /usr /dev/vg00/lvol7 vxfs 35.2/ 17.7 0.9/ 0.7 5 /tmp /dev/vg00/lvol4 vxfs 0.0/ 0.0 0.0/ 0.0 6 /opt /dev/vg00/lvol6 vxfs 40.2/ 40.2 0.9/ 1.0 7 /nsm /dev/vg00/lvol10 vxfs 0.5/ 0.6 0.4/ 0.3 8 /home /dev/vg00/lvol5 vxfs 0.0/ 0.0 0.0/ 0.0 9 /app/oracle9i /dev/vg00/lvol9 vxfs 0.0/ 0.0 0.0/ 0.0 10 /BTM/aramis /dev/vgaramis/lvol1 vxfs 1092/674.8 30.8/ 91.1 11 /BTB/aramis /dev/vgbtb/lvol1 vxfs 0.0/ 0.0 0.0/ 0.0 12 swap device /dev/vg00/lvol2 hfs 0.0/ 0.0 0.0/ 0.0 Top disk user: PID 11053, s_server 10.0 IOs/sec S - Select a Disk <end-of-file> bakunin |
|
||||
|
bakunin,
i've managed to get the output that i desired using the script that you've given, but now i'm facing another problem. the output file (/some/file) is not static, it has more output, because it has 600 seconds interval. so in one output file, i can have more entries like the one i've shown below. so how to make the script to capture (time, cpu/disk/mem-current and top process) and direct it into one file (e.g output.out)? which means, when i run the script, e.g: sed -n '1p;8,10 {;s/^\([^ ]*\) [^0-9]*\([0-9]*%\).*$/\1 \2/p;};$p' /home/fara/AMSK01_glance.out_20080517 i want to get output.out that looks like this; Data Collected: 05/17/08 17:19:49 UXAMSK01 Current ------------------------------------------------------------------------------- CPU 16% Disk 1% Mem 46% Top disk user: PID 11053, s_server 10.0 IOs/sec S - Select a Disk Data Collected: 05/17/08 17:29:49 UXAMSK01 Current ------------------------------------------------------------------------------- CPU 16% Disk 1% Mem 46% Top disk user: PID 11053, s_server 10.0 IOs/sec S - Select a Disk Data Collected: 05/17/08 17:39:49 UXAMSK01 Current ------------------------------------------------------------------------------- CPU 16% Disk 1% Mem 46% Top disk user: PID 11053, s_server 10.0 IOs/sec S - Select a Disk (etc) Sorry if it's troublesome.. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|