Re: Online Monitoring tools
Posted in 1993
>From: Jack Parker <uunet!hpbs2561.boi.hp.com!jparker> >Subject: Online Monitoring tools >Date: Wed, 31 Mar 93 13:00:53 MST >X-Informix-List-Id: <list.2096> > >Pholks, > >We all have our own concerns about monitoring what Online is up to while we >aren't watching. I'm sure that each of us have come up with our own scripts >to monitor those things that are important to us. I propose we build a >library of these scripts/programs to make available to all of us and perhaps >convince Informix to build in to release 21.7. Good idea, though I fear release 21.7 may be a trifle optimistic:-} Here's my (undocumented) contribution. The scripts ixhourly, ixdaily and ixweekly are intended to be run by cron every hour, every day, and every week. You could add monthly if that was appropriate, and you could run them more or less frequenetly than the nominal times. The content of the files is expected to change per-site; what I have supplied is in use on a customer site where the machine is idle at lunchtime on Sundays. The .crontab file is what is supplied to cron by user informix. ixhourly simply does a tbstat -plu and ps -ef (System V) and logs them into a file with the time as the name. This is where you would put a monitor on your OnLine message log which mailed some responsible users with any problems. ixdaily compresses the previous day's hourly logs. It uses a trick with the timezone TZ environment vairable to set it back 24 hours. This works very nicely here in England (where the default timezone is GMT0BST) but may need some fiddling in other timezones. You could consider zeroing tbstat values here. ixweekly does two things. It uses ixrestart (see below) and it removes any log files which are older than 1 month old. ixrestart takes the OnLine system offline, juggles the OnLine log files, and then restarts OnLine. This assumes that there is a period in the week when you can afford to do this. The log juggling exercise moves the current log to a directory named with the curent date and renames it with the current time. It compresses all the non-compressed files in the log directory. ixclnlog is a log cleaning program. In it's current form, it removes the most important message (logical logs need backing up), so it is not appropriate for monitoring what is wrong with the system, but it gives a pointer in the right general direction. A proper monitor would need to keep track on where it had got to in previous reports, and so on. When I am setting up INFORMIXDIR, I always create a log directory for the logs to go in (and the scripts above assume that such a directory exists). I only keep dot-files (.profile, .login, .crontab) and directories in $INFORMIXDIR. The installxxx scripts are moved into etc. The default value of MSGPATH is modified to refer to /usr/informix/log/online.log, or some other value if appropriate. The master versions of these files are normally kept under SCCS (or RCS) in $INFORMIXDIR/src. The scripts are copied to $INFORMIXDIR/bin. These scripts would need some considerable extra work if you have more than one OnLine configuration on your machine, and they would need some minor work if TBCONFIG != tbconfig. Yours, Jonathan Leffler (johnl@obelix.informix.com) #include <disclaimer.h> : "@(#)shar.sh 1.8" #! /bin/sh # # This is a shell archive. # Remove everything above this line and run sh on the resulting file. # If this archive is complete, you will see this message at the end: # "All files extracted" # # Created: Thu Apr 1 07:38:07 BST 1993 by johnl at Informix Software Ltd. # Files archived in this archive: # ixclnlog.sh # ixdaily.sh # ixhourly.sh # ixrestart.sh # ixweekly.sh # makefile # #-------------------- if [ -f ixclnlog.sh -a "$1" != "-c" ] then echo shar: ixclnlog.sh already exists else echo 'x - ixclnlog.sh (393 characters)' sed -e 's/^X//' >ixclnlog.sh <<'SHAR-EOF' X: "@(#)ixclnlog.sh 1.1 91/08/20" X# X# Remove most of the unwanted stuff from an OnLine logfile X# Edit this to suit the particular problem which is happening X Xsed -e '/Logical Log Files are Full/d' \\ X -e '/Checkpoint Completed/d' \\ X -e '/Process Aborted Abnormally/d' \\ X -e '/Logical Log [0-9][0-9]* Complete/d' \\ X -e '/^[ ]*$/d' \\ X $* SHAR-EOF chmod 444 ixclnlog.sh if [ `wc -c <ixclnlog.sh` -ne 393 ] then echo shar: ixclnlog.sh unpacked with wrong size fi # end of overwriting check fi #-------------------- if [ -f ixdaily.sh -a "$1" != "-c" ] then echo shar: ixdaily.sh already exists else echo 'x - ixdaily.sh (445 characters)' sed -e 's/^X//' >ixdaily.sh <<'SHAR-EOF' X: "@(#)ixdaily.sh 1.1 91/08/20" X# X# Compress yesterday's TBSTAT logs X X# Run by cron => minimal environment X: ${INFORMIXDIR:=/usr/informix} XPATH=$PATH:$INFORMIXDIR/bin Xexport PATH X Xarg0=`basename $0 .sh` X X# Juggling TZ sets the clock back by 24 hours, and is the simplest X# way to obtain yesterday's date! Xdt=`TZ=GMT+24BST date +"%Y.%m.%d"` XLD=$INFORMIXDIR/log Xif [ -d $LD/$dt ] Xthen X cd $LD/$dt X compress ts.* 2>/dev/null Xfi SHAR-EOF chmod 444 ixdaily.sh if [ `wc -c <ixdaily.sh` -ne 445 ] then echo shar: ixdaily.sh unpacked with wrong size fi # end of overwriting check fi #-------------------- if [ -f ixhourly.sh -a "$1" != "-c" ] then echo shar: ixhourly.sh already exists else echo 'x - ixhourly.sh (396 characters)' sed -e 's/^X//' >ixhourly.sh <<'SHAR-EOF' X: "@(#)ixhourly.sh 1.1 91/08/20" X# X# Run TBSTAT and record in a log file X X# Run by cron => minimal environment X: ${INFORMIXDIR:=/usr/informix} XPATH=$PATH:$INFORMIXDIR/bin Xexport PATH X Xarg0=`basename $0 .sh` X Xdt=`date +"%Y.%m.%d"` Xtm=`date +"%H:%M:%S"` XLD=$INFORMIXDIR/log Xif [ ! -d $LD/$dt ] Xthen X mkdir $LD/$dt Xfi X X{ Xecho TBSTAT: Xtbstat -plu Xecho Xecho PS: Xps -ef X} >$LD/$dt/ts.$tm SHAR-EOF chmod 444 ixhourly.sh if [ `wc -c <ixhourly.sh` -ne 396 ] then echo shar: ixhourly.sh unpacked with wrong size fi # end of overwriting check fi #-------------------- if [ -f ixrestart.sh -a "$1" != "-c" ] then echo shar: ixrestart.sh already exists else echo 'x - ixrestart.sh (1112 characters)' sed -e 's/^X//' >ixrestart.sh <<'SHAR-EOF' X: "@(#)ixrestart.sh 1.1 91/08/20" X# X# Shutdown Informix OnLine and then restart it. X X# Run by cron => minimal environment X: ${INFORMIXDIR:=/usr/informix} XPATH=$PATH:$INFORMIXDIR/bin Xexport PATH X Xarg0=`basename $0 .sh` X XMSGPATH=` Xsed -e 's/^[ ]*//' \\ X -e 's/[ ]*#.*//' \\ X -e '/^[ ]*$/d' \\ X -e '/MSGPATH/!d' \\ X -e 's/[ ][ ]*/ /' \\ X $INFORMIXDIR/etc/${TBCONFIG:-tbconfig} | X cut -f2` X@@NL@