[Top][All Lists]

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

Re: [monit] Question about cpu monitoring and "expect" behaviour

From: Jan-Henrik Haukeland
Subject: Re: [monit] Question about cpu monitoring and "expect" behaviour
Date: Wed, 11 Mar 2009 21:48:18 +0100

On 11. mars. 2009, at 20.01, Sébastien Wacquiez wrote:

I don't want to check something fixed. I want to know if my stream work,
and for this I have to check that I can download more than 5kB. Do you
think there is a way to do this with monit ?

The bound checking limit in a posix regex is usually 255, so you can't use [.]{5000,} as you tried, but are limited to {0,255}, besides, the default value of the Monit expect buffer is also only 255 bytes, though this can be expanded by using the set expectbuffer statement. But by messing around a bit I found a way around the 255 limit in a posix regex. So by using the following you should actually be able to test if the server sends 5KB:

      set expectbuffer 6 KB

      if failed port 80
        send "GET /blabla HTTP/1.1\r\n\r\n"
        expect "(.{250}){20,}"

Unfortunately there is a bug in the latest Monit beta 7 release where "set expectbuffer" still only reads 255 bytes. This is fixed now, but this means that you will have to checkout Monit from CVS using these instructions if you need it now, Otherwise you will have to wait for the Monit 5.0 version which should be released shortly.

There is no other obvious solution in Monit other than the one above unless you can check for an end-token in the stream. Of course its also "easy" to change Monit and add a test to check if it is possible to download n bytes from a server.

Sorry about this "stupid" question but this xml format is not mentionned
anywhere in the doc ... :)

The format should be self-explanatory.

reply via email to

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