# ryuuen8/mgkk-monitoring-tool architecture

> Architecture diagram of the GitHub repository ryuuen8/mgkk-monitoring-tool, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ryuuen8/mgkk-monitoring-tool
- Repository: https://github.com/ryuuen8/mgkk-monitoring-tool

## Overview

MGKK Monitoring Tool is a network-infrastructure monitoring application. Operators sign in, manage inventory and profiles, then schedule device checks; workers collect reachability and telemetry, persist snapshots and publish metrics/events for the UI, Prometheus and alerting. Distinct capabilities include subnet discovery, topology, audit, syslog/traps and alert silences. The map combines the README’s documented capabilities with excerpted calls and SOURCE INDEX references; unsampled implementation details and some integrations are shown only where documented.

Main entry points: [`backend/app/worker.py`](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/worker.py) (Poll worker), [`frontend/src/App.tsx`](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/frontend/src/App.tsx) (Monitoring UI), [`backend/app/api/routes/v1.py`](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/api/routes/v1.py) (Inventory and feature routes), [`backend/app/services/events.py`](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/services/events.py) (Live event service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Operator experience"]
  node_webapp["Monitoring UI<br/>[App.tsx]"]
  node_authui["Browser authentication<br/>[AuthProvider.tsx]"]
  node_deviceview["Device and topology views<br/>[DeviceDetailV1.tsx]"]
  node_discoveryview["Discovery queue<br/>[DiscoveryQueue.tsx]"]
  node_alertsview["Alerts and audit<br/>[AlertsCenter.tsx]"]
  node_api_client["Typed API client<br/>[client.ts]"]
end

subgraph group_api["API and inventory"]
  node_api["FastAPI application<br/>[main.py]"]
  node_routes["Inventory and feature routes<br/>[v1.py]"]
  node_inventory["Inventory data access<br/>[devices.py]"]
  node_database[("PostgreSQL inventory<br/>[session.py]")]
end

subgraph group_polling["Polling and discovery"]
  node_profiles["Device profiles<br/>[schema.py]"]
  node_scheduler["Poll scheduling<br/>[scheduling.py]"]
  node_worker["Poll worker<br/>[worker.py]"]
  node_collector_contract["Collector contracts<br/>[base.py]"]
  node_snmp["Generic SNMP collector<br/>[collector.py]"]
  node_cisco["Cisco collector<br/>[collector.py]"]
  node_profile_engine["Profile-driven collection<br/>[profile_engine.py]"]
  node_discovery["Network discovery<br/>[discovery.py]"]
end

subgraph group_observability["Telemetry and events"]
  node_topology["Topology computation<br/>[topology.py]"]
  node_prometheus["Prometheus metrics<br/>[prometheus.py]"]
  node_events["Live event service<br/>[events.py]"]
  node_syslog["Syslog receiver and parser<br/>[receiver.py]"]
  node_traps["SNMP trap listener<br/>[listener.py]"]
end

subgraph group_integrations["External integrations"]
  node_authservice["Keycloak"]
  node_alertmanager["Alertmanager"]
  node_prometheus_external["Prometheus server"]
  node_redis[("Redis event transport")]
end

node_operator(("Network operator"))
node_device(("Managed network devices"))

node_operator -->|"uses"| node_webapp
node_webapp -->|"authenticates through"| node_authui
node_authui -->|"signs in"| node_authservice
node_webapp -->|"renders"| node_deviceview
node_webapp -->|"renders"| node_discoveryview
node_webapp -->|"renders"| node_alertsview
node_deviceview -->|"requests data"| node_api_client
node_discoveryview -->|"requests data"| node_api_client
node_alertsview -->|"requests data"| node_api_client
node_api_client -->|"calls HTTP API"| node_api
node_api -->|"mounts routes"| node_routes
node_routes -->|"accesses inventory"| node_inventory
node_inventory -->|"reads and writes"| node_database
node_routes -.->|"starts discovery"| node_discovery
node_routes -.->|"serves topology"| node_topology
node_scheduler -->|"enqueues device jobs"| node_worker
node_worker -->|"loads and saves state"| node_database
node_worker -->|"resolves profile"| node_profiles
node_worker -->|"dispatches collection"| node_collector_contract
node_worker -->|"dispatches SNMP"| node_snmp
node_worker -->|"dispatches Cisco"| node_cisco
node_worker -->|"collects profile metrics"| node_profile_engine
node_profile_engine -->|"uses SNMP operations"| node_snmp
node_worker -->|"polls"| node_device
node_worker -->|"publishes metrics"| node_prometheus
node_prometheus_external -.->|"scrapes"| node_prometheus
node_worker -->|"publishes events"| node_events
node_events -.->|"uses transport"| node_redis
node_api -->|"serves live events"| node_events
node_syslog -.->|"emits events"| node_events
node_traps -.->|"emits events"| node_events
node_prometheus_external -->|"routes alerts"| node_alertmanager
node_routes -->|"manages silences"| node_alertmanager
node_topology -.->|"combines stored topology"| node_database

click node_webapp "https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/frontend/src/App.tsx"
click node_authui "https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/frontend/src/auth/AuthProvider.tsx"
click node_deviceview "https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/frontend/src/components/DeviceDetailV1.tsx"
click node_discoveryview "https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/frontend/src/components/DiscoveryQueue.tsx"
click node_alertsview "https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/frontend/src/components/AlertsCenter.tsx"
click node_api_client "https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/frontend/src/api/client.ts"
click node_api "https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/main.py"
click node_routes "https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/api/routes/v1.py"
click node_inventory "https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/crud/devices.py"
click node_database "https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/db/session.py"
click node_profiles "https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/profiles/schema.py"
click node_scheduler "https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/scheduling.py"
click node_worker "https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/worker.py"
click node_collector_contract "https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/collectors/base.py"
click node_snmp "https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/collectors/generic_snmp/collector.py"
click node_cisco "https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/collectors/cisco/collector.py"
click node_profile_engine "https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/collectors/profile_engine.py"
click node_discovery "https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/services/discovery.py"
click node_topology "https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/services/topology.py"
click node_prometheus "https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/services/prometheus.py"
click node_events "https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/services/events.py"
click node_syslog "https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/syslog/receiver.py"
click node_traps "https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/traps/listener.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_webapp,node_authui,node_deviceview,node_discoveryview,node_alertsview,node_api_client toneBlue
class node_api,node_routes,node_inventory,node_database toneAmber
class node_profiles,node_scheduler,node_worker,node_collector_contract,node_snmp,node_cisco,node_profile_engine,node_discovery toneMint
class node_topology,node_prometheus,node_events,node_syslog,node_traps toneRose
class node_authservice,node_alertmanager,node_prometheus_external,node_redis,node_operator,node_device toneIndigo
```

## Components

### Operator experience

- [Monitoring UI](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Browser authentication](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/frontend/src/auth/AuthProvider.tsx): `frontend/src/auth/AuthProvider.tsx`
- [Device and topology views](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/frontend/src/components/DeviceDetailV1.tsx): `frontend/src/components/DeviceDetailV1.tsx`
- [Discovery queue](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/frontend/src/components/DiscoveryQueue.tsx): `frontend/src/components/DiscoveryQueue.tsx`
- [Alerts and audit](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/frontend/src/components/AlertsCenter.tsx): `frontend/src/components/AlertsCenter.tsx`
- [Typed API client](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`

### API and inventory

- [FastAPI application](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/main.py): `backend/app/main.py`
- [Inventory and feature routes](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/api/routes/v1.py): `backend/app/api/routes/v1.py`
- [Inventory data access](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/crud/devices.py): `backend/app/crud/devices.py`
- [PostgreSQL inventory](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/db/session.py): `backend/app/db/session.py`

### Polling and discovery

- [Device profiles](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/profiles/schema.py): `backend/app/profiles/schema.py`
- [Poll scheduling](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/scheduling.py): `backend/app/scheduling.py`
- [Poll worker](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/worker.py): `backend/app/worker.py`
- [Collector contracts](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/collectors/base.py): `backend/app/collectors/base.py`
- [Generic SNMP collector](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/collectors/generic_snmp/collector.py): `backend/app/collectors/generic_snmp/collector.py`
- [Cisco collector](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/collectors/cisco/collector.py): `backend/app/collectors/cisco/collector.py`
- [Profile-driven collection](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/collectors/profile_engine.py): `backend/app/collectors/profile_engine.py`
- [Network discovery](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/services/discovery.py): `backend/app/services/discovery.py`

### Telemetry and events

- [Topology computation](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/services/topology.py): `backend/app/services/topology.py`
- [Prometheus metrics](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/services/prometheus.py): `backend/app/services/prometheus.py`
- [Live event service](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/services/events.py): `backend/app/services/events.py`
- [Syslog receiver and parser](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/syslog/receiver.py): `backend/app/syslog/receiver.py`
- [SNMP trap listener](https://github.com/ryuuen8/mgkk-monitoring-tool/blob/main/backend/app/traps/listener.py): `backend/app/traps/listener.py`

### External integrations

- **Keycloak**
- **Alertmanager**
- **Prometheus server**
- **Redis event transport**

### Other components

- **Network operator**
- **Managed network devices**

## Connections

- Network operator → Monitoring UI: uses (evidence: `README.md`)
- Monitoring UI → Browser authentication: authenticates through (evidence: `frontend/src/App.tsx`)
- Browser authentication → Keycloak: signs in (evidence: `README.md`)
- Monitoring UI → Device and topology views: renders (evidence: `frontend/src/App.tsx`)
- Monitoring UI → Discovery queue: renders (evidence: `frontend/src/App.tsx`)
- Monitoring UI → Alerts and audit: renders (evidence: `frontend/src/App.tsx`)
- Device and topology views → Typed API client: requests data (evidence: `frontend/src/components/DeviceDetailV1.tsx`)
- Discovery queue → Typed API client: requests data (evidence: `frontend/src/components/DiscoveryQueue.tsx`)
- Alerts and audit → Typed API client: requests data (evidence: `frontend/src/components/AlertsCenter.tsx`)
- Typed API client → FastAPI application: calls HTTP API (evidence: `README.md`)
- FastAPI application → Inventory and feature routes: mounts routes (evidence: `backend/app/main.py`)
- Inventory and feature routes → Inventory data access: accesses inventory
- Inventory data access → PostgreSQL inventory: reads and writes (evidence: `README.md`)
- Inventory and feature routes → Network discovery: starts discovery
- Inventory and feature routes → Topology computation: serves topology
- Poll scheduling → Poll worker: enqueues device jobs (evidence: `README.md`)
- Poll worker → PostgreSQL inventory: loads and saves state (evidence: `backend/app/worker.py`)
- Poll worker → Device profiles: resolves profile (evidence: `backend/app/worker.py`)
- Poll worker → Collector contracts: dispatches collection (evidence: `backend/app/worker.py`)
- Poll worker → Generic SNMP collector: dispatches SNMP (evidence: `backend/app/worker.py`)
- Poll worker → Cisco collector: dispatches Cisco (evidence: `backend/app/worker.py`)
- Poll worker → Profile-driven collection: collects profile metrics (evidence: `backend/app/worker.py`)
- Profile-driven collection → Generic SNMP collector: uses SNMP operations (evidence: `backend/app/collectors/profile_engine.py`)
- Poll worker → Managed network devices: polls (evidence: `README.md`)
- Poll worker → Prometheus metrics: publishes metrics (evidence: `backend/app/worker.py`)
- Prometheus server → Prometheus metrics: scrapes (evidence: `README.md`)
- Poll worker → Live event service: publishes events (evidence: `backend/app/worker.py`)
- Live event service → Redis event transport: uses transport (evidence: `README.md`)
- FastAPI application → Live event service: serves live events (evidence: `backend/app/main.py`)
- Syslog receiver and parser → Live event service: emits events
- SNMP trap listener → Live event service: emits events
- Prometheus server → Alertmanager: routes alerts (evidence: `README.md`)
- Inventory and feature routes → Alertmanager: manages silences
- Topology computation → PostgreSQL inventory: combines stored topology
