monit-general
[Top][All Lists]
Advanced

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

[monit] regex in http tests


From: Edmunds
Subject: [monit] regex in http tests
Date: Mon, 17 May 2010 10:03:31 +0300

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



reply via email to

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