move page builder function into Host class

This commit is contained in:
2016-04-28 16:19:38 +02:00
parent 6248882b20
commit fda35d8738
2 changed files with 27 additions and 14 deletions
+5 -14
View File
@@ -306,8 +306,8 @@ def checkoverdue():
pmsg.append(conn.afam)
if pmsg != []:
if h in watchhosts:
email("overdue", "%s overdue" % ",".join(pmsg))
pushover("%s %s overdue" % (h, join(pmsg)))
email("overdue", "%s overdue" % " and ".join(pmsg))
pushover("%s %s overdue" % (h, " and ".join(pmsg)))
log(h, "%s overdue" % " and ".join(pmsg))
@@ -537,23 +537,14 @@ class HttpHandler(BaseHTTPServer.BaseHTTPRequestHandler):
res=self.buildhead(refresh=60, extras=tcss)
res.append("<H2>Heartbeat status %s</h2>" % VER)
res.append('<table id="ntable" class="sortable">')
res.append(ubHost.htmlheaders())
hosts_sorted = Host.hosts.keys()
if len(hosts_sorted):
hosts_sorted.sort()
for h in hosts_sorted:
res.append(Host.hosts[h].htmldisp())
res.append("</table>")
le = max(40 - len(Host.hosts), 3)
res.append("<h4>Log of Events</h4>")
for m in msgs[len(msgs)-le:]:
res.append("%s<BR>" % m)
res += ubHost.buildhosttable()
res += ubHost.buildmsgtable(msgs)
res.append('<p> %s (%s)</p>' % (time.strftime("%H:%M:%S", time.localtime(now)), os.environ.get('TZ', 'CET-1CDT')))
res.append("</body></html>")
return res
def builderror(self, code, cause, lcause):
res=[]
res.append('<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">')