[Twisted-Python] How Twisted is This?
Ivo van der Wijk
ivo at amaze.nl
Wed Jul 16 09:45:04 MDT 2003
On Wed, Jul 16, 2003 at 11:25:20AM -0400, Brad Bollenbach wrote:
> Hi,
>
> I'm evaluating Twisted for the networking component of a web server
> monitoring service. Eventually, this service will support monitoring
> pretty much any TCP-enabled device.
>
> I want to figure out whether Twisted is applicable to my problem.
>
> This web monitoring system will be:
>
> * branded for the company I work for
>
> * multiuser
>
> * offer various ways of verifying the uptime and integrity of content on
> a site:
>
> i. Can I open an HTTP connection to this site?
> ii. Is "foo bar" present on the page that I've retrieved?
> iii. Is the page I've retrieved the same size as it was before?
> iv. Is Basic Auth still working with this username/password? (for
> pages that do Basic Auth, of course :)
>
I've written a HTTP watchdog using Twisted that does something like this:
- can I connect
- can I HEAD / and get a result
- does all of this happen in the correct time interval
The watchdog resets the service if it is not responding, and keeps track
of some statistics to avoid continuous restarting.
> ...and so forth.
>
> So, my main use case (possibly) relevant to Twisted would be:
>
> I write a "monicron". monicron wakes up every five minutes and asks the
> system "are there any monitors that need to be performed right now?" The
> answer will either be "Yes, here's the monitors that need to be
> performed right now" or "No".
>
> If No, monicron will just go back to bed for another five minutes.
>
> If the answer is Yes monicron will gather the monitors that need to be
> run, and execute the all at once -- asyncronously. It would then need to
> collect the results of all the monitors, and once they've all reported
> back for a given site, send an error report if something went wrong.
>
> 1. Does this sound Twisted?
>
Somewhat. You need to make very sure your system doesn't block unexpectedly :)
> 2. If Yes, where should I start looking for the bits of the framework
> that will make my task as easy as possible?
>
I have a rather ugly Twisted script which might give you a start (it does the
checking at intervals, gathering results / setting timeouts, etc).
If you're interested, I could try to cleanup the code a bit.
Cheers
Ivo
--
Drs. I.R. van der Wijk -=-
Korte Leidsedwarsstraat 12 Amaze Internet Services V.O.F.
1017 RC Amsterdam, NL -=-
T +31-20-4688336 F +31-20-4688337 Linux/Web/Zope/SQL/MMBase
W http://www.amaze.nl E info at amaze.nl Network Solutions
W http://vanderwijk.info E ivo at amaze.nl Consultancy
PGP http://vanderwijk.info/pgp -=-
More information about the Twisted-Python
mailing list