Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

TCL(Tool Command Language) Scripting

AIX - monitoring memory and cpu usage?


Are there any examples of scripts written to monitor memory and cpu
usage on AIX(or any flavour of unix)?  I want to migrate my Windows
TWAPI based stuff to AIX and would love to seee some examples.

Patrick Finnegan wrote:
> Are there any examples of scripts written to monitor memory and cpu
> usage on AIX(or any flavour of unix)?  I want to migrate my Windows
> TWAPI based stuff to AIX and would love to seee some examples.

Years ago I wrote some scripts to do this on AIX. I don't have access to
them now, but it basically involved opening a pipe to vmstat and then
reading lines. Use [exec vmstat -S K -s] to get some initial statistics
(total memory, swap etc), and then you can use something like:

set pipe [open "|vmstat -n -S K 2"]
gets $pipe; gets $pipe; gets $pipe ;# discard headers and averages
fileevent $pipe readable [list ReadStats $pipe]
proc ReadStats pipe {
     gets $pipe line
     scan $pipe "%d %d ..." ...

}

You'll have to read the vmstat manpage for more information. The -S K
stuff just sets what units you want output in, and the final "2" is how
many seconds interval between readings.

Alternatively, moodss has almost certainly got modules to do this.

-- Neil

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc