Re: parsing oncheck output
Posted in 1997
Walt: stuff for IIUG archives, probably.
>From: cos@zax.whoville.leftbank.com (Ofer Inbar)
>Date: 17 Jun 1997 12:45:35 -0400
>X-Informix-List-Id: <news.39300>
>
>I've written a short script to run all of the consistency checks
>recommended in chapter 31 of the Administrator's Guide:
>
>[...script deleted...]
(I'd say in the interests of brevity if it weren't for the volume of this message:-)
>What I'd like to do is run it from crontab and have it mail its output
>to a few people. But, oncheck is really verbose! I'd like it to send
>mail only if there's an actual problem that someone needs to worry
>about. It would be trivial for me to change those backtick calls into
>opens of pipes, and have perl parse the output to figure out if it's
>worth mailing out. Unfortunately, I have no clue what to look for.
>There doesn't seem to be any regular format for what oncheck spews
>out, nor is the format of its messages and error indications
>documented anywhere that I can find.
>
>One possible rule might be:
> Look for the word "error". Starting with the line that has the word
>"error", continue until you reach a blank line. That block of text is
>the entire error message for an actual problem.
>
>If that were true, I could write my script accordingly. It seems like
>a plausible rule to me, based on what I've seen of oncheck output so
>far, but without documentation I just don't *know*. I don't want to
>make a guess that will end up suppressing actual error messages that
>we need to see, leading to a false sense of confidence. But I also
>don't want to mail out the entire output every day, because people
>will stop reading it.
>
>Can anyone help?
Well, I've not tested this code on databases later than about 5.01, but
this is an Informix Administration package I put together a few years ago.
Don't let the recent dates on the changes fool you; it is rather
long-toothed code. It includes ixcheck (a shell script to run oncheck,
pretty much as you asked), with a set of sed filters ixcheck-cX where the X
is one of the oncheck options. You will probably need to adjust the
filters -- let me know about the changes. It is designed to be run by
cron; there is an outgoing mail filter which only send non-empty emails.
There are also the startup scripts which I use to run ODS and IUS on my
machine at boot time, and which take ODS and IUS down when the machine is
shutdown gracefully (as opposed to disgracefully just switching it off:-)
And there are the current versions of the scripts I use to copy parts of
Informix installations around.
Yours,
Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>
: "@(#): shar.sh,v 1.10 1997/06/02 21:45:00 johnl Exp $"
#! /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: Tue Jun 17 11:18:44 PDT 1997 by johnl at Informix Software Ltd.
# Files archived in this archive:
# Install.mk
# Makefile
# basename.c
# clnpath.c
# clnpath.h
# cpinfxdir.1
# cpinfxdir.sh
# crontab
# dirname.c
# fl.c
# getopt.h
# getpwd.c
# informix.1
# instfile.sh
# ius.rc
# ixadm.bod
# ixadm.ins
# ixadm.lst
# ixcheck-cD
# ixcheck-cI
# ixcheck-cc
# ixcheck-ce
# ixcheck-cr
# ixcheck.sh
# ixchkperm.sh
# ixclean.sh
# ixcomp.sh
# ixconfig.sh
# ixcreate.1
# ixcreate.sh
# ixcrontab.sh
# ixdaily.sh
# ixhourly.sh
# ixmail.sh
# ixmsgpath.sh
# ixremove.1
# ixremove.sh
# ixrestart.sh
# ixrstmsg.sh
# ixsetperm.sh
# ixstats.sh
# ixwarn.sh
# ixweekly.sh
# ixzero.sh
# jlss.h
# jlss.sh
# mkbod.sh
# mkinfxdir.1
# mkinfxdir.sh
# mkixcpio.1
# mkixcpio.sh
# mkpath.sh
# ods.rc
# stderr.c
# stderr.h
# tokenise.c
# unixwarn.sh
# vstrcpy.c
#
#--------------------
if [ -f Install.mk -a "$1" != "-c" ]
then echo shar: Install.mk already exists
else
echo 'x - Install.mk (829 characters)'
sed -e 's/^X//' >Install.mk <<'SHAR-EOF'
X# @(#)$Id: Install.mk,v 1.2 1997/05/12 09:46:35 johnl Exp $
X#
X# @(#)JLSS Informix Administration Tools Version 2 (1997-05-12)
X#
X#######################
X# Distribution System #
X#######################
X
XBASENAME = ixadm
X
XFILES.nmd = \\
X ${BASENAME}.nmd \\
X mknmd \\
X mkpath \\
X mkversion
X
XFILES.bod = \\
X ${BASENAME}.bod \\
X ${BASENAME}.ins \\
X ${BASENAME}.lst \\
X instfile \\
X jlss \\
X mkbod \\
X mkpath
X
XNMD: ${FILES.nmd} .FORCE
X mknmd . $@ ${BASENAME}.nmd
X
XBOD: ${FILES.bod} .FORCE
X mkbod . $@ ${BASENAME}.bod
X
X######################################
X# Non-preferred distribution targets #
X######################################
X#nmd: ${FILES.nmd} .FORCE
X# mknmd . . ${BASENAME}.nmd
X#
X#bod: ${FILES.bod} .FORCE
X# mkbod . . ${BASENAME}.bod
X######################################
X
Xmkversion: mkversion.sh
X rm -f $@
X sh $? $? >$@
X chmod 555 $@
SHAR-EOF
chmod 444 Install.mk
if [ `wc -c <Install.mk` -ne 829 ]
then echo shar: Install.mk unpacked with wrong size
fi
# end of overwriting check
fi
#--------------------
if [ -f Makefile -a "$1" != "-c" ]
then echo shar: Makefile already exists
else
echo 'x - Makefile (916 characters)'
sed -e 's/^X//' >Makefile <<'SHAR-EOF'
X# @(#)$Id: Makefile,v 1.9 1997/05/12 09:57:06 johnl Exp $
X#
X# @(#)JLSS Informix Administration Tools Version 2 (1997-05-12)
X#
X# Makefile for JLSS Informix Adminstration Tools
X
XCFLAGS = -O -DUSG_DIRENT
X
XSCRIPTS = \\
X cpinfxdir \\
X fl \\
X ixcheck \\
X ixchkperm \\
X ixclean \\
X ixcomp \\
X ixconfig \\
X ixcreate \\
X ixcrontab \\
X ixdaily \\
X ixhourly \\
X ixmail \\
X ixmsgpath \\
X ixremove \\
X ixrestart \\
X ixrstmsg \\
X ixsetperm \\
X ixstats \\
X ixwarn \\
X ixweekly \\
X ixzero \\
X mkinfxdir \\
X mkixcpio \\
X unixwarn
X
XDATAFILES = \\
X crontab \\
X ixcheck-cD \\
X ixcheck-cI \\
X ixcheck-cc \\
X ixcheck-ce \\
X ixcheck-cr
X
XDOCFILES = \\
X cpinfxdir.1 \\
X informix.1 \\
X ixcreate.1 \\
X ixremove.1 \\
X mkinfxdir.1
X
XFILES.o = \\
X fl.o \\
X basename.o \\
X clnpath.o \\
X dirname.o \\
X getpwd.o \\
X stderr.o \\
X tokenise.o \\
X vstrcpy.o
X
Xall: ${SCRIPTS} ${DATAFILES} ${DOCFILES}
X
Xfl: ${FILES.o}
X ${CC} -o $@ ${FILES.o}
X
Xinclude Install.mk
SHAR-EOF
chmod 444 Makefile
if [ `wc -c <Makefile` -ne 916 ]
then echo shar: Makefile unpacked with wrong size
fi
# end of overwriting check
fi
#--------------------
if [ -f basename.c -a "$1" != "-c" ]
then echo shar: basename.c already exists
else
echo 'x - basename.c (1336 characters)'
sed -e 's/^X//' >basename.c <<'SHAR-EOF'
X/*
X@(#)File: