Run nmon on other server through script

Hai All,

Iam new to AIX unix. Im just tryin to automate my monitoring work and hence i have writen a basic script in which i am running nmon on multiple nodes from a main node.

say for ex: From server a :

ssh server b nmon -MB -s1 -c1 > nmon_now.txt

gave the password and result I got was

unknown Terminal is Unknown.

Whats going on. Can some one help me plz. I am egar to know what mistake im doing.
Please correct me.

Warm Regards,
Jayadeava

Hello,

This is happening because your are using nmon in interactive mode switch it to make something like one snapshot for 1 second and exit (check nmon -h).

1 Like

Thanks for the replay.
I have tried creating a script on server B which included as

export NMON=m
 
nmon -MB -s1 -c1 > nmon_now.txt

a=`grep -b Paging nmon_now.txt | awk '{print $12}' | cut -c 1-4`
b=`grep -b File nmon_now.txt | grep -v pages/sec | awk '{print $13}' | cut -c 1-4`
c=`grep -b Scans nmon_now.txt | awk '{print $10}' | cut -c 1-4`
d=`grep -b Cycles nmon_now.txt | awk '{print $8}' | cut -c 9-11`
e=`echo " $b + $c + $d " | bc`

echo " % Comp    = " $e
echo " % Noncomp = " $a
echo " % Client  = " $a

then I ran

ssh server B /home/asdf/above_script.sh

passwd given
it excuted that script on server B but i got null value as a result.

warm regards,
Jayadeava

Sorry for asking but currently I don`t have access to any AIX node(will have later this week) so I cannot test it but:

Does

ssh server_B 'nmon -MB -s1 -c1' 

work normal?

If it works normal try to execute the script in debug mode/ run it locally to test it out - output will be helpful.

note: for ksh you can put

In the beginning of you script or use

ssh server_b  'ksh -x /home/asdf/above_script.sh'

A couple of things to think about:

Run nmon or 24 hours on a node. Use something like:

$NMON_EXECUTABLE -F $WORK_DIR/$NMON_LOG_FILE -s $DELAY -c $COUNT

Run the above from cron, with:
/home/unxsa/bin/collect_nmon_perf_data 898 96

DELAY=898 COUNT=96

Then use nmon analyzer to produce reports.

This doesn't give you instant monitoring of course.

IIRC you start nmopn in daemon mode with the "-F" parameter. Without it nmon will always come out in interactive mode, regardless of where you direct its output.

I hope this helps.

bakunin

1 Like

Thanks every one for valuable inputs and ideas... Of course its helpfull

Warm Regards,
Jayadeava

Just to finish up

your script should use

nmon -F nmon_now.txt -MB -s1 -c1

thanks to bakunin for the clarification :slight_smile: