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

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

vmstat output to db

From: David <thump_at_cosmiccooler.org>
Date: Wed, 28 Jul 2004 15:11:36 -0700 (PDT)
Message-ID: <2448.64.37.153.21.1091052696.squirrel@www.cosmiccooler.org>


I'm startign to go bald tryign to figure out how to get this to work. Any insight, suggestions or solution is greatly appreciated. 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
export ORACLE_HOME

SERVER_NAME=`uname -a|awk '{print $2}'`
typeset -u SERVER_NAME
export SERVER_NAME

# sample every 15 minutes (900 seconds) . . . . SAMPLE_TIME=900 while true
do

   vmstat ${SAMPLE_TIME} > /tmp/msg$$

# Note that Solaris does not have a wait CPU column cat /tmp/msg$$|sed 1,3d | awk '{ printf("%s %s %s %s %s %s %s\n", $1, $8, $9, $12, $20, $21, $22) }' | while read RUNQUE PAGE_IN PAGE_OUT SR USER_CPU SYSTEM_CPU IDLE_CPU
   do

      $ORACLE_HOME/bin/sqlplus -s / <<EOF set echo on
set feedback on
set verify on
spool vmstat.log

      insert into perfstat.stats$vmstat
                           values (
                             SYSDATE,

$SAMPLE_TIME,
'$SERVER_NAME',
$RUNQUE,
$PAGE_IN,
$PAGE_OUT,
$SR,
$USER_CPU,
$SYSTEM_CPU,
$IDLE_CPU,
0 ); spool off EXIT

EOF
   done
done
rm /tmp/msg$$

The output to /tmp/msg(pid) gets created fine and I can do the insert fine, but no rows get loaded. "Funny" thing is I had this working at one point, but it stopped inserting after 24 rows and ever since then it seeems to not insert at all...

Cheers

-- 
..
David

----------------------------------------------------------------
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:08:28 CDT

Original text of this message

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