Process Monitor
Monitor system processes and resource usage with threshold-based alerts.
Requirements
- Standard Unix tools:
ps,top,free,uptime(pre-installed on Linux) - No API keys needed
Instructions
Resource summary — Run and format results:
uptime # Load average free -h # Memory/swap usage nproc # CPU count df -h / /home 2>/dev/null # Key disk partitionsTop processes — By CPU or memory:
ps aux --sort=-%mem | head -15 # Top memory consumers ps aux --sort=-%cpu | head -15 # Top CPU consumersSearch processes — Find by name or PID:
ps aux | grep -i "[n]ode" # By name (brackets avoid matching grep itself) ps -p 1234 -o pid,user,%cpu,%mem,cmd # By PIDThreshold alerts — Flag processes exceeding limits:
- Single process CPU > 80% → ⚠️ Warning
- Single process memory > 50% → ⚠️ Warning
- System memory > 90% → 🔴 Critical
- Load average > 2× CPU count → 🔴 Critical
Output format:
## 📊 Process Report — <hostname> (<timestamp>) | Metric | Value | Status | |---------------|----------------|--------| | Load Average | 1.2 / 0.8 / 0.5 | 🟢 | | Memory | 12.3/16.0 GB (77%) | 🟢 | | Swap | 0.0/4.0 GB | 🟢 | ### Top 5 by Memory | PID | User | %MEM | %CPU | Command | |-------|-------|------|------|----------------| | 1234 | root | 12.3 | 2.1 | /usr/bin/java |
Edge Cases
- Zombie processes: Check with
ps aux | awk '$8 ~ /Z/'— report count and parent PID. - No
topavailable: Fall back to/proc/loadavgand/proc/meminfo. - Docker/container:
psmay show host processes. Use--pid=hostawareness.
Security
- Read-only commands only — never kill processes without explicit user confirmation.
- Sanitize process names in output (may contain sensitive paths or arguments).