AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
#Power
 View Only
  • 1.  Ask for a shell script

    Posted Thu March 25, 2010 11:33 PM

    Originally posted by: tttttttttttt


    I want to draw a graph about the use of total physical memory and virtual memory in a period of time every some interval. So I want to extract some data from the output of svmon -G command. What I want to extract is inuse memory and inuse pg space and layout will be like this as columns:

    530344 28813
    .. ..
    .. ..
    .. ..
    instead of
    530344
    28813

    Then I may load the text file to excel and draw a graph according the two columns. Could you please help to compose the
    script? Or any other good idea to do this?
    1. svmon -G
    size inuse free
    memory 3342336 530344 2881640 34
    pg space 131072 28813

    work pers clnt o
    pin 172660 0 0 17
    in use 488799 0 41545

    PageSize PoolSize inuse pgsp
    s 4 KB - 260408 28813 21
    m 64 KB - 16871 0
    #AIX-Forum


  • 2.  Re: Ask for a shell script

    Posted Fri March 26, 2010 12:35 AM

    Originally posted by: tttttttttttt


    I also want to add the process numbers for some specific process during the period to the report . I may get the process number with this command.Here the number of java process is 1.

    bash-3.00# ps -e|grep java|wc
    1 4 26
    So the report willl look like this:

    533177 28808 1
    .. .. ..
    .. .. ..
    #AIX-Forum


  • 3.  Re: Ask for a shell script

    Posted Fri March 26, 2010 09:44 AM

    Originally posted by: j.gann


    if you search for help on shell scripting, the readers of newsgroup comp.unix.shell are generally quite responsive.

    don't expect them to write your whole script though.
    #AIX-Forum


  • 4.  Re: Ask for a shell script

    Posted Fri March 26, 2010 11:18 AM

    Originally posted by: SystemAdmin


    I might be wrong but I think nmon does this.
    #AIX-Forum


  • 5.  Re: Ask for a shell script

    Posted Sun March 28, 2010 04:49 AM

    Originally posted by: tttttttttttt


    Thanks for the reply. I have got the script done and also it seems working well.

    memory.sh:

    m=`svmon -G | awk '{ if ($1=="memory") my=$3; else {if ($1=="pg") my=my" "$4};
    if($1=="pg") print my }'`
    s=`ps -e|grep "java" |wc | awk '{print $1}'`
    echo "$m $s" >> /tmp/memory.out
    I use another shell to do timing execution using a infinite loop and sleep:

    while true
    do
    /memory.sh
    sleep 2
    done

    Feel free to give your advice if you do not think it is ok.
    Also I had tried nmon. It is really a good way especially integrated with nmon analyzer. But my requirement is some what special( need the number of java process every 2 seconds). So just the script can do that.
    #AIX-Forum