[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Check that text does not exist on a page on a name-based virtual hos
From: |
Martin Pala |
Subject: |
Re: Check that text does not exist on a page on a name-based virtual host |
Date: |
Mon, 4 Oct 2010 15:05:20 +0200 |
The send/expect supports posix regular expression, so it should be possible to
define negative match.
On Oct 4, 2010, at 2:30 PM, Mark Feeney wrote:
> Hi, Martin.
>
> Thank you for your reply. I can probably find a way to make the
> second example work, but what would be ideal for my particular case
> would be a "negative expect". i.e. something like this:
>
> if failed host cave.persia.ir port 4040
> send "Open, Sesame!\r\n"
> expect anything but "sorry, the cave door is broken!"
> then restart
>
> I didn't see anything in the docs supporting this idea with
> send/expect. Wondering if I missed something.
>
> Related question: does the regex library monit uses support
> negative-lookahead matching?
>
> Thanks,
>
>
> Mark.
>
>
>
> On Mon, Oct 4, 2010 at 6:51 AM, Martin Pala <address@hidden> wrote:
>> Hi,
>>
>> you can use the "hostheader" option with the http protocol test (requires
>> monit 5.1.1 or newer) - unfortunately this syntax doesn't support the
>> "content" check.
>>
>> Example:
>> --8<--
>> check host production with address 127.0.0.1
>> if failed port 9999 protocol http request "/some_page" hostheader
>> "foo.com" then alert
>> --8<--
>>
>> We should consolidate the url test to support hostheader + the http protocol
>> test to support content check.
>>
>>
>> As a workaround, you can define the whole HTTP request and expected response
>> using generic send/expect test. Example:
>> --8<--
>> if failed host cave.persia.ir port 4040
>> send "Open, Sesame!\r\n"
>> expect "Please enter the cave\r\n"
>> send "Shut, Sesame!\r\n"
>> expect "See you later [A-Za-z ]+\r\n"
>> then restart
>> --8<--
>>
>> Regards,
>> Martin
>>
>>
>> On Oct 2, 2010, at 10:28 PM, Mark Feeney wrote:
>>
>>> Greetings.
>>>
>>> First: I love monit. Excellent tool. Very simple and effective.
>>> Thanks to all involved.
>>>
>>> I have come up with something I can't figure out how to monitor,
>>> though: I want to check that a web page does not contain certain text
>>> and the page is on a name-based virtual host.
>>>
>>> This almost works for me:
>>>
>>> check host production with address 127.0.0.1
>>> if failed url
>>> http://foo.com/some_page
>>> and content != 'BAD'
>>> then restart
>>>
>>> However, it's incorrect for me to use "http://foo.com" since it's a
>>> cluster, so restarting the current server isn't necessarily going to
>>> help.
>>>
>>> What I want is something like:
>>>
>>> check host production with address 127.0.0.1
>>> if failed url
>>> http://127.0.0.1:9999/some_page
>>> use host header "foo.com" # not real syntax
>>> and content != 'BAD'
>>> then restart
>>>
>>> Is there a way to achieve this? proto http and SEND/EXPECT seemed a
>>> possibility, but I'm not sure how to write the EXPECT part.
>>>
>>> I'm using monit 4.10.1.
>>>
>>> Thanks,
>>>
>>>
>>> Mark.
>>>
>>> --
>>> To unsubscribe:
>>> http://lists.nongnu.org/mailman/listinfo/monit-general
>>
>>
>> --
>> To unsubscribe:
>> http://lists.nongnu.org/mailman/listinfo/monit-general
>>
>
> --
> To unsubscribe:
> http://lists.nongnu.org/mailman/listinfo/monit-general