Xymon Mailing List Archive search

File monitoring with `date` in filename

list Jeremy Laidman
Fri, 27 Sep 2013 11:37:48 +1000
Message-Id: <CAAnki7DZ4feC-XMSR-T0cfjUrn4VbqVjC=MPkMrQOuS3=user-36c3ba37f2df@xymon.invalid>

On 26 September 2013 17:34, Rolf Schrittenlocher <
user-4b3b4051a09b@xymon.invalid> wrote:
On the server we have in
analysis.cfg
HOST=myserver
 FILE    `/home/mypath/log/update_out_$**(date +%Y%m%d).txt` MTIME<600 red
You cannot use backticks in analysis.cfg FILE patterns.  You have to use a
pattern match or a regular expression.  So one of these might work for you:

FILE    "/home/mypath/log/update_out_*.txt" MTIME<600 red

or

FILE    "%/home/mypath/log/update_out_[0-9]*\.txt" MTIME<600 red

These should match whatever file is evaluated by the backtick expression in
analysis.cfg.  That will only ever be one file, so you should only see
alarms for the correct file.

in client-local.cfg:
[myserver]
  file:`find /mypath/log/update_out_$(date +%Y%m%d).txt`
If your Xymon user's shell is bourne shell, then the $() form won't work.
 Bourne shell uses only backticks, but you cannot use backticks either,
because Xymon terminates the "file:" expression at the second backtick.

You can probably just run bash, if it's installed, and give it the command
you want, using the $() expression, like so:

file:`bash -c 'find /mypath/log/update_out_$(date +%Y%m%d).txt'`

In xymonclient.log I see an entry
sh: syntax error at line 1: `(' unexpected
but I don't know if it is related to the file problem or to anything else.
Yes, this is bourne shell complaining about "(" following "$" because it
requires an opening paren to be at the start of an expression.  It doesn't
understand "$().  So try the "bash" thing and see if it works for you.  If
bash isn't installed, then the same should work for korn shell (ksh).

J