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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Logging a topas/monitor into a file

Status
Not open for further replies.

MoshiachNow

IS-IT--Management
Feb 6, 2002
1,851
IL
Dealing with capturing a system status into a text log file - I'd like to capture 1 topas/monitor/nmon screen into this log.

I need it to look exactly the way it looks on the screen- unformatted,neither for excel or anything else.
Playing with topas/monitor/nmon - did not reach this goal so far.
Would appreciate any ideas.
Thanks

Long live king Moshiach !
 
Hi,

Try this shell script, it will redirect to the logfile all what is printed on your terminal:

LOGFILE=/tmp/topas.txt
if [ -t 1 ]
then
tee $LOGFILE >/dev/tty |&
# rediriger stdout et stderr vers le coprocess
exec 1>&p 2>&1
fi
# start topas here
/usr/bin/topas

Ali
 
Thanks,
but it does not give the required result.
It just keeps the topas running in loop,redirected to my terminal.
I just need one monitor/topas screen in my log.

Long live king Moshiach !
 
if you do this:

(sleep 3; echo q)|topas >/tmp/file

then you can cat that file (ON THE SAME TYPE OF TERMINAL!) and see the topas screen with first set of perf data - generated after 2 s - again and again and again...

The topas output is formatted according to $TERM (escape codes to do cursor positioning in this case).

If you create the file on an ibm315x and cat the file on a VT420 you probably will not get what you want to see...
Although some types of terminal are compatible (eg vtXXX and dtterm).

HTH,

p5wizard
 
Great !thanks.
However,if I then do "cat /tmp/file" on my terminal - it looks fine,just the way I want it.
However,when my ksh script does the same sequence - the output log looks like :

=[?7h[?1l(B=(BTopas Monitor for host: v5EVENTS/QUEUES FILE/TTY

Tue May 3 13:16:56 2005 Interval: 2CswitchReadch
SyscallWritech

Kernel|| ReadsRawin

User|| WritesTtyout

Wait|| ForksIgets

Idle|| ExecsNamei
RunqueueDirblk

Network (BKBPS(BI-Pack O-Pack KB-In KB-Out Waitqueue


What is the catch here with my terminal settings ?
Both tcsh and ksh (used in script) show $TERM = vt100.
Thanks

Long live king Moshiach !
 
hi ,

you can try using the capture command to capture what ever you type to the screen to a file

e.g.

capture

topas

press ctrl -P

exit

the out put will be logged to /tmp/screen.out


the only problem I can see is this is interactive and if you want to use it in a script , you probably have to use something like expect

HTH
 
DSMARWAY,

I did not manage to achieve the goal so far with the above.

plamb,nmon will not create a screen-like output for me,the one I'm after.

Thanks

Long live king Moshiach !
 
Exactly how do you run the ksh script? I tried the following and the output looks reasonable to me

Code:
(sleep 3; echo q)|topas >/tmp/file
cat /tmp/file
echo
echo "--------------------------------------------------------------------------------"

and it displays after 3 seconds:

Code:
Topas Monitor for host:    XXXXXXXX             EVENTS/QUEUES    FILE/TTY
Fri May  6 09:02:19 2005   Interval:  2         Cswitch     895  Readch   818902
Syscall          Writech                                   2952           551975
Kernel    1.2   |                            |  Reads       744  Rawin         0
User      1.9   |#                           |  Writes      505  Ttyout        0
Wait      0.8   |                            |  Forks         4  Igets         0
Idle     95.9   |########################### |  Execs         2  Namei       100
Runqueue         Dirblk                                     1.0              224
Interf   KBPS   I-Pack  O-Pack   KB-In  KB-Out  Waitqueue   1.0
en2      350.5   144.7   259.0     8.6   341.9
fi0        0.7     3.4     0.0     0.7     0.0  PAGING           MEMORY
Faults        600Real,MB     12287
Disk    Busy%     KBPS     TPS KB-Read KB-Writ  Steals        0  % Comp     86.5
hdisk0    1.4    % 7.9     1.9     0.0     7.9                0             14.4
hdisk2    0.9    % 7.9     1.9     0.0     7.9                0              0.5
hdisk66   0.4      3.9     0.4     0.0     3.9               48
hdisk3    0.0    PA0.0     0.0     0.0     0.0              308
hdisk24   0.0    Si0.0     0.0     0.0     0.0               70            16384
% Used                                                                      20.0
kernel   (369548  4.0% PgSp:26.1mb pppppp                                   79.9
topas    (102168  3.8% PgSp: 0.4mb root
dsmserv  (271556  0.7% PgSp:89.9mb root
vserver  (244986  0.5% PgSp: 0.3mb pppppp          Press "h" for help screen.
oracle   (226430  0.5% PgSp: 5.1mb oooooo
syncd    (5000)   0.3% PgSp: 0.1mb root
rsh      (343076  0.3% PgSp: 0.6mb root
rsh      (90456)  0.2% PgSp: 0.6mb root
disp+work(112700  0.2% PgSp:32.6mb pppppp
sh       (343414  0.1% PgSp: 0.3mb root
sh       (316874  0.1% PgSp: 0.3mb root    
--------------------------------------------------------------------------------


HTH,

p5wizard
 
p5wizard ,

It does display properly if I cat the /tmp/file.
However if you vi or "more" this file - you will see the terminal special formating ,which "cat" just does not show.


What I actualy do is redirect the result to a final html log file.Then the special formating does show,bad news ....

Long live king Moshiach !
 
NMONO is an not supported IBM tool. Look with Google for NMON and find more information about this tool. The tool writes information in an file. There is also an script to convert this to an excel file. For Excel there is an analyser tool witch creates graphics.
 
The GNU screen utility does proper (non-control-code) hardcopies. A tour through the suprisingly large manual should provide plenty of means by which to achieve your goal.



Rod Knowlton
IBM Certified Advanced Technical Expert pSeries and AIX 5L
CompTIA Linux+
CompTIA Security+

 
Rod:

I like the idea of using screen.

However, how do you get a regular user to view your root's topas session?

screen -x is almost there, but the regular user has access to root's account :-(

Any ideas?
 
There's a version of nmon which generates csv files usable by wordsheets like Excel to generate graphics or something else ....
I work with nmon v9a and if you execute nmon -h you will get a full explanation
 
Guys,

I do not need an HTML/graphics,I need a plain text topas screen,send to a text log file.
That's exactly what I have failed to achieve so far (see above).
thanks

Long live king Moshiach !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top