Load spike

Hi,

I would try to find out the load spike of memory utilization in the Servers before 2-3 hours ago., As the alerts are being triggering out by the altering system. I try to find out the utilization via the sar command, but how come I know which user and command is consuming more of memory utilization by the time.

i guess `prstat` can give your result

Hi,

If the server is not actually under load, you will find it difficult to determine what user was working and what command that they were using. Trying to find what was happening "2-3 hours ago." will be better accomplished by looking at the "alerting system" logs.

Regards

Dave

Hi Kg_gaurav,
Thanks for your update. its a RHEL machine.

Hi Dave,
The alerting system just triggers the alert that memory is high and its doens't have the capability to fetch which user it is.

Can this be done using a shell script when memory and cpu increases using top and free commands ?

-Siva

Hi,

Yes, there are several options for this. It does to some extent depend on what the monitoring software does, but you can use something like this.

!#/bin/bash
######################################################################################
#
# Memory use for Centos per user.
#
######################################################################################
(echo "user rss(KiB) vmem(KiB)";
 for user in $(users | tr ' ' '\n' | sort -u); do
   echo $user $(ps -U $user --no-headers -o rss,vsz \
     | awk '{rss+=$1; vmem+=$2} END{print rss" "vmem}')
 done | sort -k3
) | column -t

Regards

Dave

Hi Dave,

Thanks for your update..
Later I am thinking like if the ram utilization is less than 300M and the load average is more then 4.00 , should take all the top users of memory and CPU utilization through "top" and "ps " command and put under one path.

-Siva

Moderator comments were removed during original forum migration.