Can Python work for me?

Tim Ottinger tottinge at indy.rr.com
Wed Feb 19 09:51:51 EST 2003


Alex Martelli wrote:
> Adam Rumpke wrote:
>>I had a question asked to me that I cannot answer. I am curious if
>>Python could be used to act as a CGI for a printer web browser
>>interface. This job requires the web/file server to send the users a
>>message telling them the status.
>>
>>FOR EXAMPLE: If I want to print and the printer is jammed a user at
>>home will need to know the printer is not working. I would like the
>>system to send a message via
>>the browser with out the browser constantly reloading. Could Python do
>>this?
> 
> 
> It doesn't matter much what language you use on the server-side
> for this: you want to do something outside the parameters of the
> HTTP protocol, which is based on request/response, i.e. have the
> server "initiate" something -- any architecture allowing that is
> either outside HTTP (thus needs a special browser supporting it)
> or a kludge (e.g, the server might induce the client to refresh
> periodically -- but that would basically boil down to "browser
> constantly reloading", at least, say, in a single frame).

The constantly refreshing kludge is a little tedious, but I've used 
python in CGI with a 15-second refresh to monitor a remote system,
and a guy could do worse. It can't initiate a window or anything,
but if a guy wants to dedicate a piece of his screen to a flickering
window, he can definitely receive alerts when something changes.

A cheap, old, tired PC (pentium 75 or worse) could even be dedicated to 
the job of monitoring a number of systems. Debian + Galeon doesn't take
much of a machine to run it.

But you probably want something a bit less 'reactive' to monitor 
printers. Using Python with XML/RPC or SOAP or even plain-old sockets is 
a fine choice.  It should not be too hard to cobble up something in 
Python and maybe wxWindows or tkInter.

Of course, an old-fashioned way to do this to make a monitoring program 
send email or a page. I guess with the right libraries, it could send a 
message to anything you like.

Hasn't this been done in Linux/Unix by monitoring logs?  What platform 
are we talking about? Can you react to NT logs or Lin/Unix logs and 
notify via chat or email?

-- 
+---------------------------+--------------------------+
| Tim Ottinger              | OpenOffice Mozilla Samba |
| Indianapolis, IN USA      | Python, C++, Whatever    |
| I promote Free Software   | Linux! (MS if I have to) |
|---------------------------+--------------------------|
|      OO Architecture, Design, Teacher/Mentor         |
+------------------------------------------------------+





More information about the Python-list mailing list