Overview

Date: 2026-05-11

Time: 15:52

Overview

This module provides a full-screen terminal UI (TUI) for ftl2-htop, a system monitoring dashboard built on FTL2's automation framework. It uses the Textual library to render a live-updating dashboard showing host metrics, and is designed to be compatible with textual-serve for web-based access. It's an alternative to the Rich live.Live rendering mode, activated via the --tui flag.

Usage Patterns

The primary entry point is run_tui(args), which accepts a parsed argument namespace and launches the Textual app:


from ftl2_htop.tui import run_tui
run_tui(args)  # args from argparse with hosts, inventory, interval, etc.

The app is typically launched from the CLI when the --tui flag is passed. It spawns a background thread that runs the FTL2 automation listener, while the main thread handles TUI rendering. Press q to quit.

API and Configuration

The args namespace controls behavior through these fields:

| Arg | Purpose |

|-----|---------|

| args.hosts | List of hostnames — builds an inline inventory |

| args.inventory | Path or dict for FTL2 inventory |

| args.state | State file path (alternative to inventory) |

| args.groups | Specific groups to monitor; defaults to all groups |

| args.interval | Polling interval for the monitor() call |

| args.no_processes | If true, skips per-process metrics |

Inventory resolution priority: hosts > inventory > state > fallback to "localhost,".

Key Behaviors

Relationships