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 :wink:

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...

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 :wink:

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

thanks,

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?

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

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.

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???

Just wondering the value under LOAD... Is this a percentage? There's no % sign??