Xymon Mailing List Archive search

PCRE regular expressions (help?)

list Henrik Størner
Mon, 2 May 2005 22:52:37 +0200
Message-Id: <user-bc93e5eb5088@xymon.invalid>

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.*|^/oracle/[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