don't output res - it's not calcuated correctly across restarts

fix formating so it works with the new index.py scheme
This commit is contained in:
andreas
2010-12-30 03:10:18 +00:00
parent eab48d7974
commit a1e973214f
+6 -5
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python #!/usr/bin/env python
# $Id: hbd,v 1.25 2010/08/21 14:37:53 andreas Exp $ # $Id: hbd,v 1.26 2010/12/30 03:10:18 andreas Exp $
# Wait for heartbeat messages and act on them (or their absence) # Wait for heartbeat messages and act on them (or their absence)
# #
import time, os, string, sys, socket, atexit, select, SocketServer, getopt, signal, cPickle import time, os, string, sys, socket, atexit, select, SocketServer, getopt, signal, cPickle
@@ -415,17 +415,18 @@ class HtmlHandler(SocketServer.BaseRequestHandler):
res.append("<meta http-equiv=Refresh content=%d>\n" % 60) res.append("<meta http-equiv=Refresh content=%d>\n" % 60)
res.append("</head>") res.append("</head>")
res.append('<body BGCOLOR="#FFFFFF" LINK="#008000" VLINK="#008000" BACKGROUND="/~andreas/images/tile.marble.gif">') res.append('<body BGCOLOR="#FFFFFF" LINK="#008000" VLINK="#008000" BACKGROUND="/~andreas/images/tile.marble.gif">')
res.append("<H2>Heartbeat status at %s (%s)</H2>" % (time.strftime("%H:%M:%S", time.localtime(now)), os.environ.get('TZ','Europe/Berlin'))) res.append("<H2>Heartbeat status</h2><h4> %s (%s)</H4>" % (time.strftime("%H:%M:%S", time.localtime(now)), os.environ.get('TZ','Europe/Berlin')))
res.append("<table>") res.append("<table>")
res.append("<tr><th>Host</th><th>State</th><th>IP Addr</th><th>Res</th><th>Last change</th></tr>\n" ) res.append("<tr><th>Host</th><th>State</th><th>IP Addr</th><th>Last change</th></tr>\n" )
hosts_sorted=hosts.keys() hosts_sorted=hosts.keys()
hosts_sorted.sort() hosts_sorted.sort()
for h in hosts_sorted: for h in hosts_sorted:
res.append("<tr><td>%-24s</td><td>%-7s</td><td>%-16s</td><td>%-3s</td><td>%-17s</td></tr>\n" % (h, hosts[h].state, hosts[h].addr, hosts[h].uppercent, time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(hosts[h].statetime)))) res.append("<tr><td>%-24s</td><td>%-7s</td><td>%-16s</td><td>%-17s</td></tr>\n" % (h, hosts[h].state, hosts[h].addr, time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(hosts[h].statetime))))
res.append("</table>") res.append("</table>")
res.append("<P>") res.append("<h4>Log of Events</h4>")
for m in msgs[len(msgs)-30:]: for m in msgs[len(msgs)-30:]:
res.append("%s<BR>" % m) res.append("%s<BR>" % m)
res.append("</body></html>")
try: try:
self.request.send(string.join(res,"\n")) self.request.send(string.join(res,"\n"))