probefetch/README.md

117 lines
5.7 KiB
Markdown

# probefetch.py
A compact, single-file system information collector for Linux, macOS, BSD, and Solaris.
Outputs a single line of machine-readable system telemetry, colored with ANSI 256 / truecolor themes. Zero external dependencies — just Python 3.8+ and a Unix-like operating system.
```
Host: atlas - OS: Linux 6.8.0/x86_64 - Distro: Ubuntu 24.04 - CPU: 8 x AMD Ryzen 7 5800X (3700.00 MHz) - GPU: NVIDIA GeForce RTX 3070 8192MB (5888 CUDA cores) - Processes: 312 - Uptime: 14d 6h 32m - Users: 1 - Load Average: 0.83 - Memory Usage: 7842.50MB/16384.00MB (47.86%) - Disk Usage: 186.42GB/512.00GB (36.41%)
```
**Author:** Jeremy Anderson
**Website:** [git.dcos.net/dcosnet/probefetch](https://git.dcos.net/dcosnet/probefetch)
**License:** MIT
---
## Features
- **Default mode** — hostname, OS, distro, CPU, GPU, processes, uptime, users, load average, memory, disk, network traffic.
- **Seven special modes** — `--devel`, `--admin`, `--devops`, `--kernel`, `--pkgs`, `--security`, `--net` — each outputs its own compact line.
- **Stealth / sleuth mode** — `--sleuth` or `--stealth` avoids spawning any subprocesses. Only file-based probes (`/proc`, `/sys`, `/etc`) are used, making it safe for constrained or audited environments.
- **Color themes** — auto-detected terminal color depth, with eight built-in themes: `auto`, `dark`, `light`, `solarized`, `dracula`, `gruvbox`, `nord`, `mono`.
- **Per-section toggles** — show or hide any section by name, or use `--battery` and `--network` to include those by default.
- **60+ distro detection** — identifies Linux distributions through `/etc/os-release`, `/usr/lib/os-release`, release-file fingerprints, and `/etc/issue` fallback.
- **Cross-architecture CPU detection** — handles x86, ARM, Alpha, IA-64, MIPS, PA-RISC, PowerPC, S/390, SH, and SPARC.
- **GPU detection** — NVIDIA (via `nvidia-smi`), AMD, and Intel GPUs through sysfs PCI device tree, with VRAM reporting and `lspci` fallback.
- **Accurate memory metrics** — uses kernel `MemAvailable` (since 3.14) when present, falling back to the traditional `MemFree + Buffers + Cached` estimation.
- **Filtered disk metrics** — on Linux, aggregates only physical block devices (`/dev/sd*`, `/dev/nvme*`, `/dev/vd*`, etc.), excluding loop devices, network mounts, and virtual filesystems.
---
## Special Modes
| Flag | What it shows |
|-------------|----------------------------------------------------------------------------------|
| `--devel` | Languages, compilers, build tools, and package managers (Python, Node, Go, Rust, Java, PHP, Ruby, Perl, GCC, CMake, Git, pip, npm, Cargo, etc.) |
| `--admin` | Administration panels, databases, monitoring, and web servers (Cockpit, MariaDB, PostgreSQL, Prometheus, Grafana, nginx, Apache, Caddy, Redis, RabbitMQ, etc.) |
| `--devops` | Containers, orchestration, IaC, CI/CD, and cloud CLIs (Docker, Podman, kubectl, Helm, OpenTofu, Ansible, Jenkins, AWS CLI, GitHub CLI, etc.) |
| `--kernel` | Kernel version, compiler, security modules (SELinux, AppArmor, Smack, Yama), and loaded module count |
| `--pkgs` | Installed package count per detected package manager (dpkg, rpm, pacman, apk, emerge, xbps, nix, dnf, zypper) |
| `--security`| Firewall status, hardening tools (UFW, firewalld, Fail2Ban, Lynis, ClamAV, etc.), ASLR, dmesg/kptr restrictions |
| `--net` | Network interfaces, IPs, gateway, DNS servers, and TCP connection counts |
---
## Color Themes
```
--theme=auto # Auto-detect terminal color depth (default)
--theme=dark # Cornflower blue labels on dark terminals
--theme=light # Navy labels on light terminals
--theme=solarized # Solarized palette
--theme=dracula # Dracula palette
--theme=gruvbox # Gruvbox palette
--theme=nord # Nord palette
--theme=mono # Bold/dim only, no color
```
Themes adapt automatically to the terminal's color support: truecolor (24-bit) when available, xterm-256 as fallback, 16-color as last resort, and plain text when stdout is not a TTY.
---
## Platform Support
| Platform | Default Mode | Special Modes | Stealth Mode |
|----------------|:------------:|:-------------:|:------------:|
| Linux | Full | Full | Full |
| macOS | Partial | Partial | Limited |
| FreeBSD | Partial | Partial | Limited |
| OpenBSD | Partial | Partial | Limited |
| NetBSD | Partial | Partial | Limited |
| DragonFly BSD | Partial | Partial | Limited |
| Solaris | Partial | Limited | Limited |
"Partial" means some information (e.g., GPU, battery) may be unavailable depending on the specific system configuration. Stealth mode limits all platforms to file-based probes only.
---
## Per-Section Toggles
Show only the sections you care about by passing their names as arguments:
```bash
probefetch.py hostname cpu memory disk
probefetch.py distro uptime loadaverage
probefetch.py --battery --network
```
Available section names: `hostname`, `os`, `distro`, `cpu`, `gpu`, `processes`, `uptime`, `users`, `loadaverage`, `battery`, `memory`, `disk`, `network`.
When section names are given, all other sections are disabled.
---
## Requirements
- Python 3.8 or later
- A Unix-like operating system (Linux, macOS, BSD, Solaris)
- No external Python packages required
---
## Credits
Based on `sysinfo.pl` by:
- David Rudie \<d.rudie@gmail.com\>
- Travis Morgan \<imbezol@criticaldamage.com\>
- Nils Goers \<weechatter@arcor.de\>
Rewritten in Python as **probefetch** by Jeremy Anderson with expanded platform support, color themes, stealth mode, and additional special modes.
---
## License
MIT License. See [LICENSE](LICENSE) for the full text.