CLAUDE: Enhance Tdarr monitoring with automatic staging timeout cleanup and Discord notifications
Major improvements to Tdarr monitoring system addressing staging section timeout issues:
## New Features:
- **Automatic Staging Timeout Detection**: Monitors server logs for 300s limbo timeouts every 20 minutes
- **Stuck Directory Cleanup**: Automatically removes work directories with partial downloads preventing staging cleanup
- **Enhanced Discord Notifications**: Structured markdown messages with working user pings extracted from code blocks
- **Comprehensive Logging**: Timestamped logs with automatic rotation (1MB limit) at /tmp/tdarr-monitor/monitor.log
- **Multi-System Monitoring**: Covers both server staging issues and node worker stalls
## Technical Improvements:
- **JSON Handling**: Proper escaping for special characters, quotes, and newlines in Discord webhooks
- **Shell Compatibility**: Fixed `[[` vs `[` syntax for Docker container execution (sh vs bash)
- **Message Structure**: Professional markdown formatting with separation of alerts and actionable pings
- **Error Handling**: Robust SSH command execution and container operation handling
## Problem Solved:
- Root Cause: Hardcoded 300s staging timeout in Tdarr v2.45.01 causing large files (2-3GB+) to fail download
- Impact: Partial downloads created stuck .tmp files, ENOTEMPTY errors preventing cleanup, cascade failures
- Solution: Automated detection and cleanup system with proactive Discord alerts
## Files Added/Modified:
- `scripts/monitoring/tdarr-timeout-monitor.sh` - Enhanced monitoring script v2.0
- `reference/docker/tdarr-troubleshooting.md` - Added comprehensive monitoring system documentation
## Operational Benefits:
- Reduces manual intervention through automatic cleanup
- Self-healing system prevents staging section blockage
- Enterprise-ready monitoring with structured alerts
- Minimal resource impact: ~3s every 20min, <2MB storage
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>