Triage incidents, analyze logs, debug systems, and execute diagnostics with AI assistance. Built for production environments with comprehensive system integration.
- Natural language incident reporting and analysis
- Structured incident workflow with severity tracking
- Comprehensive incident timeline and command history
- Automated report generation
- Ollama (local): Mistral, Llama2, CodeLlama, etc.
- OpenAI: GPT-3.5, GPT-4
- Pluggable architecture for easy model switching
- System Resources: CPU, memory, disk, processes
- Service Management: systemd, service status, logs
- Network Diagnostics: connectivity, DNS, routing
- Log Analysis: pattern detection, error analysis
- SSH Operations: remote diagnostics, file transfer
- Rich terminal UI with colors and formatting
- Interactive command suggestions with auto-execution
- Quick health checks and targeted diagnostics
- Real-time command execution and output analysis
- Python 3.8+
- Ollama (for local LLM) or OpenAI API key
- System tools:
systemctl,journalctl,netstat,ping, etc.
git clone https://github.com/malikyawar/incident-helper.git
cd incident-helper
pip install -e .
# For development
pip install -e ".[dev]"Option 1: Ollama (Local)
# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh
# Pull a model
ollama pull mistralOption 2: OpenAI
export OPENAI_API_KEY="your-api-key-here"# Start with Ollama (default)
incident-helper start
# Use OpenAI
incident-helper start --provider openai --model gpt-4
# Auto-execute suggested commands
incident-helper start --auto-execute# System health check
incident-helper quick-check
# Check specific service
incident-helper quick-check --service nginx
# Analyze logs
incident-helper analyze-logs /var/log/nginx/error.log --pattern "error"
# Test connectivity
incident-helper test-connectivity google.com --port 443$ incident-helper start
π οΈ Incident Helper - AI-powered SRE Assistant
β
Using ollama provider
π Describe your incident
> Web server returning 502 errors
π Gathering system context...
Environment [production]: production
Severity [1 (Low)/2 (Medium)/3 (High)/4 (Critical)]: 3
π¬ Starting diagnostic conversation...
π€ AI Assistant
Based on 502 errors from your web server, let's check the upstream services first.
Let's examine the nginx error logs:
`tail -f /var/log/nginx/error.log`
This will show recent errors. What do you see in the logs?
> I see "connect() failed (111: Connection refused) while connecting to upstream"
π€ AI Assistant
The upstream service is refusing connections. Let's check if your application server is running:
`systemctl status your-app-service`
What's the status of your application service?
> !systemctl status myapp
β‘ Executing: systemctl status myapp
β Command failed
Error: Unit myapp.service could not be found.
π€ AI Assistant
The service isn't found. Let's list all failed services:
`systemctl --failed`
This will show any services that have failed to start.- Prefix commands with
!to execute directly:!ps aux | grep nginx - Auto-execution mode suggests and runs commands with confirmation
- All commands are logged with output for incident reports
help- Show available commandsstatus- Display current incident statusreport- Generate incident reportexit- End session with optional report generation
The tool integrates with common system utilities:
- systemd: Service management and logs
- journalctl: System journal analysis
- netstat/ss: Network connection analysis
- ping/traceroute: Network diagnostics
- SSH: Remote system access
- Log files: Automated log analysis
Modular diagnostic components:
SystemResolver: CPU, memory, processes, command executionServiceResolver: systemd services, status, logsLogResolver: Log file analysis, pattern detectionNetworkResolver: Connectivity, DNS, routingSSHResolver: Remote access, file transfer
- Structured incident tracking with timeline
- Command history with success/failure tracking
- Severity and status management
- Exportable incident reports
- Provider abstraction for multiple LLM services
- Context-aware prompting for diagnostic guidance
- Specialized prompts for different analysis types
# Run tests
pytest
# With coverage
pytest --cov=incident_helper
# Run specific test
pytest tests/test_cli.py::test_quick_check_command- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make changes and add tests
- Run tests:
pytest - Format code:
black incident_helper/ - Submit a pull request
- Cloud Integration: AWS, GCP, Azure resource monitoring
- Kubernetes Support: Pod diagnostics, cluster health
- Monitoring Integration: Prometheus, Grafana, DataDog
- Alerting: PagerDuty, Slack notifications
- Playbooks: Automated response procedures
- Web Interface: Browser-based incident management
- Team Collaboration: Multi-user incident response
MIT License - see LICENSE file for details.