refactor monitor, add threshold rtesting
This commit is contained in:
+4
-4
@@ -8,6 +8,7 @@ import os
|
||||
import logging
|
||||
from aiohttp import web
|
||||
import jinja2
|
||||
from . import data
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -22,7 +23,6 @@ async def start(
|
||||
port: int,
|
||||
config,
|
||||
hbdclass,
|
||||
msgs_getter,
|
||||
log=None,
|
||||
email=None,
|
||||
pushmsg=None,
|
||||
@@ -52,7 +52,7 @@ async def start(
|
||||
res.append('<body BGCOLOR = "#FFFFFF" LINK = "#008000" VLINK = "#008000">')
|
||||
res.append(f"<H2>Heartbeat status {VER}</h2>")
|
||||
res += hbdclass.ubHost.buildhosttable()
|
||||
res += hbdclass.ubHost.buildmsgtable(msgs_getter())
|
||||
res += hbdclass.ubHost.buildmsgtable(data.msgs)
|
||||
res.append(
|
||||
"<p> %s (%s)</p>"
|
||||
% (
|
||||
@@ -69,7 +69,7 @@ async def start(
|
||||
return web.json_response(json.loads("[" + ",".join(lst) + "]"))
|
||||
|
||||
async def api_messages(request):
|
||||
lst = msgs_getter()[-30:]
|
||||
lst = data.msgs[-30:]
|
||||
return web.json_response(lst)
|
||||
|
||||
async def cmd(request):
|
||||
@@ -155,7 +155,7 @@ async def start(
|
||||
hosts=[
|
||||
hbdclass.Host.hosts[h].stateinfo() for h in sorted(hbdclass.Host.hosts)
|
||||
],
|
||||
messages=msgs_getter()[-30:],
|
||||
messages=data.msgs[-30:],
|
||||
)
|
||||
return web.Response(text=body, content_type="text/html")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user