seguro.commands.heartbeat_monitor.main

Functions

handle_archive(event)

handle_view_json(event)

login([redirect_to])

main([rload])

new_device_hb(logger, broker, msg)

The callback fn triggered by the heartbeat to update the device params.

render_json(id)

state_calculator(curr_vals)

Logic to calculate the maximum severity state and add remarks to be displayed per device on the web-ui.

update_device_state()

web_ui()

Landing page of the heartbeat monitor dashboard

Classes

AuthMiddleware(app[, dispatch])

CpuThermal

DevStatus(value[, names, module, qualname, ...])

Device

Severity(value[, names, module, qualname, ...])

theme_button(*args, **kwargs)

class seguro.commands.heartbeat_monitor.main.AuthMiddleware(app, dispatch=None)[source]

Bases: BaseHTTPMiddleware

Parameters:
  • app (ASGIApp)

  • dispatch (DispatchFunction | None)

async dispatch(request, call_next)[source]
Parameters:

request (Request)

class seguro.commands.heartbeat_monitor.main.CpuThermal[source]

Bases: TypedDict

critical: float
current: float
class seguro.commands.heartbeat_monitor.main.DevStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, Enum

ALIVE = 'alive'
ARCHIVED = 'archived'
OFFLINE = 'offline'
class seguro.commands.heartbeat_monitor.main.Device[source]

Bases: TypedDict

cpu_thermal: CpuThermal
disk_pct: float
hb_interval: float
id: str
last_ping: str
mem_available: float
mem_pct: float
ping_status: str
remark: str
state: str
state_colour: str
uptime: str
class seguro.commands.heartbeat_monitor.main.Severity(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

CRITICAL = 2
OK = 0
WARNING = 1
seguro.commands.heartbeat_monitor.main.handle_archive(event)[source]
Parameters:

event (GenericEventArguments)

seguro.commands.heartbeat_monitor.main.handle_view_json(event)[source]
Parameters:

event (GenericEventArguments)

seguro.commands.heartbeat_monitor.main.login(redirect_to='/')[source]
Parameters:

redirect_to (str)

Return type:

RedirectResponse | None

seguro.commands.heartbeat_monitor.main.main(rload=False)[source]
seguro.commands.heartbeat_monitor.main.new_device_hb(logger, broker, msg)[source]

The callback fn triggered by the heartbeat to update the device params.

Parameters:
  • logger (Logger)

  • broker (Client)

  • msg (Any)

seguro.commands.heartbeat_monitor.main.render_json(id)[source]
Parameters:

id (str)

seguro.commands.heartbeat_monitor.main.state_calculator(curr_vals)[source]

Logic to calculate the maximum severity state and add remarks to be displayed per device on the web-ui.

Parameters:

curr_vals (dict)

class seguro.commands.heartbeat_monitor.main.theme_button(*args, **kwargs)[source]

Bases: Button

component: Component | None = None
exposed_libraries: ClassVar[List[Library]] = []
extra_libraries: ClassVar[List[Library]] = []
libraries: ClassVar[List[Library]] = []
seguro.commands.heartbeat_monitor.main.update_device_state()[source]
seguro.commands.heartbeat_monitor.main.web_ui()[source]

Landing page of the heartbeat monitor dashboard