BB Unix Network Monitor - Message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: {bb} Anyone got a valid 'top' equivalent for AIX?



And this looks pretty good as well -- thanks, Stuart.

Tom

-----Original Message-----
From: owner-bb@bb4.com [mailto:owner-bb@bb4.com] On Behalf Of
stuart.macintosh@countryenergy.com.au
Sent: Monday, January 31, 2005 4:03 PM
To: bb@bb4.com
Subject: Re: {bb} Anyone got a valid 'top' equivalent for AIX?





Paul,

I modified Rob Verduijn's script to get "top" details.

Hope this helps.

Stuart.


#!/bin/sh

#
# BigBrother script adapted from Rob Verduijn's pcpu.sh. script version
1.07
# and modified by Stuart Macintosh for CE environment. 17/06/04.
#


#
# BBPROG SHOULD JUST CONTAIN THE NAME OF THIS FILE
# USEFUL WHEN YOU GET ENVIRONMENT DUMPS TO LOCATE
# THE OFFENDING SCRIPT...
#
BBPROG=bb-ps.sh; export BBPROG

#
# TEST NAME: THIS WILL BECOME A COLUMN ON THE DISPLAY
# IT SHOULD BE AS SHORT AS POSSIBLE TO SAVE SPACE...
# NOTE YOU CAN ALSO CREATE A HELP FILE FOR YOUR TEST
# WHICH SHOULD BE PUT IN www/help/$TEST.html.  IT WILL
# BE LINKED INTO THE DISPLAY AUTOMATICALLY.
#
TEST="ps"

if test "$BBHOME" = ""
then
        echo "BBHOME is not set... exiting"
        exit 1
fi

if test ! "$BBTMP"                      # GET DEFINITIONS IF NEEDED
then
        . $BBHOME/etc/bbdef.sh          # INCLUDE STANDARD DEFINITIONS
fi

# SELECT SOME LEVELS... GREEN IS THE DEFAULT...
WARN="90"       # GO YELLOW AT THIS LEVEL
PANIC="98"      # GO RED AND PAGE AT THIS LEVEL
MAXCPU="0"
DEFUNCT="0"

case $BBOSTYPE in
        redhat )
                #$PS -eo
pcpu,pmem,pid,ppid,state,user,stime,etime,time,args | $SORT -r -n | $SED
'1d' | \
                ps -eo
pcpu,pmem,pid,ppid,state,user,stime,etime,time,args
--cols 150 \
                | grep -v "%CPU" | sort -r -n | sed -n '1,15p' >
/tmp/OUTPUT.$$

                ;;
        aix )
                ps -e -o
pcpu,pmem,pid,ppid,state,user,stime,etime,time,args | grep -v "%CPU" |
sort
-r -n | \
                awk '{ if ( $6 ~ /<defunct>/) {DEFUNCT++ ; } else { if (
$1
~ /^[0-9]/ && $2 !~ /-/ ) {print $0 }}}' |sed -n '1,15p' >
/tmp/OUTPUT.$$
                echo  "" >> /tmp/OUTPUT.$$
                echo  "There are $DEFUNCT defunct processes." >>
/tmp/OUTPUT.$$
                ;;
        * )
                $PS -eo pid,ppid,uid,time,etime,stime,pcpu,comm,args |
$SORT -r +3 | $SED '1d' | \
                $SED -n '1,15p' > /tmp/OUTPUT.$$
                ;;
esac

MAXCPU=`sed  -n '1,1p' /tmp/OUTPUT.$$| awk '{ print int($1) }'`
MAXPROCESS=`sed  -n '1,1p' /tmp/OUTPUT.$$| awk '{ print $10 $11 }'`


if test -s "/tmp/OUTPUT.$$"                     # IF WE HAVE OUTPUT...
then
        #
        # DETERMINE RED/YELLOW/GREEN
        #
        if test "$MAXCPU" -ge "$PANIC"
        then
                COLOR="red"
        elif test  "$MAXCPU" -ge "$WARN"
        then
                COLOR="yellow"
        else
                COLOR="green"
        fi
else
        COLOR="clear"
fi

# AT THIS POINT WE HAVE OUR RESULTS.  NOW WE HAVE TO SEND IT T
BBDISPLAY.

LINE="status $MACHINE.$TEST $COLOR `date`

The top 15 cpu time consuming processes :

%CPU %MEM   PID  PPID S USER     STIME     ELAPSED     TIME COMMAND
`cat /tmp/OUTPUT.$$`

Process $MAXPROCESS is consuming $MAXCPU percent of cpu time.
"
$RM -f /tmp/OUTPUT.$$

# NOW USE THE BB COMMAND TO SEND THE DATA ACROSS
$BB $BBDISP "$LINE"                     # SEND IT TO BBDISPLAY




-------------------------------------------------------------------

Stuart Macintosh
Unix System Administrator. Port Macquarie
Ph: (02) 65898427 Mobile: 0419440570

--------------------------------------------------------------------


 

             "PAUL WILLIAMSON"

             <pwilliamson@mand

             tbank.com>
To 
             Sent by:                  bb@bb4.com, KauffmanT@nibco.com

             owner-bb@bb4.com
cc 
 

 
Subject 
             01/02/2005 06:59          Re: {bb} Anyone got a valid 'top'

             AM                        equivalent for AIX?

 

 

             Please respond to

                bb@bb4.com

 

 





How about top?  I have it on my AIX 5.1 machines.  I grabbed
it from the IBM/Linux toolkit.

Paul

>>> KauffmanT@nibco.com 1/31/2005 2:43:02 PM >>>


We had a situation this weekend where one of our most important
systems
went massively busy for about 3 hours. So busy that a root crontab
script that runs every 15 minutes took 14 minutes to start -- and it's
a
1-line shell script that echos a row of '===' and the date/time to
/dev/console.

Nothing left any tracks. The BB updates were sparse and sporadic, with
lots of purples.

Now I'm looking to add the 'top' display to the cpu report -- but I
can't find ANYTHING for the AIX environment that doesn't need two or
three cycles to build a curses-mode display. Monitor and nmon at least
know how to run for a specific count and quit; IBM supplies topas as
an
equivalent, and it needs to be directed to stop.

Nmon in 'file' mode generates too much exteraneous material and I
don't
really feel like parsing the csv format.

So -- is anyone out there using anything on AIX to simulate 'top -n1'?

TIA

Tom Kauffman

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=
To unsubscribe from this list, or to subscribe to the bb-digest list
send e-mail to mailto:majordomo@bb4.com with unsubscribe bb -and/or-
subscribe bb-digest in the BODY of the message.


--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=
To unsubscribe from this list, or to subscribe to the bb-digest list
send e-mail to mailto:majordomo@bb4.com with unsubscribe bb -and/or-
 subscribe bb-digest in the BODY of the message.


########################################################################
#############
This message is intended for the addressee named and may contain
confidential 
information. If you are not the intended recipient, please delete it and
notify the
sender. Views expressed in this message are those of the individual
sender, and are 
not necessarily the views of Country Energy.
########################################################################
#############
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=
To unsubscribe from this list, or to subscribe to the bb-digest list
send e-mail to mailto:majordomo@bb4.com with unsubscribe bb -and/or-
subscribe bb-digest in the BODY of the message.

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=
To unsubscribe from this list, or to subscribe to the bb-digest list
send e-mail to mailto:majordomo@bb4.com with unsubscribe bb -and/or-
subscribe bb-digest in the BODY of the message.


Home | Main Index | Thread Index