Re: how to parse oncheck output?
Posted in 1998
In article <35226b6a.35944921@gate.idg.no>, Nils Myklebust
<Nils.Myklebust@nmdata.com> writes
>This is one of the better questions asked at c.d.i. lately.
>I wish someone would take it up and at least say what they do with the
>output from the oncheck commands. I am getting rather bored from
>looking at them and have a hard time makeing others do it.
>Particularly at customer sites it seems quite stupid to have to tell
>them to look at all this garbage coming out of the commands to no
>avail.
>
Check out the -q (quiet) option! It is in 7.x!!
>Nils Myklebust
>NM Data AS
>
>On Mon, 23 Mar 1998 20:54:34 GMT, cos@zax.whoville.leftbank.com (Ofer
>Inbar) wrote:
>
>>I've written a short script to run all of the consistency checks
>>recommended in chapter 31 of the Administrator's Guide:
>>
>>----------------------------------------------------------------------
>>#!/usr/bin/perl
>>
>>open DBLIST, "echo 'select name,owner,created,flags from sysdatabases'
>>| dbaccess sysmaster - 2>&1 |"
>> or die "can't open dbacess pipe: $!\\n";
>>while (<DBLIST>) { push @dblist, $1 if
>>/^(\\w+)\\s+\\S+\\s+\\d\\S+\\d\\s+\\d+\\s*$/ }
>>close DBLIST;
>>
>>print `oncheck -cr`;
>>print `oncheck -ce`;
>>print `oncheck -cc`;
>>
>>foreach $db (@dblist)
>>{ print `oncheck -cI $db`;
>> print `oncheck -cD $db`;
>>}
>>----------------------------------------------------------------------
>>
>>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.
>>
>>I posted this question once before, about a year ago. I got one
>>followup, but it was a big .shar of a bunch of shell & sed scripts
>>that did a whole bunch of things not directly related to my question,
>>and it was written for and tested Informix 5 whereas I'm running 7.22
>>
>>I don't actually want any scripts, because I want to tailor my script
>>to our local needs anyway, and I definitely want to keep it all in
>>perl. All I want is some documentation, or pointer to documentation,
>>or description, of all the kinds of output oncheck might produce and
>>how an automated script is supposed to be able to figure out what is
>>important to report about. Since our database is mostly fine, and has
>>always been so, I've never actually SEEN any real errors reported by
>>oncheck, so I have no idea what they would look like when they do
>>appear. I want to make sure my script will be able to handle anything
>>oncheck throws at it. For example, being told "a serious error will
>>aways start with the word 'ERROR:'", in and of itself, isn't helpful
>>because perhaps some errors give multiline output, and I'd need to
>>know how to identify those, and how to identify where the error
>>message ends.
>>
>>I'm not afraid of reading manuals, but I just can't find this
>>information and I don't know where to look for it.
>>
>> -- Cos (Ofer Inbar) -- cos@leftbank.com cos@cs.brandeis.edu
>> -- The Left Bank Operation -- lbo@leftbank.com http://www.leftbank.com/
>> It's been said that if a sysadmin does his job perfectly, he's the
>> fellow that people wonder what he does and why the company needs him,
>> until he goes on vacation. -- comp.unix.admin FAQ
>
>Nils Myklebust
>NM Data AS
>Norway
>E-mail: Nils.Myklebust@nmdata.com
>FAQ at: Primary with ODBC info: http://www.smooth1.demon.co.uk
> Official site http://www.iiug.org/techinfo/faq/faq_top.html
--
David Williams
Maintainer of the Informix FAQ
Primary site (Beta Version) http://www.smooth1.demon.co.uk
Official site http://www.iiug.org/techinfo/faq/faq_top.html
I see you standin', Standin' on your own, It's such a lonely place for you, For
you to be If you need a shoulder, Or if you need a friend, I'll be here
standing, Until the bitter end...
So don't chastise me Or think I, I mean you harm...
All I ever wanted Was for you To know that I care