[Xymon] File monitoring with `date` in filename

Rolf Schrittenlocher schritte at ub.uni-frankfurt.de
Fri Sep 27 09:27:31 CEST 2013


Hi,

thanks a lot to all and especially to you, Jeremy. The central info was 
"You cannot use backticks in analysis.cfg FILE patterns".
I still have no idea what the bourne shell is doing on the client. Xymon 
user uses bash, maybe the error is the result of some other script using 
sh and not related to the file problem.
But at least it is working know and I know how to set entries in 
analysis.cfg and client-local.cfg

Rolf

This is what I use now
analysis.cfg: FILE    `/home/mypath/log/update_out_$(date +%Y%m%d).txt` 
MTIME<600 red
client config.cfg: file:`bash -c 'find /mypath/log/update_out_$(date 
+%Y%m%d).txt'`

> On 26 September 2013 17:34, Rolf Schrittenlocher 
> <schritte at ub.uni-frankfurt.de <mailto: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:
>
> Live in San Francisco
>
> 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
>


-- 
Mit freundlichen Gruessen
Rolf Schrittenlocher

Lokales Bibliothekssystem Frankfurt
Senckenberganlage 31, 60054 Frankfurt
Tel: (49) 69 - 798 28908   Fax: (49) 69 798 28817
LBS: lbs-f at mlist.uni-frankfurt.de
Persoenlich: schritte at ub.uni-frankfurt.de

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20130927/b59cc1d2/attachment.html>


More information about the Xymon mailing list