Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: vmstat output to db

Re: vmstat output to db

From: <Jared.Still_at_radisys.com>
Date: Wed, 28 Jul 2004 15:49:15 -0700
Message-ID: <OF1BEB05F5.9D8324B3-ON88256EDF.007BEC49-88256EDF.007D5D03@radisys.com>


Comments inline:
> I'm startign to go bald tryign to figure out how to get this to work.
Any
> insight, suggestions or solution is greatly appreciated.

Please accept this $50.00 coupon from Jared's Wig and Toupee Emporium.

> I'm simply trying to run vmstat on an interval, send the output to a
file
> and then load the contents of that file into the database to be reported
> against:
> #!/usr/bin/ksh
>
> # First, we must set the environment . . . .
> export ORAENV_ASK=NO
> ORACLE_SID=SDTEST01
> export ORACLE_SID
> . oraenv SDTEST01

This should be $ORACLE_SID rather than SDTEST01. Just a matter of form.

> export ORACLE_HOME

No need to do this. oraenv does it.

>
> SERVER_NAME=`uname -a|awk '{print $2}'`

uname -n would negate the need for awk

> typeset -u SERVER_NAME
> export SERVER_NAME
>
> # sample every 15 minutes (900 seconds) . . . .
> SAMPLE_TIME=900
>
> while true
> do
> vmstat ${SAMPLE_TIME} > /tmp/msg$$

Here's where you run into trouble.

vmstat <N> runs forever, at an interval of N.

ie. the rest of your script never runs.

You may want to try something along these lines:

FILE=/tmp/test$$.vmstat

vmstat 1 > $FILE &

tail -f $FILE | while read line
do

        ( egrep -v "procs|cache") && {
                echo $line
        }

done

This starts vmstat in the background.

tail -f will continue to read the file as it grows.

The egrep filters out the text lines.

A construct such as this would be more efficient:

tail -f $FILE | egrep -v "procs|cache" | while read line do

    echo $line
done

... but I got tired of waiting for the buffer to fill.

Jared



Please see the official ORACLE-L FAQ: http://www.orafaq.com

To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
Received on Wed Jul 28 2004 - 17:45:57 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US