View Single Post
Posts: 13 | Thanked: 5 times | Joined on Nov 2009
#82
ok, then try the following command:

FILE=/path/to/file
watch -n 1 'date >> $FILE ; cat /proc/loadavg >> $FILE;free -m >>$FILE; vmstat >>$FILE; ps -eo pcpu,pmem,vsz,tty,time,stat,pid,user,args --sort -pcpu,-pmem >>$FILE; sync;sync;'

or if you have a ssh session:

watch -n 1 'date ; cat /proc/loadavg;free -m; vmstat ; ps -eo pcpu,pmem,vsz,tty,time,stat,pid,user,args --sort -pcpu,-pmem '


note the sync;sync is to make sure that the log is actually written to the disk this might lower the performance as it will be call regularly.
 

The Following User Says Thank You to fabien For This Useful Post: