# gdonaj/gmonitor architecture

> Architecture diagram of the GitHub repository gdonaj/gmonitor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gdonaj/gmonitor
- Repository: https://github.com/gdonaj/gmonitor

## Overview

Gmonitor is a lightweight, push-based host-status dashboard. Hosts submit reports; the server optionally checks a shared key and persists host data. Users authenticate with view-only or admin passwords; the dashboard evaluates staleness and removal timeouts before rendering host cards. Admins can configure display, timeout, and access settings or clean up stale entries. The excerpts show the persistence and route logic in one Flask module; report handling is partly unsampled, so its links follow the README and only clearly supported behavior is shown.

Main entry points: [`src/Gmonitor.py`](https://github.com/gdonaj/gmonitor/blob/main/src/Gmonitor.py) (Dashboard handler), [`src/Gmonitor.ini`](https://github.com/gdonaj/gmonitor/blob/main/src/Gmonitor.ini) (Runtime configuration), [`src/templates/login.html`](https://github.com/gdonaj/gmonitor/blob/main/src/templates/login.html) (Login page), [`src/templates/setting.html`](https://github.com/gdonaj/gmonitor/blob/main/src/templates/setting.html) (Settings form)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_reporting["Host reporting"]
  node_report_route["Report endpoint<br/>[Gmonitor.py]"]
  node_key_check["Shared-key check<br/>[Gmonitor.py]"]
end

subgraph group_access["Access and settings"]
  node_login["Password login<br/>[Gmonitor.py]"]
  node_auth_template["Login page<br/>[login.html]"]
  node_settings_route["Settings page<br/>[Gmonitor.py]"]
  node_settings_template["Settings form<br/>[setting.html]"]
end

subgraph group_dashboard["Dashboard"]
  node_dashboard_route["Dashboard handler<br/>[Gmonitor.py]"]
  node_staleness["Timeout evaluation<br/>[Gmonitor.py]"]
  node_dashboard_template["Host card grid<br/>[dashboard.html]"]
  node_cleanup["Stale cleanup<br/>[Gmonitor.py]"]
end

subgraph group_state["Persisted state"]
  node_settings_store[("Settings JSON store<br/>[Gmonitor.py]")]
  node_inventory_store[("Inventory JSON store<br/>[Gmonitor.py]")]
  node_config["Runtime configuration<br/>[Gmonitor.ini]"]
end

node_hosts(("Reporting hosts"))
node_users(("Dashboard users"))

node_hosts -->|"POST reports"| node_report_route
node_report_route -->|"loads settings"| node_settings_store
node_report_route -->|"checks key"| node_key_check
node_report_route -->|"stores reports"| node_inventory_store
node_users -->|"submits password"| node_login
node_login -->|"loads passwords"| node_settings_store
node_login -->|"renders login"| node_auth_template
node_users -->|"requests dashboard"| node_dashboard_route
node_dashboard_route -->|"loads settings"| node_settings_store
node_dashboard_route -->|"loads inventory"| node_inventory_store
node_dashboard_route -->|"evaluates timeouts"| node_staleness
node_staleness -->|"saves removals"| node_inventory_store
node_dashboard_route -->|"renders cards"| node_dashboard_template
node_users -->|"admin request"| node_settings_route
node_settings_route -->|"loads and saves"| node_settings_store
node_settings_route -->|"renders form"| node_settings_template
node_users -->|"admin cleanup"| node_cleanup
node_cleanup -->|"removes stale entries"| node_inventory_store
node_config -->|"configures files"| node_report_route
node_config -->|"configures files"| node_dashboard_route

click node_report_route "https://github.com/gdonaj/gmonitor/blob/main/src/Gmonitor.py"
click node_key_check "https://github.com/gdonaj/gmonitor/blob/main/src/Gmonitor.py"
click node_login "https://github.com/gdonaj/gmonitor/blob/main/src/Gmonitor.py"
click node_auth_template "https://github.com/gdonaj/gmonitor/blob/main/src/templates/login.html"
click node_settings_route "https://github.com/gdonaj/gmonitor/blob/main/src/Gmonitor.py"
click node_settings_template "https://github.com/gdonaj/gmonitor/blob/main/src/templates/setting.html"
click node_dashboard_route "https://github.com/gdonaj/gmonitor/blob/main/src/Gmonitor.py"
click node_staleness "https://github.com/gdonaj/gmonitor/blob/main/src/Gmonitor.py"
click node_dashboard_template "https://github.com/gdonaj/gmonitor/blob/main/src/templates/dashboard.html"
click node_cleanup "https://github.com/gdonaj/gmonitor/blob/main/src/Gmonitor.py"
click node_settings_store "https://github.com/gdonaj/gmonitor/blob/main/src/Gmonitor.py"
click node_inventory_store "https://github.com/gdonaj/gmonitor/blob/main/src/Gmonitor.py"
click node_config "https://github.com/gdonaj/gmonitor/blob/main/src/Gmonitor.ini"

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_report_route,node_key_check,node_users toneBlue
class node_login,node_auth_template,node_settings_route,node_settings_template toneAmber
class node_dashboard_route,node_staleness,node_dashboard_template,node_cleanup toneMint
class node_settings_store,node_inventory_store,node_config toneRose
class node_hosts toneIndigo
```

## Components

### Host reporting

- [Report endpoint](https://github.com/gdonaj/gmonitor/blob/main/src/Gmonitor.py): `src/Gmonitor.py`
- [Shared-key check](https://github.com/gdonaj/gmonitor/blob/main/src/Gmonitor.py): `src/Gmonitor.py`

### Access and settings

- [Password login](https://github.com/gdonaj/gmonitor/blob/main/src/Gmonitor.py): `src/Gmonitor.py`
- [Login page](https://github.com/gdonaj/gmonitor/blob/main/src/templates/login.html): `src/templates/login.html`
- [Settings page](https://github.com/gdonaj/gmonitor/blob/main/src/Gmonitor.py): `src/Gmonitor.py`
- [Settings form](https://github.com/gdonaj/gmonitor/blob/main/src/templates/setting.html): `src/templates/setting.html`

### Dashboard

- [Dashboard handler](https://github.com/gdonaj/gmonitor/blob/main/src/Gmonitor.py): `src/Gmonitor.py`
- [Timeout evaluation](https://github.com/gdonaj/gmonitor/blob/main/src/Gmonitor.py): `src/Gmonitor.py`
- [Host card grid](https://github.com/gdonaj/gmonitor/blob/main/src/templates/dashboard.html): `src/templates/dashboard.html`
- [Stale cleanup](https://github.com/gdonaj/gmonitor/blob/main/src/Gmonitor.py): `src/Gmonitor.py`

### Persisted state

- [Settings JSON store](https://github.com/gdonaj/gmonitor/blob/main/src/Gmonitor.py): `src/Gmonitor.py`
- [Inventory JSON store](https://github.com/gdonaj/gmonitor/blob/main/src/Gmonitor.py): `src/Gmonitor.py`
- [Runtime configuration](https://github.com/gdonaj/gmonitor/blob/main/src/Gmonitor.ini): `src/Gmonitor.ini`

### Other components

- **Reporting hosts**
- **Dashboard users**

## Connections

- Reporting hosts → Report endpoint: POST reports
- Report endpoint → Settings JSON store: loads settings
- Report endpoint → Shared-key check: checks key
- Report endpoint → Inventory JSON store: stores reports
- Dashboard users → Password login: submits password
- Password login → Settings JSON store: loads passwords
- Password login → Login page: renders login
- Dashboard users → Dashboard handler: requests dashboard
- Dashboard handler → Settings JSON store: loads settings
- Dashboard handler → Inventory JSON store: loads inventory
- Dashboard handler → Timeout evaluation: evaluates timeouts
- Timeout evaluation → Inventory JSON store: saves removals
- Dashboard handler → Host card grid: renders cards
- Dashboard users → Settings page: admin request
- Settings page → Settings JSON store: loads and saves
- Settings page → Settings form: renders form
- Dashboard users → Stale cleanup: admin cleanup
- Stale cleanup → Inventory JSON store: removes stale entries
- Runtime configuration → Report endpoint: configures files
- Runtime configuration → Dashboard handler: configures files
