# plugins/snmp/__init__.py from __future__ import annotations from typing import TYPE_CHECKING if TYPE_CHECKING: from quart import Quart _app: "Quart | None" = None def setup(app: "Quart") -> None: global _app _app = app from .models import SnmpDevice # noqa: F401 — registers the table def get_scheduled_tasks() -> list: from .scheduler import make_poll_task return [make_poll_task(_app)] def get_blueprint(): from .routes import snmp_bp return snmp_bp def get_nav() -> list[dict]: # Surfaces in the sidebar's Infrastructure group (SNMP device readings). return [{"label": "SNMP", "href": "/plugins/snmp/"}] def get_alert_metrics() -> dict[str, list[str]]: """SNMP metric names are the OID labels each device is configured with, so the list is empty here and the rule form offers the labels recorded so far.""" return {"snmp": []} def get_audit_entities() -> dict: """Audit rows about a device name it and link to its page.""" from .models import SnmpDevice return {"snmp_device": (SnmpDevice, "/plugins/snmp/devices/{}")} def register_mcp_tools(register) -> None: from .mcp_tools import register_tools register_tools(register) async def mcp_overview(db) -> list[dict]: from .mcp_tools import mcp_overview as findings return await findings(db)