Results 1 to 3 of 3

Thread: Script for performance monitoring

  1. #1
    Junior Member
    Join Date
    Jul 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default Script for performance monitoring

    I'm looking for a script which send me an email whenever the over all cpu/disk/memory usage is going high and i also need the top 20 process list info at the time of load.

    My OS is HPUX 11iv2.

    If there is no script, is there any other way i can achieve this?
    Regards,
    K@rth!k.

  2. #2
    Senior Member
    Join Date
    Aug 2011
    Posts
    406
    Thanks
    0
    Thanked 57 Times in 53 Posts
    Rep Power
    9

    Default

    hi,

    shell to monitor CPU usage...

    there are probably much more examples, stfw; it's a common request.
    A problem clearly stated is a problem half solved.

  3. #3
    Senior Member Rahul.Patil's Avatar
    Join Date
    Feb 2012
    Location
    Mumbai india
    Posts
    485
    Thanks
    10
    Thanked 49 Times in 46 Posts
    Rep Power
    8

    Default

    Hi,

    Here is usable function, you can create your script using them
    Code:
    function GetTopProcess() {
    
            ps --no-headers -eo "%cpu,%mem,cmd,etime" |
            sort -t. -k1 -r |
            head -10
    }

    PHP Code:
    function CheckLoadadv() {

            
    # Set threshold value
            
    local Threshold=$1
            
    # if threshold not specify then take deafault 6
            
    (( $Threshold )) || Threshold=6
            
    # get input values from /proc/loadavg file
            
    local   Current_loadadv="$(cut -d" " -f1 /proc/loadavg )"
            
    # take first value from inputdata
            
    local Cur_int_loadadv="${Current_loadadv/.*}"

            
    if (( $Cur_int_loadadv >= $Threshold )); then

                    
    return 1
            
    else

                    return 
    0

            fi


    PHP Code:
    function CheckSpace() {

    local Partition=$1
    awk 
    -v p=$Partition 'BEGIN{
      threshold=80
      cmd = "LC_ALL=C df -Ph "p
      while( cmd | getline ) {
     
        used=$5 # Usage in % of 5th colume
     
        if ( $1 != "Filesystem" && int(used) >= threshold ) {
       
          exit 1
     
         }
       }
     }'

    Reference Link https://gist.github.com/rahulinux
    Last edited by Rahul.Patil; 4th September 2013 at 11:15 AM.
    Rahul Patil <http://www.linuxian.com>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Process monitoring script
    By K@rth!k in forum HP-UX
    Replies: 0
    Last Post: 2nd September 2013, 03:54 PM
  2. Replies: 5
    Last Post: 20th June 2013, 06:11 PM
  3. script for application runtime limiting and monitoring
    By sbahadur in forum Shell scripting
    Replies: 0
    Last Post: 2nd April 2013, 02:43 PM
  4. Shell script for monitoring a list of IP's
    By Haru_linux in forum Shell scripting
    Replies: 5
    Last Post: 17th September 2010, 11:01 AM
  5. performance monitoring with example
    By ghpradeep in forum CentOS / RHEL / Fedora
    Replies: 1
    Last Post: 19th May 2008, 11:12 PM

Posting Permissions

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