Visit Our UNIX and Linux User Community


how to log top command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to log top command
# 1  
Old 11-13-2002
how to log top command

i have an HPUX box in the office, as my daily routine i always check the load on my servers. i use the "top" command to see that. i would like to create a log file out of it so i can make it run once a day and check the logs. the problem is that the "top" command is like the "tail -f" command where it constantly updates. how can i make this work? i looked at the threads for "terminating tail" but the replies seems not applicable.

thanks Smilie
inquirer
# 2  
Old 11-13-2002
Check the man page for top - on most systems I've seen, there is an option for when it's supposed to go out to file...
# 3  
Old 11-15-2002
thank you...

it seems that some questions requires simple answers. if you have a question it would be best if we consult the man pages first before posting. how silly of me... thanks livinfree for reminding me Smilie

the "top" command with the option "d" should do the trick, and direct it to a filename.

thanks,
inquirer
# 4  
Old 11-15-2002
I have tried that with the standard HP-UX version of top and I just get a mess in the output file. Is this working for you? What version of top and HP-UX are you using? And what is your TERM variable set to?
# 5  
Old 11-15-2002
Perderabo,

I am running 11.0 with term of vt320. I think top is the standard version for my host.
HP-UX myhost B.11.00 A 9000/800 624339393 two-user license

I used this command.

top -h -d 1 -f file.top

My output was this.

# cat file.top
Load averages: 0.21, 0.22, 0.24
657 processes: 638 sleeping, 18 running, 1 zombie
Cpu states: (avg)
LOAD USER NICE SYS IDLE BLOCK SWAIT INTR SSYS
0.21 14.2% 0.0% 0.8% 85.0% 0.0% 0.0% 0.0% 0.0%
Memory: 2327724K (972304K) real, 2098712K (937484K) virtual, 24059800K free Pa2

CPU TTY PID USERNAME PRI NI SIZE RES STATE TIME %WCPU %CPU COMMAND
4 ? 22458 oracle 231 20 1511M 197M run 55:13 100.15 99.98 oracletcoe
1 ? 27456 oracle 152 20 203M 162M run 228:56 2.97 2.97 native_th
7 ? 782 root 154 20 1544K 128K sleep 546:04 1.49 1.49 syncer
6 ? 39 root 152 20 1856K 0K run 74:17 1.27 1.27 vxfsd
7 ? 22736 oracle 154 20 1316M 2864K sleep 0:39 0.91 0.91 oracletcone
3 ? 399 applmgr 154 20 401M 5328K sleep 2:10 0.73 0.73 oraclecfas1
0 ? 1805 applmgr 156 20 428M 3736K sleep 1:12 0.58 0.57 ora_snp0_C1
7 ? 3 root 128 20 32K 0K sleep 130:05 0.43 0.43 statdaemon
0 ? 1327 oracle 156 20 1331M 13104K sleep 2:18 0.42 0.42 oracletcone
3 ? 11620 applmgr 154 20 397M 2096K sleep 15:28 0.34 0.34 oraclecfas1
3 ? 6607 patrol 154 30 25836K 21828K sleep 869:15 0.34 0.34 PatrolAgent
3 ? 14314 applmgr 156 20 423M 27788K sleep 44:15 0.30 0.30 ora_qmn0_c1
1 ? 11810 applmgr 154 20 397M 1984K sleep 47:54 0.26 0.26 oraclecfas1
0 ? 27120 applmgr 154 20 399M 3248K sleep 0:01 0.24 0.24 oracleCFAS1
1 ? 22706 applmgr 154 20 398M 2144K sleep 2:37 0.23 0.23 oracleCFAS1
5 ? 6889 root 152 20 35912K 13016K run 15:12 0.22 0.22 mxagent

Last edited by Kelam_Magnus; 11-18-2002 at 12:49 PM..
# 6  
Old 11-15-2002
Kelam_Magus, yes that works for me too! But how did you know about the -f option? It's not on my man page! Anyway that -f option seems to be the key.
# 7  
Old 11-18-2002
I don't know.

I see it in my man page on both 11.0 and 11i and on the command line with a bogus option to get the usage error which shows all the options.

For 11.i, these are the options for top.

# top -xxx
top: illegal option -- x
Usage: top [-u] [-q] [-P] [-dx] [-sx] [-p pset_id] [-n number] [-f filename]

***************
Here are my 11.0 options for top.

# top -xxx
top: illegal option -- x
Usage: top [-u] [-q] [-dx] [-sx] [-n number] [-f filename]

Maybe it is a patch thing???

Previous Thread | Next Thread
Test Your Knowledge in Computers #111
Difficulty: Easy
The Unix version with the largest installed base in 2019 is macOS.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Top command

Hi All, i am using the below command and once get the output and i need to keep the first batch only.in this case how to do this one. please help me on thistop -b -n 5 >top.txt Thanks, (3 Replies)
Discussion started by: bmk
3 Replies

2. Shell Programming and Scripting

Help with top command

Currently when i run top command i get the following columns . CPU TTY PID USERNAME PRI NI SIZE RES STATE TIME %WCPU %CPU COMMAND In this how to remove '%WCPU' column ? Thanks very much in advance . (6 Replies)
Discussion started by: kpravinraj
6 Replies

3. Shell Programming and Scripting

Command to find the Memory and CPU utilization using 'top' command

Hi all, I found like top command could be used to find the Memory and CPU utilization. But i want to know how to find the Memory and CPU utilization for a particular user using top command. Thanks in advance. Thanks, Ananthi.U (2 Replies)
Discussion started by: ananthi_ku
2 Replies

4. AIX

Top command in AIX 4.2 (no topas, no nmon, no top)?

Is there a 'top' command equivalent in AIX 4.2 ? I already checked and I do not see the following ones anywhere: top nmon topas (1 Reply)
Discussion started by: Browser_ice
1 Replies

5. Shell Programming and Scripting

Top command

Hi , can some one please assist me in using top command im facing following after using top: # top -hv UX:sh (top): ERROR: top: syntax error at line 1: `(' unexpected # top -p UX:sh (top): ERROR: top: syntax error at line 1: `(' unexpected thanks in advance (3 Replies)
Discussion started by: NIMISH AGARWAL
3 Replies

6. Solaris

top command

Hi, How to install software package top in solaris, (4 Replies)
Discussion started by: manoj.solaris
4 Replies

7. SCO

HP-UX top command

Is there a command in SCO Unix that does the same as the top command in HPUX. The command displays the jobs using the most system resources. Thanks You (0 Replies)
Discussion started by: joestrosser
0 Replies

8. Solaris

top command

Hi I want to know how can I enable the command top in Solaris plataform. Thanks (1 Reply)
Discussion started by: llopez_hernande
1 Replies

9. UNIX for Dummies Questions & Answers

top command

hi guys, i am having a dual cpu xeon machine. i came to know that i can view the performance by giving top command. but top command shows only the usage of one cpu in percentage while the process are using more than 100% usage in the list . can i know separately the usage of cpus. can you... (5 Replies)
Discussion started by: bijuhpd
5 Replies

10. UNIX for Dummies Questions & Answers

command --> top

I understand the numbers displayed in variable "load average". My question: what are the correct/ideal numbers? Sometimes, I got less than 1. Others, above 6. Also, what HW/SW should I tune in order to have the ideal numbers? Thank you ... (1 Reply)
Discussion started by: dgromerog
1 Replies

Featured Tech Videos