probefetch/quickstart.md

167 lines
4.9 KiB
Markdown

# Quickstart
Get up and running with probefetch in under a minute.
---
## Installation
No build step. No `pip install`. Just copy the file.
```bash
# Download or copy probefetch.py anywhere
curl -O https://git.dcos.net/dcosnet/probefetch/raw/branch/main/probefetch.py
chmod +x probefetch.py
# Or just run it directly
python3 probefetch.py
```
For system-wide access, place it on your PATH:
```bash
sudo cp probefetch.py /usr/local/bin/probefetch
```
That is the entire installation process.
---
## First Run
```bash
$ python3 probefetch.py
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%)
```
Everything on one line. No formatting, no tables, no nonsense. Machine-parseable by splitting on ` - `.
---
## Special Modes
Each special mode produces its own independent line. These are useful for dashboards, shell prompts, status bars, or quick audits.
```bash
# What development tools are installed?
$ python3 probefetch.py --devel
Dev: Python 3.12.3 - Node.js 20.11.0 - Go 1.22.0 - Rust 1.76.0 - GCC 13.2.0 - CMake 3.28.3 - Git 2.43.0 - pip 24.0 - npm 10.2.4 - Cargo 1.76.0
# What admin/infrastructure software is running?
$ python3 probefetch.py --admin
Admin: Cockpit, PostgreSQL, nginx, Redis
# What DevOps tooling is available?
$ python3 probefetch.py --devops
DevOps: Docker, kubectl, Helm, Ansible, AWS CLI, GitHub CLI
# Kernel details including security modules
$ python3 probefetch.py --kernel
Kernel: 6.8.0-40-generic (gcc 13.2.0) - Security: AppArmor - Modules: 284
# Package counts across all detected package managers
$ python3 probefetch.py --pkgs
Packages: dpkg: 2847 - snap: 112
# Security posture at a glance
$ python3 probefetch.py --security
Security: Tools: UFW, Fail2Ban, AppArmor, nftables - UFW: active - Fail2Ban: installed - ASLR: full - dmesg restricted: yes - kptr restricted: yes
# Network information
$ python3 probefetch.py --net
Network: IF: eth0 (aa:bb:cc:dd:ee:ff) - IP: 192.168.1.42 - GW: 192.168.1.1 - DNS: 1.1.1.1, 8.8.8.8 - Established: 47 - Listening: 12
```
---
## Color Themes
Pick a theme that matches your terminal:
```bash
python3 probefetch.py --theme=dracula
python3 probefetch.py --theme=gruvbox
python3 probefetch.py --theme=nord
python3 probefetch.py --theme=solarized
python3 probefetch.py --theme=mono # no color, bold/dim only
python3 probefetch.py --theme=auto # auto-detect (default)
```
When stdout is piped or redirected, colors are automatically suppressed.
---
## Selective Output
Show only the sections you need:
```bash
# Just the host, CPU, and memory
python3 probefetch.py hostname cpu memory
# Just uptime and load
python3 probefetch.py uptime loadaverage
# Include battery and network traffic (off by default)
python3 probefetch.py --battery --network
```
When section names are provided, everything else is turned off.
---
## Stealth Mode
In environments where spawning subprocesses is restricted or undesirable, use stealth mode. All data is gathered from file reads only (`/proc`, `/sys`, `/etc`):
```bash
python3 probefetch.py --sleuth
python3 probefetch.py --sleuth --theme=nord
```
Stealth mode works well for:
- Container images where you want minimal attack surface
- Chroot environments or build systems
- Security-audited production boxes
- Systems with restricted `sh -c` execution policies
Note that some information (like process counts, tool versions, and network IPs) requires subprocess calls and will be unavailable in stealth mode.
---
## Piping and Scripting
The single-line output is designed to be easy to parse:
```bash
# Extract just the memory percentage
python3 probefetch.py | grep -oP 'Memory Usage: \K.*'
# Feed into a monitoring script
python3 probefetch.py --theme=mono >> /var/log/probefetch.log
# Use in a shell prompt
export PROBEFETCH=$(python3 probefetch.py --theme=mono hostname cpu memory)
echo "$PROBEFETCH"
```
---
## Version Check
```bash
python3 probefetch.py -v
# probefetch v5.0.0
```
---
## Tips
- **Pipe-friendly**: Colors are auto-disabled when stdout is not a TTY, so piping to `grep`, `awk`, or `jq` works without `sed` hacks to strip ANSI codes.
- **SSH aliases**: Add `probefetch` to your `RemoteCommand` in `~/.ssh/config` for an instant system overview when you connect.
- **MOTD integration**: Drop a one-liner into `/etc/update-motd.d/90-probefetch` to show system info on every login.
- **Cron jobs**: Use `--sleuth` in cron to avoid unnecessary process spawning.
- **Disk accuracy**: On Linux, only physical block devices are counted. Loop devices (snap packages, ISO mounts), network filesystems (NFS, CIFS), and tmpfs are automatically excluded.
- **Memory accuracy**: On kernels 3.14 and later, `MemAvailable` from `/proc/meminfo` is used for the most accurate representation of available memory.