Xymon Mailing List Archive search

PCRE regular expressions (help?)

list Tom Kauffman
Mon, 2 May 2005 16:18:31 -0500
Message-Id: <user-936513a00d37@xymon.invalid>

That fixes it!

Tom

-----Original Message-----
From: Henrik Stoerner [mailto:user-ce4a2c883f75@xymon.invalid] 
Sent: Monday, May 02, 2005 3:53 PM
To: user-ae9b8668bcde@xymon.invalid
Subject: Re: [hobbit] PCRE regular expressions (help?)

On Mon, May 02, 2005 at 12:47:15PM -0500, Kauffman, Tom wrote:
I thought I knew what I was doing, but apparently not:

PCRE compile of NORRDDISKS='^/oracle/PRD/sapdata.*' failed

I'm trying to use the patch Henrik so kindly provided earlier.
Hmm - it's not my lucky day for doing patches, sorry. 

There's a clear cut'n'paste bug in the patch I sent out: 
Line 39 of hobbitd/larrd/do_disk.c reads:

     if (!inclpattern) errprintf("PCRE compile of NORRDDISKS ....

It was meant to test the *exclude* pattern there, so it should be

     if (!exclpattern) errprintf("PCRE compile of NORRDDISKS ....

This means you'll get that error-message no matter what you put into
the NORRDDISKS variable.
And what I really want to suppress (shell syntax) is:
/oracle/*/sapdata*
/oracle/*/data?
/oracle/*/mirr*
/oracle/*/orig*

Here's the generic I tried:
PCRE compile of
NORRDDISKS='^/oracle/.../sapdata.*|^/oracle/.../mirr.*|^/oracle/.../orig
.*|^/oracle/.../data.*' failed

I tested it with this one:

NORRDDISKS="^/oracle/[a-z,0-9]+/sapdata.*|^/oracle/[a-z,0-9]+/mirr.*|^/o
racle/[a-z,0-9]+/orig.*|^/oracle/[a-z,0-9]+/data.*"

Feeding it some hand-crafted disk status messages it seems to work OK.

Note that hobbitserver.cfg is processed by a C program, not a shell
tool. So you shouldn't need to escape any of the special characters.


Henrik