Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> vmstat output to db
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
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
![]() |
![]() |