• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 766
  • Last Modified:

Script to display load average on HPUX 11 Itanium 4 CPU system

I know in Linux you can use a perl script to display the load average for different CPU's.  What I'd like to do is write a simple script without perl to do a constant running average of each CPU's load and an overall average of the load.  Is there a quick / simple script I can use to do this?
1 Solution
Um - what's wrong with "top" or "sar" ?
16582Author Commented:
to displays all running / sleeping processes... I just want the CPU load(s). top is fine for info but I don't need all of the other info..  I'm currently running an automatic archiver daemon and it tends to spike CPU load when it kicks on.  I just want to monitor the CPU(s).
Did you try "uptime"?

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

sh -c "while [ 1 ]; do w; sleep 3;done"
16582Author Commented:
The Current listing for top shows CPUs 0-3 and the average load/user/nice/sys/idle.  To be more specific; the overall average is nice to know but I'd like to see the individual CPU(s)  load/user/sys/ and idle.  Everything else is secondary and I can use top for that but, I just need to display the individual CPUs and their respective loads for the above output. Example Below:

0      2.09    24.1%  34.6%   41.3%
1      2.06    27.5%  36.0%   36.6%
2      1.67    56.5%  20.2%   29.7%
3      1.92    62.6%  19.6%   17.8%
avg   1.93    42.8%  27.5%   29.7%

Not required bu nice would be the current memory load and free..

Now, I know that the top command displays this but, I am in an environment that requires some of our system users to run/monitor system settings.  I would just like to output these variables real time for the users that need the information.  They get a bit confused seeing 8 to 9 pages of information for top.  

To make it simpler, can the top command be modified to just display this info?  I've looked in the man pages and can see how to modify the out put per CPU but not all at once.


top handles SMP just fine, so I suspect a 4-way will also give indivdual lines.

Create .toprc:

$ cat .toprc
RCfile for "top with windows"           # shameless braggin'
Id:a, Mode_altscr=1, Mode_irixps=1, Delay_time=3.000, Curwin=1
Def     fieldscur=AEHIOQTWKNMbcdfgjplrsuvyzX
        winflags=9520, sortindx=10, maxtasks=0
        summclr=1, msgsclr=1, headclr=3, taskclr=1
Job     fieldscur=ABcefgjlrstuvyzMKNHIWOPQDX
        winflags=9524, sortindx=0, maxtasks=0
        summclr=6, msgsclr=6, headclr=7, taskclr=6
Mem     fieldscur=ANOPQRSTUVbcdefgjlmyzWHIKX
        winflags=62768, sortindx=13, maxtasks=0
        summclr=5, msgsclr=5, headclr=4, taskclr=5
Usr     fieldscur=ABDECGfhijlopqrstuvyzMKNWX
        winflags=62768, sortindx=4, maxtasks=0
        summclr=3, msgsclr=3, headclr=2, taskclr=3

And run:

$ top -n 1 -b
Tasks:  63 total,   3 running,  60 sleeping,   0 stopped,   0 zombie
 Cpu0 :  1.9% us,  1.2% sy, 93.8% ni,  3.0% id,  0.0% wa,  0.1% hi,  0.1% si
 Cpu1 :  1.0% us,  1.0% sy, 93.6% ni,  4.4% id,  0.0% wa,  0.0% hi,  0.0% si


Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now