[Orca-users] Replay ORCA Graph Data

Ziegenhorn, Eric eric.ziegenhorn at ngc.com
Fri Jul 18 07:25:31 PDT 2003


To collect detailed orca graphs from past data, I take the old orcallator
log file that corresponds to the day in question and modify the log to end
at a given time.  Cutting the logs off at a given time, allows detailed
information about the previous hour to be graphed.  I use a custom
orcallator.cfg file to point to these generically named modified log files
so that I can automate the system, and then I run orca on them.  It is
awkward though because it needs to bunzip the log files before it can grep
through them, so it can take a huge amount of space.  Does anyone have a
better idea?  I'm still somewhat new to shell scripting, but here is what I
came up with:

#!/bin/bash

CFG_DIR=~/lib
TMP_DIR=~/var/tmp/tmp
TMP_FILE=as4362456pdj2iflkwet.235j23

if [ -z $2 ]; then
    echo "Usage: viewlog <logfile> <endtime>"
    echo " Generates metrics information up until <endtime> based on"
    echo " the data in log file <logfile>."
    echo " Generally the format for <endtime> is 'hh:mm:ss'."
    echo " The log file may be uncompressed or compressed with gzip or
bzip2."
    exit 1
fi
if [ ! -d $TMP_DIR ]; then
    echo "Error: the temporary directory '$TMP_DIR' does not exist."
    exit 1
fi


unset decompress
unset ext
if [ -n "`echo $1 | egrep 'bz2$'`" ]; then
    echo "Determining decompressor...bunzip2"
    decompress=bunzip2
    ext=.bz2
fi
if [ -n "`echo $1 | egrep 'gz$'`" ]; then
    echo "Determining decompressor...gunzip"
    decompress=gunzip
    ext=.gz
fi
if [ -z "$decompress" ]; then
    echo "Error: the log file must be compressed with either bzip2 or gzip."
    exit 1
fi
echo
echo Copying...
cp $1 $TMP_DIR/$TMP_FILE$ext
if [ -n "$decompress" ]; then
    echo
    echo Decompressing...
    $decompress $TMP_DIR/$TMP_FILE$ext
fi


echo
echo "Searching log file..."
line=`grep -n $2 $TMP_DIR/$TMP_FILE`
if [ -z '$line' ]; then
    echo "Error: could not find '$2' in $1"
    echo "Exiting..."
    exit 1
fi
linenumber=`echo $line | gawk -F: '{ print $1+1 }'`
if [ $linenumber -lt 2 ]; then
    echo "Error: the specified end time could not be found in the log file."
    echo "Tip:  you may specify only parts of the time as in 18:30: rather
than 18:30:02"
    echo "Try another end time."
    exit 1
fi

echo
echo "Creating new log file..."
gawk "NR < $linenumber" $TMP_DIR/$TMP_FILE > $TMP_DIR/pastlogfile.tmp


echo
echo "Generating database, web pages and graphs..."
echo "This may take several minutes..."
if [ ! -d $TMP_DIR/rrd ]; then
    mkdir $TMP_DIR/rrd
    mkdir $TMP_DIR/rrd/o
fi
orca -o $CFG_DIR/past_orcallator.cfg
rm -rf $TMP_DIR/$TMP_FILE $TMP_DIR/rrd $TMP_DIR/pastlogfile.tmp
echo
echo "Done"
echo "Output is available at /home1/ziegeer/public_html/past/index.html"



-----Original Message-----
From: Mark Goldenberg
[mailto:mgoldenb at mailhost.goldenberg-consulting.com]
Sent: Thursday, July 17, 2003 2:13 PM
To: orca-users at orcaware.com
Subject: [Orca-users] Replay ORCA Graph Data


Is there an easy way to set the clock back in ORCA so that I can replay 
the data collected by RICHPse and orcallator.se so that I can look at 
past data collected in more detail.

Mark G.

_______________________________________________
Orca-users mailing list
Orca-users at orcaware.com
http://www.orcaware.com/mailman/listinfo/orca-users



More information about the Orca-users mailing list