diff --git a/hbd b/hbd index 250edbd..7d417fb 100755 --- a/hbd +++ b/hbd @@ -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("

Heartbeat status %s

" % VER) - res.append('') - 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("
") - le = max(40 - len(Host.hosts), 3) - res.append("

Log of Events

") - for m in msgs[len(msgs)-le:]: - res.append("%s
" % m) + res += ubHost.buildhosttable() + res += ubHost.buildmsgtable(msgs) res.append('

%s (%s)

' % (time.strftime("%H:%M:%S", time.localtime(now)), os.environ.get('TZ', 'CET-1CDT'))) res.append("") return res + def builderror(self, code, cause, lcause): res=[] res.append('') diff --git a/hbdclass.py b/hbdclass.py index 74406c9..f33390a 100644 --- a/hbdclass.py +++ b/hbdclass.py @@ -277,6 +277,28 @@ class Host: # (self.name, self.dispstate(), self.dispstats(), ipv4addr, ipv6addr, lastts, self.cver) + def buildhosttable(self): + res = [] + res.append('') + 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("
") + return res + + + def buildmsgtable(self, msgs): + res = [] + le = max(40 - len(Host.hosts), 3) + res.append("

Log of Events

") + for m in msgs[len(msgs)-le:]: + res.append("%s
" % m) + return res + + # create fake "unbound objects", remove in Python 3.0 ubHost = Host(None)