[This one's the project that caused all the hassle back when Python 2.0 was in beta :) ]
DPythOS - Data, or Distributed, Python OS.
DPythOS provides the means to monitor and manage network hosts and services.
Unlike most monitoring packages, DPythOS provides administrators with a way to _correct_ problems if they occur, and to notify them if that also fails.
DPythOS scripts are run in restricted and minimally extended python environment. Scripts can be run or scheduled from the command-line, and also scheduled from a [very basic!] HTML interface.
Scheduled scripts are run priority-based on a per-host basis, with the maximum number of simultaneous scripts being run by the monitor daemon (monitord.py) limited in a config file option. DPythOS runs [at present] a telnet, or ssh, or HTTP connection to a remote host. Data can be sent down the connection, and the results received and acted on.
Implementation Fun And Games:
people really interested in what kind of weird uhh... stuff... can be done with Python will be intrigued to know that DPythOS does the following:
- uses the newly introduced BaseServer in SocketServer.py to create a SQL database server "thing".
basically, it locks, polls entries in the script scheduler table, reads the entry (which includes the script name, host name and priority), actions the script, removes the entry, unlocks.
this was the whole reason why i submitted the BaseServer patches, but couldn't release the code that _used_ it, at the time.
- overloads ihooks such that "import" first checks whether the script being imported is in the SQL database (!!! :) and provides the functions from the scripts table instead of off of the filesystem. [cool :)]
in this way, common libraries can be developed and managed from the central database. for example, the "loginlib" SQL script loads the login username and password for the target host, and actions the default login method (telnet or ssh) in order to provide a command-prompt by which the host may be managed.
all this is done under database control. cool, huh?
- overloads rlcompleter such that in script interactive mode (suitable for use as a superuser login shell, amongst other things) host names, script names and DPythOS functions have readline tab completion available.
- uses a TelnetBase class (which wasn't suitable for release in Python2) to provide Popen3Telnet (via which ssh is then accessed), HTTPTelnet, and anything else you fancy to add.
basically, the write and the read_until, read_some functionality of Telnet was _way_ too good to miss up on for ssh, http and popen3 wrapping.
so i didn't [miss it, that is].
- Database abstraction. i wrote a SQL database abstraction system that constructs SQL statements in sections. if you hate views, or if your SQL server doesn't support it, the abstraction layer is a good way to construct complex SQL rules and joins without duplicating loads of text.
also, bundled with the distro is pyxsqmsll2000, which is a stupid name for a Microsoft SQL 2000 XML access client. SQL 2000 has an XML interface which you can enable: pyxsqmsll2000 can send SQL statements via HTTP and actually understands the results that come back.
- all versions of ssh are non-interactive with respect to password input. i had to patch open-ssh to accept passwords on the command-line (ssh password:user@host).
- last time i checked, there were locking issues with the version of MySQL i was using (2001). the same table in one of the databases is opened _three_ times under different names, one with write access and the other two aliases with read access.