# nicolargo/glances architecture

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

- Interactive diagram: https://gitdiagram.com/nicolargo/glances
- Repository: https://github.com/nicolargo/glances

## Overview

Glances is a cross-platform system-monitoring tool. A user starts a standalone, client, server, or web mode; Glances gathers system and plugin statistics, then presents them in a terminal or web dashboard, exposes them through APIs, or exports them to files and external services. The graph preserves the documented monitoring, browsing, MCP, and export capabilities. Some subsystem wiring is documented in the README rather than visible in the sampled excerpts, so those relationships cite the README; unsampled implementation details are not assumed.

Main entry points: [`glances/__init__.py`](https://github.com/nicolargo/glances/blob/develop/glances/__init__.py) (Mode selection), [`glances/client.py`](https://github.com/nicolargo/glances/blob/develop/glances/client.py) (Remote client), [`glances/stats.py`](https://github.com/nicolargo/glances/blob/develop/glances/stats.py) (Stats manager), [`glances/plugins/plugin/model.py`](https://github.com/nicolargo/glances/blob/develop/glances/plugins/plugin/model.py) (Plugin model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and configuration"]
  node_entry["Mode selection<br/>[__init__.py]"]
  node_cli["CLI and config<br/>[main.py]"]
  node_config["Configuration<br/>[config.py]"]
end

subgraph group_collection["System data collection"]
  node_stats["Stats manager<br/>[stats.py]"]
  node_plugin["Plugin model<br/>[model.py]"]
  node_process["Process metrics<br/>[processes.py]"]
  node_container["Container metrics<br/>[__init__.py]"]
  node_amp["Application monitors<br/>[amp.py]"]
end

subgraph group_remote["Remote monitoring"]
  node_browser["Server browser<br/>[servers_list.py]"]
  node_client["Remote client<br/>[client.py]"]
  node_server["XML-RPC server<br/>[server.py]"]
  node_webserver["Web server<br/>[webserver.py]"]
end

subgraph group_presentation["User interfaces"]
  node_standalone["Standalone mode<br/>[standalone.py]"]
  node_terminal["Terminal dashboard<br/>[glances_curses.py]"]
  node_web["Web dashboard<br/>[App.vue]"]
end

subgraph group_delivery["APIs and exports"]
  node_api["REST API"]
  node_mcp["MCP service<br/>[glances_mcp.py]"]
  node_export["Export framework<br/>[export.py]"]
  node_exporters["Export destinations"]
end

node_user(("Operator"))
node_external[("External services")]

node_user -->|"starts"| node_entry
node_entry -->|"selects mode"| node_standalone
node_entry -->|"selects mode"| node_client
node_entry -->|"selects mode"| node_server
node_entry -->|"selects mode"| node_webserver
node_entry -->|"initializes"| node_cli
node_cli -->|"loads"| node_config
node_standalone -.->|"collects stats"| node_stats
node_stats -->|"uses plugins"| node_plugin
node_stats -->|"tracks processes"| node_process
node_plugin -->|"collects containers"| node_container
node_plugin -.->|"monitors apps"| node_amp
node_standalone -->|"renders"| node_terminal
node_user -->|"discovers servers"| node_browser
node_browser -->|"connects to"| node_client
node_client -->|"renders"| node_terminal
node_server -->|"serves stats"| node_client
node_webserver -->|"serves dashboard"| node_web
node_webserver -->|"exposes"| node_api
node_user -->|"queries"| node_api
node_api -->|"provides MCP"| node_mcp
node_client -->|"updates"| node_stats
node_client -->|"exports stats"| node_export
node_export -.->|"dispatches to"| node_exporters
node_exporters -->|"writes stats"| node_external

click node_entry "https://github.com/nicolargo/glances/blob/develop/glances/__init__.py"
click node_cli "https://github.com/nicolargo/glances/blob/develop/glances/main.py"
click node_config "https://github.com/nicolargo/glances/blob/develop/glances/config.py"
click node_stats "https://github.com/nicolargo/glances/blob/develop/glances/stats.py"
click node_plugin "https://github.com/nicolargo/glances/blob/develop/glances/plugins/plugin/model.py"
click node_process "https://github.com/nicolargo/glances/blob/develop/glances/processes.py"
click node_container "https://github.com/nicolargo/glances/blob/develop/glances/plugins/containers/__init__.py"
click node_amp "https://github.com/nicolargo/glances/blob/develop/glances/amps/amp.py"
click node_standalone "https://github.com/nicolargo/glances/blob/develop/glances/standalone.py"
click node_terminal "https://github.com/nicolargo/glances/blob/develop/glances/outputs/glances_curses.py"
click node_web "https://github.com/nicolargo/glances/blob/develop/glances/outputs/static/js/App.vue"
click node_browser "https://github.com/nicolargo/glances/blob/develop/glances/servers_list.py"
click node_client "https://github.com/nicolargo/glances/blob/develop/glances/client.py"
click node_server "https://github.com/nicolargo/glances/blob/develop/glances/server.py"
click node_webserver "https://github.com/nicolargo/glances/blob/develop/glances/webserver.py"
click node_api "https://github.com/nicolargo/glances/blob/develop/glances/outputs/glances_restful_api.py"
click node_mcp "https://github.com/nicolargo/glances/blob/develop/glances/outputs/glances_mcp.py"
click node_export "https://github.com/nicolargo/glances/blob/develop/glances/exports/export.py"
click node_exporters "https://github.com/nicolargo/glances/tree/develop/glances/exports"

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_entry,node_cli,node_config toneBlue
class node_stats,node_plugin,node_process,node_container,node_amp,node_external toneAmber
class node_browser,node_client,node_server,node_webserver toneMint
class node_standalone,node_terminal,node_web toneRose
class node_api,node_mcp,node_export,node_exporters,node_user toneIndigo
```

## Components

### Runtime and configuration

- [Mode selection](https://github.com/nicolargo/glances/blob/develop/glances/__init__.py): `glances/__init__.py`
- [CLI and config](https://github.com/nicolargo/glances/blob/develop/glances/main.py): `glances/main.py`
- [Configuration](https://github.com/nicolargo/glances/blob/develop/glances/config.py): `glances/config.py`

### System data collection

- [Stats manager](https://github.com/nicolargo/glances/blob/develop/glances/stats.py): `glances/stats.py`
- [Plugin model](https://github.com/nicolargo/glances/blob/develop/glances/plugins/plugin/model.py): `glances/plugins/plugin/model.py`
- [Process metrics](https://github.com/nicolargo/glances/blob/develop/glances/processes.py): `glances/processes.py`
- [Container metrics](https://github.com/nicolargo/glances/blob/develop/glances/plugins/containers/__init__.py): `glances/plugins/containers/__init__.py`
- [Application monitors](https://github.com/nicolargo/glances/blob/develop/glances/amps/amp.py): `glances/amps/amp.py`

### Remote monitoring

- [Server browser](https://github.com/nicolargo/glances/blob/develop/glances/servers_list.py): `glances/servers_list.py`
- [Remote client](https://github.com/nicolargo/glances/blob/develop/glances/client.py): `glances/client.py`
- [XML-RPC server](https://github.com/nicolargo/glances/blob/develop/glances/server.py): `glances/server.py`
- [Web server](https://github.com/nicolargo/glances/blob/develop/glances/webserver.py): `glances/webserver.py`

### User interfaces

- [Standalone mode](https://github.com/nicolargo/glances/blob/develop/glances/standalone.py): `glances/standalone.py`
- [Terminal dashboard](https://github.com/nicolargo/glances/blob/develop/glances/outputs/glances_curses.py): `glances/outputs/glances_curses.py`
- [Web dashboard](https://github.com/nicolargo/glances/blob/develop/glances/outputs/static/js/App.vue): `glances/outputs/static/js/App.vue`

### APIs and exports

- [REST API](https://github.com/nicolargo/glances/blob/develop/glances/outputs/glances_restful_api.py): `glances/outputs/glances_restful_api.py`
- [MCP service](https://github.com/nicolargo/glances/blob/develop/glances/outputs/glances_mcp.py): `glances/outputs/glances_mcp.py`
- [Export framework](https://github.com/nicolargo/glances/blob/develop/glances/exports/export.py): `glances/exports/export.py`
- [Export destinations](https://github.com/nicolargo/glances/tree/develop/glances/exports): `glances/exports`

### Other components

- **Operator**
- **External services**

## Connections

- Operator → Mode selection: starts
- Mode selection → Standalone mode: selects mode (evidence: `glances/__init__.py`)
- Mode selection → Remote client: selects mode (evidence: `glances/__init__.py`)
- Mode selection → XML-RPC server: selects mode (evidence: `glances/__init__.py`)
- Mode selection → Web server: selects mode (evidence: `glances/__init__.py`)
- Mode selection → CLI and config: initializes (evidence: `glances/__init__.py`)
- CLI and config → Configuration: loads (evidence: `glances/main.py`)
- Standalone mode → Stats manager: collects stats
- Stats manager → Plugin model: uses plugins (evidence: `glances/stats.py`)
- Stats manager → Process metrics: tracks processes (evidence: `glances/stats.py`)
- Plugin model → Container metrics: collects containers (evidence: `glances/plugins/containers/__init__.py`)
- Plugin model → Application monitors: monitors apps
- Standalone mode → Terminal dashboard: renders
- Operator → Server browser: discovers servers
- Server browser → Remote client: connects to (evidence: `glances/servers_list.py`)
- Remote client → Terminal dashboard: renders (evidence: `glances/client.py`)
- XML-RPC server → Remote client: serves stats
- Web server → Web dashboard: serves dashboard
- Web server → REST API: exposes
- Operator → REST API: queries
- REST API → MCP service: provides MCP (evidence: `glances/outputs/glances_restful_api.py`)
- Remote client → Stats manager: updates (evidence: `glances/client.py`)
- Remote client → Export framework: exports stats (evidence: `glances/client.py`)
- Export framework → Export destinations: dispatches to (evidence: `glances/exports/glances_timescaledb/__init__.py`)
- Export destinations → External services: writes stats
