[Twisted-Python] Custom app using twisted
Duncan McGreggor
duncan at adytumsolutions.com
Fri May 14 22:54:04 MDT 2004
Don't know if this belongs on the list or not...
I've just written a python monitoring program for baby-sitting a bunch
of servers (I wanted something easier to setup and maintain than
Nagios)... but the inevitable has happened, and I want to make a
go-cart run like a ferrari. I was thinking of using python's interface
to 'select' a la Medusa, but as soon as I saw 'import asyncore', I
thought "There's got to be a better way..."
Enter twisted.
I would like to be able to run n monitoring instances simultaneously
(thus my interest in 'select') to make the code as close to real-time
as is practical. However, this is my first dive into POSIX I/O at this
level (I ordered a copy of "UNIX Systems Programming" (Robbins)
yesterday, to help me learn and adjust).
* The monitoring libs that I've put together do everything from local
process monitoring (crap like ps with commands.getoutput), httplib
checks against sites, process checks on remote servers (ssh+ps with
commands.getoutput), ping checks, etc.
* An instance of the monitoring class will only do one type of
monitoring (either process check, remote process check, ping check, or
site check)
I would like to write a version of this that's a twisted application,
in the hopes that it will be more robust and enterprise-ready. I've
started looking at the following:
twisted.application.service.IProcess
twisted.application.service.Process
and spawnProcess from twisted.internet.default.PosixReactorBase
But I am not sure how to get started yet... I want to write something
that can be run with twistd. Can anyone offer guidance or suggestions
as to the approach? Right now, I am locked on the example here:
http://twistedmatrix.com/documents/current/howto/application.html ...
Is this what I should be looking at for inspiration? Or another
approach all together? I've not come across examples of twisted apps
that are a narrow specialization like what I have in mind... the app
would be a *kind* of server... that would regularly spawn processes and
wait for return data, regularly instantiate python monitoring classes.
Am I thinking of this in a sane way?
Thanks for any input,
Duncan
--
Duncan M. McGreggor mailto:duncan at adytum.us
Systems & p 301.698.5032
Applications Engineer http://adytum.us
AdytumSolutions, Inc.
More information about the Twisted-Python
mailing list