You might be able to customize a product like TCPWatch to do what you want http://www.zope.org/Members/hathawsh/tcpwatch