LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > AIX
User Name
Password
AIX This forum is for the discussion of IBM AIX.
eserver and other IBM related questions are also on topic.

Notices


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

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


team,


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

#nmon

#m


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.

rgds
shravan
 
Old 11-30-2012, 11:02 AM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
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
cliffordw
Member
 
Registered: Jan 2012
Location: South Africa
Posts: 509

Rep: Reputation: 203Reputation: 203Reputation: 203
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 - http://www.ibm.com/developerworks/wi...e/nmonanalyser
* pGraph - https://www.ibm.com/developerworks/w...kiPtype/pGraph
* nmon2rrd - http://www.ibm.com/developerworks/wi...WikiPtype/nmon
* nmon2web - http://users.ca.astound.net/~baspenc...nmon2rrdv3.htm

Good luck!
 
Old 11-30-2012, 07:39 PM   #4
xj-linux
Member
 
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...

http://pic.dhe.ibm.com/infocenter/ai...kcondition.htm

http://pic.dhe.ibm.com/infocenter/ai...mkcondresp.htm

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

Good luck.
 
  


Reply



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

LinuxQuestions.org > Forums > Other *NIX Forums > AIX

All times are GMT -5. The time now is 09:39 AM.

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