WebKit.Monitor | index /usr/local/share/webware/WebKit/Monitor.py

`Fault tolerance system for WebKit.
Contributed to Webware for Python by Jay Love.
This module is intended to provide additional assurance that the
AppServer continues running at all times. This module will be
reponsible for starting the AppServer, and monitoring its health. It
does that by periodically sending a status check message to the
AppServer to ensure that it is responding. If it finds that the
AppServer does not respond within a specified time, it will start a
new copy of the AppServer, after killing the previous process.
Use::
$ python Monitor.py start
$ python Monitor.py stop
The default AppServer specified below will be used, or you can list
the AppServer you would like after ``start``.
You can have the whole process run as a daemon by specifying ``daemon``
after ``start`` on the command line.
To stop the processes, run ``Monitor.py stop``.`

Modules
`` |  |
os signal | socket sys | time |

Functions
`` |  | checkServer(restart=1) `Send a check request to the AppServer. If restart is 1, then attempt to restart the server if we can't connect to it. This function could also be used to see how busy an AppServer is by measuring the delay in getting a response when using the standard port.` createServer(setupPath=0) `Unix only, executed after forking for daemonization.` dumps(...) main(args) `The main loop. Starts the server with `startServer(0)`, checks it's started up (`startupCheck`), and does a loop checking the server (`checkServer`).` shutDown(signum, frame) `Shutdown handler. For when Ctrl-C has been hit, or this process is being cleanly killed.` startServer(killcurrent=1) `Start the AppServer. If `killcurrent` is true or not provided, kill the current AppServer.` startupCheck() `Make sure the AppServer starts up correctly.` stop() `Stop the monitor. This kills the other monitor process that has been opened (from the PID file ``monitor.pid``).` usage()

Data
`` |  | addr = None arguments = ['start', 'stop'] debug = 1 defaultServer = 'ThreadedAppServer' maxStartTime = 120 monitorInterval = 10 optionalargs = ['daemon'] quitstr = 'i\x16\x00\x00\x00{t\x06\x00\x00\x00formatt\x04\x00\x00\x00QUIT0' running = 0 serverName = 'ThreadedAppServer' servernames = ['ThreadedAppServer'] srvpid = 0 statstr = 'i\x18\x00\x00\x00{t\x06\x00\x00\x00formatt\x06\x00\x00\x00STATUS0'