For Programmers: Free Programming Magazines  


Home > Archive > AWK > January 2008 > AIX alog pattern match









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author AIX alog pattern match
Henry

2008-01-15, 6:59 pm

I'd like to print each individual error from the AIX console log
for instance, there is an error at Wed Jan 16 at 00:44:18
the record finished either at EOF, or when the next error occurs, in
this case, (we have some Firmware problems :) 05:45
will be the record separator.
I don't like to put output to files if I can avoid it so it'll be
alog -o -f /var/adm/ras/conslog | awk '

I've got this bit to work (Korn Shell) counting all the records for
each calendar day, but would like to put something more meaningful in
the alert to Nagios. Yes, I know I don't need to use "set --" but I
just found it so wanted to play.

date_string=$(date +"%a %b %e")
set -- ${date_string}
w_day_name=$1
shift
day_of_month=$1
shift
month_name=$1
num_console_records=$(
alog -o -f /var/adm/ras/conslog | \
awk '
BEGIN {num_recs=0}
$1 == "0" && $2 == "'$w_day_name'" && $3 == "'$day_of_month'" && $4
== "'$month_name'" {++num_recs}
END {print num_recs}
'


0 Tue Jan 15 20:37:47 NZDT 2008 Tue Jan 15 20:37:47 NZDT 2008
0 Tue Jan 15 20:37:47 NZDT 2008 Automatic Error Log Analysis
for sysplanar0 has detected a problem.
The Service Request Number is
B150E678: CEC hardware Predictive Error, general. Refer to the
system
service documentation for more information.
Additional Words: 2-030000F0 3-28DA4810 4-C13920FF
5-400000FF
6-00000007 7-000002BD 8-00000000
9-00000000.
0 Tue Jan 15 20:37:47 NZDT 2008
0 Wed Jan 16 00:44:18 NZDT 2008
0 Wed Jan 16 00:44:18 NZDT 2008 Wed Jan 16 00:44:18 NZDT 2008
0 Wed Jan 16 00:44:18 NZDT 2008 Automatic Error Log Analysis
for sysplanar0 has detected a problem.
The Service Request Number is
B150E67A: CEC hardware Predictive Error, degraded performance. Refer
to the
system service documentation for more information.
Additional Words: 2-030000F0 3-28DA4810 4-C13920FF
5-400000FF
6-00000008 7-000003EC 8-00000000
9-00000000.
0 Wed Jan 16 00:44:18 NZDT 2008
0 Wed Jan 16 05:45:34 NZDT 2008
0 Wed Jan 16 05:45:34 NZDT 2008 Wed Jan 16 05:45:34 NZDT 2008
0 Wed Jan 16 05:45:34 NZDT 2008 Automatic Error Log Analysis
for sysplanar0 has detected a problem.
The Service Request Number is
B150E678: CEC hardware Predictive Error, general. Refer to the
system
service documentation for more information.
Additional Words: 2-030000F0 3-28DA4810 4-C13920FF
5-400000FF
6-00000007 7-000002BD 8-00000000
9-00000000.
0 Wed Jan 16 05:45:34 NZDT 2008
0 Wed Jan 16 07:59:03 NZDT 2008
0 Wed Jan 16 07:59:03 NZDT 2008 Wed Jan 16 07:59:03 NZDT 2008
0 Wed Jan 16 07:59:03 NZDT 2008 Automatic Error Log Analysis
for sysplanar0 has detected a problem.
The Service Request Number is
B150E67A: CEC hardware Predictive Error, degraded performance. Refer
to the
system service documentation for more information.
Additional Words: 2-030000F0 3-28DA4810 4-C13920FF
5-400000FF
6-00000009 7-000003EC 8-00000000
9-00000000.
0 Wed Jan 16 07:59:03 NZDT 2008
Ed Morton

2008-01-16, 6:59 pm

On 1/15/2008 3:46 PM, Henry wrote:
> I'd like to print each individual error from the AIX console log
> for instance, there is an error at Wed Jan 16 at 00:44:18
> the record finished either at EOF, or when the next error occurs, in
> this case, (we have some Firmware problems :) 05:45
> will be the record separator.
> I don't like to put output to files if I can avoid it so it'll be
> alog -o -f /var/adm/ras/conslog | awk '
>
> I've got this bit to work (Korn Shell) counting all the records for
> each calendar day, but would like to put something more meaningful in
> the alert to Nagios. Yes, I know I don't need to use "set --" but I
> just found it so wanted to play.
>
> date_string=$(date +"%a %b %e")
> set -- ${date_string}
> w_day_name=$1
> shift
> day_of_month=$1
> shift
> month_name=$1
> num_console_records=$(
> alog -o -f /var/adm/ras/conslog | \
> awk '
> BEGIN {num_recs=0}
> $1 == "0" && $2 == "'$w_day_name'" && $3 == "'$day_of_month'" && $4
> == "'$month_name'" {++num_recs}
> END {print num_recs}
> '
>
>
> 0 Tue Jan 15 20:37:47 NZDT 2008 Tue Jan 15 20:37:47 NZDT 2008
> 0 Tue Jan 15 20:37:47 NZDT 2008 Automatic Error Log Analysis
> for sysplanar0 has detected a problem.
> The Service Request Number is
> B150E678: CEC hardware Predictive Error, general. Refer to the
> system
> service documentation for more information.
> Additional Words: 2-030000F0 3-28DA4810 4-C13920FF
> 5-400000FF
> 6-00000007 7-000002BD 8-00000000
> 9-00000000.
> 0 Tue Jan 15 20:37:47 NZDT 2008
> 0 Wed Jan 16 00:44:18 NZDT 2008
> 0 Wed Jan 16 00:44:18 NZDT 2008 Wed Jan 16 00:44:18 NZDT 2008
> 0 Wed Jan 16 00:44:18 NZDT 2008 Automatic Error Log Analysis
> for sysplanar0 has detected a problem.
> The Service Request Number is
> B150E67A: CEC hardware Predictive Error, degraded performance. Refer
> to the
> system service documentation for more information.
> Additional Words: 2-030000F0 3-28DA4810 4-C13920FF
> 5-400000FF
> 6-00000008 7-000003EC 8-00000000
> 9-00000000.
> 0 Wed Jan 16 00:44:18 NZDT 2008
> 0 Wed Jan 16 05:45:34 NZDT 2008
> 0 Wed Jan 16 05:45:34 NZDT 2008 Wed Jan 16 05:45:34 NZDT 2008
> 0 Wed Jan 16 05:45:34 NZDT 2008 Automatic Error Log Analysis
> for sysplanar0 has detected a problem.
> The Service Request Number is
> B150E678: CEC hardware Predictive Error, general. Refer to the
> system
> service documentation for more information.
> Additional Words: 2-030000F0 3-28DA4810 4-C13920FF
> 5-400000FF
> 6-00000007 7-000002BD 8-00000000
> 9-00000000.
> 0 Wed Jan 16 05:45:34 NZDT 2008
> 0 Wed Jan 16 07:59:03 NZDT 2008
> 0 Wed Jan 16 07:59:03 NZDT 2008 Wed Jan 16 07:59:03 NZDT 2008
> 0 Wed Jan 16 07:59:03 NZDT 2008 Automatic Error Log Analysis
> for sysplanar0 has detected a problem.
> The Service Request Number is
> B150E67A: CEC hardware Predictive Error, degraded performance. Refer
> to the
> system service documentation for more information.
> Additional Words: 2-030000F0 3-28DA4810 4-C13920FF
> 5-400000FF
> 6-00000009 7-000003EC 8-00000000
> 9-00000000.
> 0 Wed Jan 16 07:59:03 NZDT 2008


I was waiting to see if anyone else could figure out what you were asking. I
couldn't make head nor tail of it. You may want to try again. This time posting
some small sample input that isn't line-wrapped by your newsreader (that part is
VERY important!), along with the expected output and the rationale.

Saying things like

> would like to put something more meaningful in

while no doubt being gratifying to "Nagios" is just not informative to most of
us reading the post. Similarly:
[color=darkred]
> there is an error at Wed Jan 16


doesn't tell us what it is in that record that tells you there's "an error".

Tell us exactly which records you want to select in your sample input based on
which values of which fields and what exactly you want to do with [which fields
of] those records.

Ed.

Hajo Ehlers

2008-01-16, 6:59 pm

On Jan 15, 10:46 pm, Henry <snogfest_hosebe...@yahoo.com> wrote:
> I'd like to print each individual error from the AIX console log
> for instance, there is an error at Wed Jan 16 at 00:44:18
> the record finished either at EOF, or when the next error occurs, in

.....

The conslog is normaly not the primary source of error information on
AIX. Thus you should take a look at the error log as well as the
possiblity to get information directly from the error daemon to a
syslog or nagios

or quick search:
http://users.ca.astound.net/baspenc...err_notify2.htm

hth
Hajo
Henry

2008-01-17, 9:59 pm

On Jan 17, 7:19 am, Hajo Ehlers <serv...@metamodul.com> wrote:
> On Jan 15, 10:46 pm, Henry <snogfest_hosebe...@yahoo.com> wrote:> I'd like to print each individual error from the AIX console log
>
> ....
>
> The conslog is normaly not the primary source of error information on
> AIX. Thus you should take a look at the error log as well as the
> possiblity to get information directly from the error daemon to a
> syslog or nagios
>
> or quick search:http://users.ca.astound.net/baspenc...err_notify2.htm
>
> hth
> Hajo


I look through syslog, and the AIX errorlog, but, things do appear on
the console log too.
Henry

2008-01-17, 9:59 pm

On Jan 17, 7:11 am, Ed Morton <mor...@lsupcaemnt.com> wrote:
> On 1/15/2008 3:46 PM, Henry wrote:
>
>
>
>
>
>
>
> I was waiting to see if anyone else could figure out what you were asking. I
> couldn't make head nor tail of it. You may want to try again. This time posting
> some small sample input that isn't line-wrapped by your newsreader (that part is
> VERY important!), along with the expected output and the rationale.
>
> Saying things like
>
>
> while no doubt being gratifying to "Nagios" is just not informative to most of
> us reading the post. Similarly:
>
>
> doesn't tell us what it is in that record that tells you there's "an error".
>
> Tell us exactly which records you want to select in your sample input based on
> which values of which fields and what exactly you want to do with [which fields
> of] those records.
>
> Ed.


thanks for the input (not!)
I just decided to count lines instead.
Sorry about the CRLF's. That's google Groups for you.
Nagios is a monitoring service.
Hajo Ehlers

2008-01-18, 6:59 pm

On Jan 18, 4:28 am, Henry <snogfest_hosebe...@yahoo.com> wrote:
> On Jan 17, 7:19 am, Hajo Ehlers <serv...@metamodul.com> wrote:
>
>
>
>
>
>
> I look through syslog, and the AIX errorlog, but, things do appear on
> the console log too.


IMHO the conslog is NOT desinged as an logging facility. Thus it is
only for information.
This said. Even the error message in your OP should have an entry in
the errlog.

Thus the first point is to look at the error log which will tell you
if you have a hardware , software, permament, ... problem
For people working with syslog or a centralized syslog facility you
can configure the errlog facility to send error messages to the syslog
as well.

hth
Hajo

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com