Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, Here is a simple shell script to check total CPU and Memory consumption by Linux Servers. #!/bin/bash echo "`date +"%D %T"` `ps aux | awk '{sum +=$3}; END {print ...
  1. #1
    Just Joined!
    Join Date
    Jul 2011
    Posts
    0

    Shell script to check total CPU and Memory consumption

    Hi,

    Here is a simple shell script to check total CPU and Memory consumption by Linux Servers.

    #!/bin/bash
    echo "`date +"%D %T"` `ps aux | awk '{sum +=$3}; END {print sum}'`" >> /tmp/cpu_`date +"%I%d%Y"`
    echo "`date +"%D %T"` `ps aux | awk '{sum1 +=$4}; END {print sum1}'`" >> /tmp/mem_`date +"%I%d%Y"`

    Script proves very handy when we need to check the CPU or Memory peak values. Just run it in cron for 1 min interval and you will start getting the values in text files from where you can figure out the peak values at a given point of time.

    Thanks,
    Team nixSupport

  2. #2
    Linux Guru Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    2,091
    No offence, but why not go for a more complete monitoring solution like xymon, nagios, etc?
    You must always face the curtain with a bow.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •