[Xymon] File monitoring with `date` in filename
Jeremy Laidman
jlaidman at rebel-it.com.au
Fri Sep 27 03:37:48 CEST 2013
On 26 September 2013 17:34, Rolf Schrittenlocher <
schritte at ub.uni-frankfurt.de> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20130927/39a56418/attachment.html>
More information about the Xymon
mailing list