#!/usr/bin/env python import string, os VER = "mlog 1.00" hosts = ["weekend", "wingbat"] URI = "/~andreas/private/mlog.cgi?" print "Content-type: text/html" print "max-age: 0" print "expires: 0" print "pragma: no-cache" print "" print "" print "
" print ""
def hstlines(host):
cmd = "/sbin/ping -c 1 -w 2 %s 2>&1 >/dev/null" % host
r = os.system(cmd)
if r == 0:
p = os.popen("rsh %s tail -200 .heyu/logs/motion.log | grep -v again | tail -32" % host, "r")
l = p.readlines()
else:
l = ["Host %s is unreachable " % host]
return l
rep = []
for host in hosts:
rep.append(hstlines(host))
print '| %s | ') while 1: line = [] f = 0 for h in rep: try: line.append(h[i][:-1]) f = 1 except: line.append("") if f == 0: break print " |
|---|
| %s | ') i += 1 print ' |