Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


AIX topas -M output to file

AIX topas -M output to file

AIX topas -M output to file



Hi All - I need your help with a AIX script

The outpour of this script will then need to pulled into a HPUX server (I have a for loop here to pull the data for many servers) and further emailed to me.
Oslevel AIX 6.1

I wrote a script in AIX. To output the topas –M (top in HPUX) into a flat file.
But when I more or vi or view the file; it outputs which junk characters like below:

filetopasx (73%)
servername | TOPAS -M MEMORY USAGE
^[[0;10m^[(B^[[H^[[JTopas Monitor for host: servername Interval: 2 Sun
Aug 4 10:51:54 2013============================================================
^[[2A^[[H^[[JTopas Monitor for host: cjdbo2c2 Interval: 2 Sun Aug 4
10:51:54 2013===================================================================


0 0 35.4G 34.5G 947.2 4315.0^[[7C289^[[6C12-15 20-23
^M 1 1 3486.0 3388.2 97.8 35.0^[[8C858^[[6C8-11 16-19
^M 2 2^[[7C0.0^[[6C0.0^[[6C0.0^[[6C0.0^[[10C2

cjdbo2c2 | TOPAS CPU USAGE

When I cat it, no issues.

Topas Monitor for host: servername Interval: 2 Sun Aug 4 10:51:56 2013================================================================================REF1 SRAD TOTALMEM INUSE FREE FILECACHE HOMETHRDS CPUS

0 0 40.1G 34.5G 947.2 4315.0 289 12-15 20-23
1 1 4000.0 3388.2 97.8 35.0 858 8-11 16-19

The following is more or less my script

stty erase ^h intr '^?' -ixany ixoff ixon echoe
export TERM=aixterm
# export TERM=vt100
rm -f $FILE
rm -f $FILEX
touch $FILE
touch $FILEX
chmod 777 $FILE
chmod 777 $FILEX

(sleep 5; echo q)|topas -mM >> $FILE
sleep 2
echo `hostname` "| TOPAS -M MEMORY USAGE" >> $FILEX
cat $FILE | head -`cat $FILE | awk '/CPU/{print NR - 1}' | tail -1` >> $FILEX
sleep 2

Other things I have tried.
1. I have a feeling its an issue with the term. Current term=xterm. I have tried changing it to VT100 and aixterm but to no avail.

2. Or if there are any alternatives to topas-M. I have tried lssrad –av ; but it doesn’t come up with same exact values in topas-M

3. I even tried to use capture – which produced the output that I desired. But I am unable to write a script to parse the “any key” to continue and ^P to capture the screenshot. If there’s a way I wud appreciate it.
Capture command is started. The file is screen.out.
Use ^P to dump screen to file screen.out.
Press any key to continue

You are now emulating a vt100 terminal.
Press Any Key to continue.

4. Also tried to tee the output to a file  same output

Appreciate if you have any ideas.

Thanks and Regards.,

RE: AIX topas -M output to file

What are you trying to do?

If you are looking at capturing performance info, use topaout -a, and nmon_analyzer.

Tony ... aka chgwhat

When in doubt,,, Power out...

RE: AIX topas -M output to file

As mentioned in the 2nd paragrah above, i would like to output the topas –M (top in HPUX) into a flat text file without the junk/format characters (Currently it Displays nonprinting characters as visible characters -probably due to formatting).

The final script i have would need to to pull the data out from many servers not just one and pull out the topas -M output of each server into a single file which will need to be send via email (via cron).
So using nmon analyser would not be feasible.

Any other suggestions besides those that i have mentioned in the "Other things I have tried" paragraph?
Thanks again.

RE: AIX topas -M output to file

For AIX it is better to have OS Watcher generate the files for you, check out:

My Oracle support note “Doc ID: 301137.1 OS Watcher User Guide”.

The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

RE: AIX topas -M output to file

OOoops, sorry. Got carried away with Oracle.
If you do not have Oracle, you may not be able to use these scripts.

The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close