ADSM Console monitor script
1998-01-20 17:04:35
A number of people have expressed interest in a console logging script. Here
is enclosed an outline of such a script for AIX. It needs sprucing up and
error checking etc adding but runs OK as is.
Nick Clayton
(Vertex Data Science)
###########################################################
#!/bin/ksh
#
# ADSM Activity log extraction script
#
# Cut down version of activity log extraction script
#
# Created 07/12/97 By N. Clayton
#
### Set up variables
DSMADMC="dsmadmc -id=UID -pass=PASS "
### Start console session as co process and store pid
$DSMADMC -cons |&
PID=$!
### Read initial messages from process. Number of lines may be dependant
upon release of ADSM so check.
read -p MESSAGE
read -p MESSAGE
read -p MESSAGE
read -p MESSAGE
read -p MESSAGE
### Take output from coprocess for a day
while [[ $SECONDS -lt 86390 ]]
do
read -p MESSAGE
TIME=`date "+%T"`
DATE=`date "+%D"`
### See if there is more than one line to the message
### Note this still has problems with some messages that I?ll have to
### sort out later. It will split and message wth multiple .' into several
EOM=`echo $MESSAGE | awk '{print (index($0,"."))}'`
### If so read extra lines until we have the full message
while [[ $EOM -eq 0 ]]
do
read -p EXTRA
MESSAGE=$MESSAGE" "$EXTRA
unset EXTRA
EOM=`echo $MESSAGE | awk '{print (index($0,"."))}'`
done
### Get the message ID of the message
MSGID=`echo $MESSAGE | awk '{print $1}'`
### Perform actions depending upon the message in the log file
echo $DATE $TIME $MESSAGE >> $FULLLOG_FILE
case "$MSGID" in
( ANR0402I | ANR0405I ) ;; ### Admin session start and end.
( ANR0400I ) ;; ### Client session start
( AND0403I ) ### Client session end
/usr/adsm/server/cron/log_session_performance ;;
( ANR8337I | ANR8468I ) ### Mount or dismount of tape
echo $DATE $TIME $MESSAGE >> $LOG_FILE
/usr/adsm/server/cron/log_mounts $DATE $TIME $MESSAGE ;;
( ANR1341I | ANR1340I ) ### Scratch addition or deletion
echo $DATE $TIME $MESSAGE >> $LOG_FILE ;;
/usr/adsm/server/cron/log_scratch ;;
(*) ### Other message
echo $DATE $TIME $MESSAGE >> $LOG_FILE ;;
esac
done
### Kill coprocess and then end
kill $PID
exit 0
|
<Prev in Thread] |
Current Thread |
[Next in Thread> |
- ADSM Console monitor script,
Nick Clayton <=
|
|
|