Top memory processes - capture/logged - Best practices

Latest response

I have some odd memory usage going on with one of my servers. Among other things, we monitor memory usage.
At 2 am and again at 4 am we are seeing free memory drop within the alert threshold range. I am capturing the amount of memory available and sar -r gives all I need and more about the numbers, but I am looking for the best way to capture the associated processes.
I have considered using accounting but concerned with the overhead it brings.
Also, I have checked cron and we don't have anything scheduled on any account during that time frame.

Thoughts, suggestions....

Thanks.

Responses

This is what I am going with, but looking for something a little more elegant.

ps aux | awk '{print $2, $4, $11}' |sort -k2rn | head -n 10 > /home/userid/"ps.$(date +%F_%R)"

Small script i use to monitor the top 10 process memory usage

script to monitor top memory usage

# while true = 0 do date ps axwwo "pid user size rss etime cputime args" | sort -n -k +4 | tail -10 | sort -n -r -k +4 echo '' free -m echo -e '\n\n' sleep 60 done

This will tell you down to the letter what is taking up what:

ps -eo size,pid,user,command --sort -size | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }'

Happy hunting!

Is it right?

ps -eo size,pid,user,command --sort -size | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }'

Here I have a issues

80% of RAM is utilized in free -h and sar -r but in TOP not showing that much utilization .kindly help me to find out.