how to format ssh top output


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to format ssh top output
# 1  
Old 10-11-2011
how to format ssh top output

Hello;

Am trying to generate runaway proc report using ssh thusly:

===================
Code:
ssh -t -t $BOX 'TERMINAL="vt100" top -d1 -h -n 10' >> $FILE
.
.
cat $FILE | mail -s "Latest Top `date`" $MAIL_TO

====================

But the output to e-mail comes out rather garbled ..
Any ideas on how to format it properly ??

Thank you

====================================
===

Code:
  [m[H[2JSystem: atbsrv[40CTue Oct 11 05:52:48 2011 [BLoad averages: 1.16, 1.24, 1.17
  [B283 processes: 199 sleeping, 84 running [BCpu states: (avg)[B
   LOAD   USER   NICE    SYS   IDLE  BLOCK  SWAIT   INTR   SSYS[B
   1.16   0.0%  13.6%   6.8%  79.6%   0.0%   0.0%   0.0%   0.0%[2B
  System Page Size: 4Kbytes
  [BMemory: 2636696K (2257212K) real, 7180932K (6556660K) virtual, 2574576K free  Page# 1/29[2B
  CPU TTY    PID USERNAME PRI NI   SIZE    RES STATE    TIME %WCPU  %CPU COMMAND[B
   0   ?    8558 dslmain  242 21   430M 15768K run[6C2:46 25.76 25.71 _progres[B
   0   ?   15839 progress 152 21  1391M   527M run     94:16  2.29  2.29 java[B
   1   ?[7C2 root     128 20    72K    64K sleep  139:05  0.76  0.76 vhand[B
   0   ?    2748 root     168 20 15552K  1160K sleep  217:37  0.61  0.61 utild[B
   0   ?    5081 progress 168 21   422M  5892K sleep    0:22  0.47  0.47 _progres[B
   1   ?    2162 root     152  0 56476K 11284K run    158:01  0.41  0.41 perfd[B
   2 pts/0 20248 roo!
   t     179 20 11512K  2300K run[6C0:00  7.65  0.37 top[B
   2   ?   20245 root     154 20 22940K  1832K sleep    0:00  3.59  0.34 sshd:[B
   0   ?   19217 progress 152 21  1318M   195M run[6C0:41  0.27  0.27 java[B
   2   ?    2559 root     -27 20 62616K 47876K run    115:21  0.27  0.27 cmcld
  [B[23B

============================

---------- Post updated at 09:35 AM ---------- Previous update was at 08:11 AM ----------

I solved my own problem

Thnx

Last edited by pludi; 10-11-2011 at 09:35 AM..
# 2  
Old 10-12-2011
not sure which method you used to solve the issue.

But, you can use top -b which says batch method and redirection gives proper readable output.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Format Top and prstat command output

need help with formatting output of command top and prstat. My requirment is to remove few columns and display remaining . But when i used awk to do that the output seems to be have gone vague, mixing the column values. After using awk to print particular column the output seems to have lost... (1 Reply)
Discussion started by: NarayanaPrakash
1 Replies

2. UNIX for Dummies Questions & Answers

Preserving the format of top command result

hi, I have tried the below command in RHEL5: top|mailx -s "test" "abc@cvf.com" But in the mail the content was not in proper format. Is there any way to preserve the format ? Thanks (2 Replies)
Discussion started by: pandeesh
2 Replies

3. HP-UX

how to run top or glance non-interactively using ssh

Hello Am trying to run top /glance non-interactively using ssh from redhat to hp-ux hosts but getting following errors.. ======================= ssh msi 'top -n 1' Sorry, I need to know a more specific terminal type than "unknown". ssh msi top -d1 -n20 > /tmp/top.out Sorry, I need... (3 Replies)
Discussion started by: delphys
3 Replies

4. Solaris

top output and swap -s output are differing

Solaris experts, Am struggling, and wondering for the past more than one week that, how to calculate the total available and used memory/swap space. Finally installed and used top & got some understanding, but while cross-checking, there are mismatches. Main Memory top o/p - 2GB... (7 Replies)
Discussion started by: thegeek
7 Replies

5. Solaris

Output top to file

Hi, I've installed SMCtop on to a Solaris 9 sparc server and I am trying to capture the output of top to a file without success. The version of top I have installed is top-3.6.1-sol9-sparc-local.gz. All my attempts are below. # /usr/local/bin/top -d 5 -f /tmp/top.out... (3 Replies)
Discussion started by: sparcman
3 Replies

6. Shell Programming and Scripting

top output for six processes with the same name, output changed from column to row

Hi, I have a system under test, and I use a script that does a ps. The output, is in the following format, it's basically the timestamp, followed by the rss and vsize. 09:03:57 68404 183656 68312 181944 69860 217360 67536 182564 69072 183172 69032 199276 09:04:27 68752 183292 70000 189020... (5 Replies)
Discussion started by: Bloke
5 Replies

7. Shell Programming and Scripting

Net::SSH::Perl ...... how to print the output in a proper format

Hi Guys, my $cmd = "ls -l"; #........ {or let it be as # my $cmd= "ls"; } my $ssh = Net::SSH::Perl->new($host); $ssh->login($user, $pass); my($stdout, $stderr, $exit) = $ssh->cmd("$cmd"); print $stdout; the script works fine, but i am unable to see the output getting displayed in a... (7 Replies)
Discussion started by: gsprasanna
7 Replies

8. Shell Programming and Scripting

capturing output from top and format output

Hi all, I'd like to capture the output from the 'top' command to monitor my CPU and Mem utilisation.Currently my command isecho date `top -b -n1 | grep -e Cpu -e Mem` I get the output in 3 separate lines.Tue Feb 24 15:00:03 Cpu(s): 3.4% us, 8.5% sy .. .. Mem: 1011480k total, 226928k used, ....... (4 Replies)
Discussion started by: new2ss
4 Replies

9. UNIX for Dummies Questions & Answers

Merging the PS and TOP output

Hey guys, I'm trying to merge the output from the ps and top commands; since I need the full command used (only showed in the ps), and the cpu usage with some decimal numbers (i.e.: 0.05%, only showed in top). After exporting to different files, I was thinking of doing an egrep with the... (0 Replies)
Discussion started by: EnioMarques
0 Replies

10. UNIX for Advanced & Expert Users

top output

Hi all, below is the output of my 'top' Tasks: 91 total, 2 running, 89 sleeping, 0 stopped, 0 zombie Cpu(s): 3.9% us, 20.5% sy, 0.0% ni, 75.6% id, 0.0% wa, 0.0% hi, 0.0% si Can someone tell me what does us, sy,ni,id,wa,hi,si stands stand for? (4 Replies)
Discussion started by: new2ss
4 Replies
Login or Register to Ask a Question