Xymon Mailing List Archive search

File monitor not working in Xymon - using file list generated by wildcard

list Don Kuhlman
Mon, 8 Oct 2012 17:59:23 +0000
Message-Id: <user-47ae2df4632f@xymon.invalid>

Jeremy. Thanks very much! That worked.  I was googling and trying to read all the regex tutorials I could find. I tried pcre on the server, but wasn't able to get the combinations right.

I really appreciate the help!

Don K


From: Jeremy Laidman <user-71895fb2e44c@xymon.invalid<mailto:user-71895fb2e44c@xymon.invalid>>
Date: Mon, 8 Oct 2012 09:56:26 +1100
To: Don Kuhlman <user-5eb2bfadc6c6@xymon.invalid<mailto:user-5eb2bfadc6c6@xymon.invalid>>
Cc: Xymon Email List <xymon at xymon.com<mailto:xymon at xymon.com>>
Subject: Re: [Xymon] File monitor not working in Xymon - using file list generated by wildcard

On 6 October 2012 05:49, Don Kuhlman <user-5eb2bfadc6c6@xymon.invalid<mailto:user-5eb2bfadc6c6@xymon.invalid>> wrote:
Hi folks. I believe the issue is my regex on the file name in the analysis.cfg.
I've used about 15 different values and the only thing I seem to get working is using the direct full filename vs, a regex to match any files.

In regular expressions the asterisk is not a wildcard in the same way as in DOS/Windows.  Instead, it is read as "zero or more of the previous character or symbol."  So what you probably want is ".*".  The dot "." is a one-character-width wildcard, which is why it needs to be escaped if you want to match a literal dot.  So ".*" means zero or more of any character.

Also, a regular expression match is applied only when the match string STARTS with a percent.

However, using any combos that I can think of as a regex do not:
# FILE %/Volumes/MySQL_Backups/*\.sql red mtime<86400

Here, you are asking to match zero or more slash characters before a ".sql".

# FILE /Volumes/MySQL_Backups/%*\.sql red mtime<600

Doesn't start with percent.

#FILE %^*.sql red mtime>86400

Again, ".*" rather than "*".

Can anyone suggest a way to format the analysis.cfg statement to match anything that ends in .sql ?

Try this:


FILE %/Volumes/MySQL_Backups/mysql_backup_.*\.sql red mtime<86400

This should go red if the matching file is older than 1 day.

J