Architecture
How ProxMenux Monitor is packaged, what runs inside the AppImage, and how requests flow from the browser through the Flask backend to the host's tooling and SQLite store.
One process, many responsibilities
Request flow
A typical dashboard data request follows this path; browser-only preferences can be handled locally:
Protected routes validate JWT when authentication is enabled. Core routes and blueprints return cached or newly collected host data. The optional Fail2Ban hook checks its cached jail ban list. Forwarded client-IP headers are trusted only with PROXMENUX_TRUST_PROXY=1; otherwise the peer address is used. Persistent state includes SQLite databases and JSON files, including auth.json.
The process also runs background threads. The examples below sample host data, update caches and SQLite, and dispatch notifications. Other workers also exist, and notification delivery depends on its enabled setting:
| Thread | Cadence | Job |
|---|---|---|
| _temperature_collector_loop | 60 s | Records CPU temperature and a network-latency sample into the history DB so the dashboard graphs have data even when no client is connected. |
| _health_collector_loop | 5 min | Runs the full Health Monitor cycle (10 categories), persists active errors, dismissals and disk observations, and feeds new events into the notification engine. |
| _vital_signs_sampler | CPU 5 s; temperature 15 s; memory 30 s | Samples CPU usage, memory and CPU temperature for live metrics and sustained-condition detection, independently of the five-minute health collector. |
| notification_manager.start() | event-driven | Spawns the journal / task / hook watchers (JournalWatcher, TaskWatcher, ProxmoxHookWatcher) and dispatches to configured channels with optional AI rewriting. |
systemd unit
The installer drops a unit at /etc/systemd/system/proxmenux-monitor.service. Default content:
[Unit]
Description=ProxMenux Monitor - Web Dashboard
After=network.target pve-cluster.service
[Service]
Type=simple
User=root
WorkingDirectory=/usr/local/share/proxmenux
ExecStart=/usr/local/share/proxmenux/monitor-app/AppRun
Restart=on-failure
RestartSec=10
Environment="PORT=8008"
[Install]
WantedBy=multi-user.targetUser=root— the supported service runs with root privileges for host operations such as SMART access,pveshand ZFS management. Its web-terminal processes inherit those privileges.Restart=on-failurewith a 10-second back-off — non-zero exits relaunch automatically.After=network.target pve-cluster.service: orders startup after the network target and the Proxmox cluster filesystem; it does not guarantee an assigned IP, DNS or external connectivity.
Inspect the live unit
systemctl cat proxmenux-monitor.service # show the unit content systemctl status proxmenux-monitor.service # state + recent log journalctl -u proxmenux-monitor.service -f # follow live
What the AppImage contains
The AppImage is a self-mounting filesystem. AppRun at the root sets up the environment and execs flask_server.py:
AppDir/
├── AppRun # entrypoint: sets PATH/LD_LIBRARY_PATH, exec flask_server
├── usr/
│ ├── bin/
│ │ ├── flask_server.py # main process
│ │ ├── flask_*_routes.py # Flask blueprints (auth, health, terminal, …)
│ │ ├── auth_manager.py # JWT + TOTP + API tokens
│ │ ├── health_monitor.py # 10-category checker
│ │ ├── health_persistence.py # SQLite layer
│ │ ├── notification_manager.py # orchestrator
│ │ ├── notification_channels.py # Telegram, Discord, Email, …
│ │ ├── notification_templates.py # message rendering + AI hook
│ │ ├── notification_events.py # JournalWatcher, TaskWatcher, …
│ │ ├── ai_providers/ # OpenAI · Anthropic · Gemini · Groq · Ollama · OpenRouter
│ │ ├── proxmox_storage_monitor.py # storage pool inspection
│ │ ├── hardware_monitor.py # CPU/PCIe/GPU enumeration
│ │ ├── ipmitool, sensors, upsc # vendored hardware tools
│ │ └── …
│ ├── lib/python3/ # vendored Python deps (Flask, JWT, psutil, …)
│ └── share/ # icons + .desktop file
└── web/ # Next.js static export
├── index.html
├── _next/ # JS / CSS chunks
└── manifest.json # PWA manifestTwo consequences of this layout:
- Bundled Python packages. Python packages ship inside the AppImage and run on the host's own Python 3.11 (PVE 8) or 3.13 (PVE 9) interpreter, without installing anything into the host's system Python. The application still uses host kernel interfaces and external host tools.
- Hardware clients are bundled too.
ipmitool,lm-sensorsandupscare included. Readings still depend on supported hardware, access to sensors and, for UPS data, a configured NUT server.
Flask app structure
flask_server.py creates one Flask(__name__) instance with restricted CORS origins, registers ten blueprints directly and initializes terminal routes. The table highlights the main modules; PBS, Monitor links, audit and VM-backup blueprints are also registered. PVE-specific prewarmers run only on PVE hosts.
| Blueprint / module | Routes prefix | Owns |
|---|---|---|
| flask_server.py | /api/system /api/storage /api/network /api/vms /api/hardware /api/logs /api/prometheus | Core data endpoints + static dashboard serving + optional Fail2Ban app-level check (active only when Fail2Ban is installed on the host with the proxmenux jail). |
| flask_auth_routes.py | /api/auth/* | Login, JWT issuing, TOTP setup/verify, password change, API token generation. |
| flask_health_routes.py | /api/health/* | Health probes, detailed status, active and dismissed errors, and suppression settings. Protected routes require authentication when it is enabled. |
| flask_terminal_routes.py | /api/terminal/* + WS | PTY allocation per session and WebSocket pipe to xterm.js in the browser. |
| flask_notification_routes.py | /api/notifications/* | Channel CRUD, test-send, AI provider config, history, manual sends. |
| flask_security_routes.py | /api/security/* | Authentication failures and, when Fail2Ban is installed, jail status, ban events and manual unban. |
| flask_proxmenux_routes.py | /api/proxmenux/* | Reads the ProxMenux post-install optimizations recorded in the host registry. |
| flask_oci_routes.py | /api/oci/* | OCI / container app deployment helpers (Proxmox VE 9.1+). |
Integration endpoints and their request/response formats are described in API Reference.
Data sources
Host data comes mainly from standard libraries, files and administrative commands. Some guest information also depends on the QEMU Guest Agent or commands executed inside a CT:
| Source | Used for |
|---|---|
| psutil | CPU load, memory, swap, mountpoint usage, NIC counters, process list. |
| pvesh / qm / pct | Proxmox node info, VM and CT inventory and config, storage pools, task history. |
| smartctl | SATA / NVMe attributes, SMART health, wear / lifetime, model and serial. |
| zpool / zfs | Pool state (ONLINE / DEGRADED / FAULTED / UNAVAIL), scrub progress, dataset usage. |
| journalctl | System logs, OOM kills, ATA / NVMe / dm errors, security events, custom service units. |
| ip / iproute2 | Interfaces, addresses, bridges, bonds, OVS-managed devices. |
| nvidia-smi · intel_gpu_top | Available GPU utilisation, VRAM, temperature and encoder/decoder measurements; fields depend on the vendor, tool and driver. |
| lspci · lscpu · dmidecode | PCIe topology, CPU model and topology, board and BIOS info. |
| ipmitool · sensors | Out-of-band sensors, fan speeds, board temperatures (when supported). |
| upsc (NUT) | UPS battery state, load, runtime — when a NUT server is configured on the host. |
Output is cached — not every request hits the host
smartctl -a, pvesh get) are wrapped in time-bound caches inside the Flask process so a busy dashboard tab doesn't hammer the disk or the cluster API. The cache TTLs are tuned per source (a few seconds for live metrics, several minutes for SMART).Persistence
Several state files have different contents and access requirements:
| Path | Owner | Contents |
|---|---|---|
| /usr/local/share/proxmenux/health_monitor.db | root:root | SQLite DB. Tables: errors, events, disk_registry, disk_observations, user_settings, notification_history, excluded_storages, excluded_interfaces. WAL journal mode. |
| /usr/local/share/proxmenux/.notification_key | root 0600 | 32-byte master key for the ENC2 notification-secret format. The implementation uses a per-value random salt, derived keys and a MAC; old fixed-key XOR values are supported for migration. |
| /root/.config/proxmenux-monitor/auth.json | root:root | Authentication configuration: enabled flag, username, salted PBKDF2-HMAC-SHA256 password hash, TOTP secret, backup codes, per-install JWT signing secret, API-token metadata and revocation hashes. Legacy SHA-256 password hashes are migrated on successful login. |
| /var/log/proxmenux-auth.log | root:root | Plain-text authentication event log, written independently of Fail2Ban. When the [proxmenux] jail is installed and enabled, it reads this log to detect repeated failed logins. Without that jail, the log remains available for inspection. |
Back up auth.json before reinstalling
/root/.config/proxmenux-monitor/auth.json and /usr/local/share/proxmenux/health_monitor.db. Preserve auth.json with its per-install jwt_secret to retain token validity and metadata. The database stores health and notification state independently. Back up .notification_key with the database to restore encrypted channel settings; restoring the DB alone does not restore API authentication.Health Monitor cycle
About every five minutes, the background collector invokes health_monitor.py to run the checks behind the dashboard’s ten categories:
- Critical PVE services (
pveproxy,pvedaemon,pvestatd,pve-cluster). - Proxmox storage pools (
pvesh get /storage+ per-storage availability). - Disks and filesystems: SMART, dmesg I/O errors, ZFS pool health, mountpoint capacity.
- VMs and CTs: failed starts, crashed guests, QMP errors, shutdown failures.
- Network: bridge / bond status, link state, latency to the gateway.
- Updates: pending package upgrades and security patches.
- Logs: persistent / spike / cascade pattern detection in the system journal.
- Memory: OOM killer activity, sustained high pressure.
- CPU: usage and CPU temperature checked against the configurable thresholds; available sensors depend on the hardware.
- Security: authentication failures, ban events, fail2ban jail status.
Findings use a stable error_key, category and severity. Existing records in errors are updated in place (last_seen, severity, reason) rather than duplicated. Notification delivery also has its own fingerprint and cooldown rules.
Cleanup can auto-resolve stale errors using category Suppression Duration values and state-based rules, remove orphan records for resources that were removed, and prune events older than 30 days. The categories and dashboard are described in Dashboard → Health Monitor.
Notification engine
notification_manager.py is the orchestrator. It loads the configured channels, owns the delivery queue, and exposes both a Python API (for Flask routes and the Health Monitor cycle) and a CLI entrypoint (for the .sh hook scripts shipped with ProxMenux).
- Watchers push events:
JournalWatchertails the system journal,TaskWatcherpolls the Proxmox task list,ProxmoxHookWatcherreacts to backup / replication / snapshot hooks, andPollingCollectorhandles slow data sources. - Templates turn an event into a (title, body) pair. The same template can run through the configured AI provider (OpenAI / Anthropic / Gemini / Groq / Ollama / OpenRouter) to produce a plain-language rewrite; both versions are stored in
notification_history. - Channels deliver messages through services including Telegram, Discord, Email, Gotify, Pushover and Apprise. Implementations in
notification_channels.pyuse the sharedcreate_channel()/send()interface. - Encryption. Sensitive settings (
telegram.bot_token,discord.webhook_url,pushover.user_key,pushover.api_token,ai_api_key_*,email.password) are encrypted with the key in.notification_keybefore being written to the DB and are masked in the interface.
Per-event toggles, channel overrides and AI configuration are surfaced in Settings → Notifications and Settings → AI Assistant.
WebSocket terminal
The Terminal tab in the dashboard is a thin xterm.js client wired to a server-side PTY through a WebSocket. Two transport modes:
- HTTP mode (default): the built-in Flask server with
flask-sockhandles WebSocket upgrade requests. - HTTPS / WSS mode: the TLS server uses
gevent.pywsgi.WSGIServerwith its default handler;flask-sockhandles WebSocket connections over TLS.
Terminal child processes inherit User=root from the service. Opening a WebSocket requires a short-lived, single-use ticket obtained from the authenticated terminal-ticket endpoint with administrative scope.
If you access the Monitor through a reverse proxy, make sure WebSocket forwarding is enabled (the Upgrade and Connection headers). Without it the terminal won't work.
Reverse proxy & Fail2Ban
Client-IP selection and optional application-level blocking depend on these settings and components:
- Client IP selection. The
before_requestban check and auth logging trustX-Forwarded-For, thenX-Real-IP, only when PROXMENUX_TRUST_PROXY=1. Otherwise they userequest.remote_addr. Forwarded headers are not accepted automatically. - Optional application-level Fail2Ban. A proxy connection can present the proxy as the TCP peer. When the trusted client address is available and the
proxmenuxjail is active, Flask rejects listed IPs with HTTP 403. The ban list is cached for 30 seconds and refreshed by request processing after expiry, rather than polled by a dedicated timer.
Fail2Ban is not bundled
fail2ban-client or the proxmenux jail is absent, this application hook does not block requests. The configured authentication policy still applies.Reverse-proxy snippets (Nginx / Caddy / Traefik) and the Fail2Ban jail walkthrough are in Access & Authentication and Security → Fail2Ban.
Where to next
- Access & Authentication — first-launch setup, password + TOTP 2FA, reverse-proxy snippets, Fail2Ban jail.
- API Reference — integration endpoints, token management and authentication conventions.
- Settings → ProxMenux Monitor — the in-menu service toggle and status verification flow inside the ProxMenux TUI.