[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: |
Sébastien Wacquiez |
Subject: |
Re: [monit] Question about cpu monitoring and "expect" behaviour |
Date: |
Wed, 11 Mar 2009 23:10:07 +0100 |
User-agent: |
Thunderbird 2.0.0.19 (Windows/20081209) |
Jan-Henrik Haukeland a écrit :
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} [...]
It's true for posix regex, but various implementation seems to not
repect this limit. I tested my regex with a few tools (under linux) and
they all worked without problem. And the dot don't match new char unless
the regex is flagged with multiline, no ?
a little example in python :
Python 2.4.4 (#2, Apr 5 2007, 20:11:18)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> re.match(".{1000}", " "*1000)
<_sre.SRE_Match object at 0xf7dcfc60>
>>> re.match(".{1000}", " "*999)
>>> re.match(".{1000}", "\n"*1000)
>>> re.match("(.|\n){1000}", "\n"*1000)
<_sre.SRE_Match object at 0xf7e40c20>
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.
I'll try to find some time to propose a patch. And an other for a second
"%" unit for cpu testing like I mentionned in my first mail.
Sorry about this "stupid" question but this xml format is not mentionned
anywhere in the doc ... :)
The format should be self-explanatory.
Nothing mention it's *existence*. The url is self-explanatory too, but a
little hard to guess :)
Thanks for your answers.
Sébastien Wacquiez