Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AIX topas -M output to file

Status
Not open for further replies.

g28days

Technical User
Aug 5, 2013
2
0
0
AP

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============================================================
====================REF1 SRAD TOTALMEM INUSE FREE FILECACHE HOMETHRD
S CPUS
--------------------------------------------------------------------------------
^[[2A^[[H^[[JTopas Monitor for host: cjdbo2c2 Interval: 2 Sun Aug 4
10:51:54 2013===================================================================
=============REF1 SRAD TOTALMEM INUSE FREE FILECACHE HOMETHRDS CPUS

--------------------------------------------------------------------------------
^[[2A^[[1;75H6



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
FILE=/tmp/filetopas
FILEX=/tmp/filetopasx
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.
servername:/root:>capture
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.,
 

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...
 
chgwat--
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.
 

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”.
[thumbsup2]

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

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

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top