Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Other *NIX Forums > AIX
User Name
AIX This forum is for the discussion of IBM AIX.
eserver and other IBM related questions are also on topic.


  Search this Thread
Old 11-29-2012, 03:49 AM   #1
Registered: Sep 2009
Posts: 84

Rep: Reputation: 15
Post how to wrte a shell script for nmon command


in the aix os, I would like to write a script for memory usage.



are the commands that i use to view the memory statistics.

But im not sure how to proceed ahead for usage reaching 90% or free memory reaching to 100MB.

kindly help. thi si something like monitoring script for performance.

Old 11-30-2012, 11:02 AM   #2
David the H.
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian + kde 4 / 5
Posts: 6,837

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
You are going to have to explain what you want in more detail. Since most of us here don't have access to AIX, you should provide an example or two of the output of those tools, what you need to get from them, and how the output needs to be formatted.

Most likely what you want can be done with a simple awk script, but it all depends on the details.

I would also start by checking the documentation on those programs and seeing if they can be configured to output only the data you want from them, or at least give it easily parseable formatting.
Old 11-30-2012, 11:13 AM   #3
Registered: Jan 2012
Location: South Africa
Posts: 501

Rep: Reputation: 189Reputation: 189
Hi there,

Your question is a little unclear. Are you trying to monitor when memory usage reaches those levels, and then perform some action (an alert email or something)?

Firstly you need to keep in mind that AIX automatically uses memory which is not used for computational work, as filesystem cache. It is therefor very common to see high overall memory usage at close to 100%, without any issues as a result of this. To monitor for problems you will therefore have to look at more than just total memory used. You need to look at the computational vs file/client memory separately, and also need to look at paging activity (both paging space usage and number of paging space IOs).

For scripting purposes a good starting point might be too look at the "svmon" command rather than nmon (assuming you are running nmon interactively).

If you want to just track memory usage over time, and report on it, your best bet is probably to run "nmon -x" to collect the data, and then graph it with one of the following tools:
* nmon analyzer -
* pGraph -
* nmon2rrd -
* nmon2web -

Good luck!
Old 11-30-2012, 07:39 PM   #4
Registered: Feb 2006
Location: Minnesota
Distribution: SUSE - AIX
Posts: 30

Rep: Reputation: 2
Not sure what you want to do with memory monitoring. I assume since you call out 90% used or 100MB free, you want something that sends an alert when the thresholds are met. In that case, I'd suggest noodling around with AIX's mkcondition and mkcondresp commands. You can basically create a mechanism that will, for example, use sendmail to alert you when an OS related condition is met such as the amount of memory usage, CPU utilization, paging space filling up, etc...

Here's some light reading for AIX 6.1...

(You can substitute v5r3 or v7r1 in the URLs above for other OS level versions of the commands)

Good luck.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell script, Perl script, command or utility to convert Binary to text Perseus Programming 26 07-12-2012 06:00 AM
How to pass command line arguments from one shell script to another shell script VijayaRaghavanLakshman Linux - Newbie 5 01-20-2012 09:12 PM
Using shell command output as input in shell script - how to do? EnderX Linux - Newbie 2 06-30-2010 12:46 PM
command with shell script sunlinux Programming 2 12-28-2006 11:36 PM > Forums > Other *NIX Forums > AIX

All times are GMT -5. The time now is 08:01 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration