Wednesday, March 5, 2008

Dumping data from the TEC Database with WTDUMPRL

One of the more common tasks is dumping received events from TEC to a flat file for archiving. Here is an example:

To do straight reception log dumps, consider using a script like this one that I run all the time. This script will dump all events from the reception log to a file named with the date and then perform a clear of the TEC database.

#!/bin/sh
. /etc/Tivoli/setup_env.sh
LOGFILE=/usr/local/Tivoli/custom/logs
dat=`date +"%m%d%Y" `
date=`date`
tec_date=`date +"%h %d 00:00:00 %Y"`
echo WTDUMPRL Started at $date >> $LOGFILE/tec_maint.log
`wtdumprl -t "$tec_date" >$LOGFILE/$dat.events`
echo WTDUMPRL Finished at $date >> $LOGFILE/tec_maint.log
echo STARTED TEC Event Report at $date >>$LOGFILE/tec_maint.log
echo GZIP Started at $date >> $LOGFILE/tec_maint.log
`gzip -f $LOGFILE/$dat.events`
echo GZIP Finished at $date >> $LOGFILE/tec_maint.log
echo WTDBCLEAR Started at $date >> $LOGFILE/tec_maint.log
`wtdbclear -elt 259600`
echo WTDBCLEAR Finished at $date >> $LOGFILE/tec_maint.log

No comments: