Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> vmstat to perfstat
I'm having issue with writing vmstat output to the perfstat account and
would like some advice, or better ideas in how to do this:
It appears to work just fine, but then eventually it contines to write top /tmp, but not to the database.
get_vmstat_solaris.ksh:
#!/usr/bin/ksh
# First, we must set the environment . . . . #ORACLE_SID=ahap #export ORACLE_SID #ORACLE_HOME=/u01/app/oracle/product/8.1.7 #export ORACLE_HOME #PATH=$ORACLE_HOME/bin:$PATH #export PATH
for SID in $1
do
cd /m1/homes/oracle
. ./$SID
SERVER_NAME=`uname -a|awk '{print $2}'`
typeset -u SERVER_NAME
export SERVER_NAME
# sample every 15 minutes (900 seconds) . . . .
SAMPLE_TIME=300
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 "/ as sysdba" <<EOF insert into perfstat.stats\$vmstat values ( SYSDATE,
$SAMPLE_TIME,
'$SERVER_NAME',
$RUNQUE,
$PAGE_IN,
$PAGE_OUT,
$SR,
$USER_CPU,
$SYSTEM_CPU,
$IDLE_CPU,
0 ); EXIT
rm /tmp/msg$$
done
-- .. 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 Mon Jul 26 2004 - 13:26:32 CDT
![]() |
![]() |