monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [monit] regex in http tests


From: Jan-Henrik Haukeland
Subject: Re: [monit] regex in http tests
Date: Mon, 17 May 2010 10:08:46 +0200

Monit uses POSIX Extended Regular Expressions which is documented via 'man 
re_format' and in this wiki page;
 
http://en.wikipedia.org/wiki/Regular_expression#POSIX_.28Portable_Operating_System_Interface_.5Bfor_Unix.5D.29


On May 17, 2010, at 9:03 AM, Edmunds wrote:

> Hi everyone!
> 
> Im trying to set up monit, so that it tests for contents of a webpage
> using regex (this is supported according to docs)
> 
> The webpage in question is a php page that does some checks and
> outputs "OK" if all checks pass.
> 
> Now I want monit to alert me, if that page contains anything else
> except "OK". So "Critical things are OK, but some minor error here"
> should trigger an alert. At first I set up monitrc simply as this:
> 
> if failed url http://local/test.php
>       and content == 'OK'
>       then alert
> 
> but that doesn't work, because "OK" can appear anywhere on the page.
> So next I turned to regex:
> 
> if failed url http://local/test.php
>       and content == '[OK]{2}'
>       then alert
> 
> doesn't trigger alert if there are more strings
> 
> if failed url http://local/test.php
>       and content == '[^OK]'
>       then alert
> 
> doesn't trigger an alert even if the page only contains "OK", while it should
> 
> if failed url http://local/test.php
>       and content == '^OK'
>       then alert
> and
> if failed url http://local/test.php
>       and content == 'OK$'
>       then alert
> 
> trigger alerts even if the page only contains "OK"
> 
> I'm really out of ideas here ... seems that monit uses some really
> strange regex in HTTP requests
> 
> --
> To unsubscribe:
> http://lists.nongnu.org/mailman/listinfo/monit-general




reply via email to

[Prev in Thread] Current Thread [Next in Thread]