Overview
Guide the agent to troubleshoot remote server issues through a structured workflow, avoiding blind command execution. All remote commands are executed throughconnect/scripts/ssh-exec.shExecute.
Applicable Scenarios
- Service anomalies (process crashes, service unavailability)
- Performance issues (CPU/memory/disk/GPU)
- Deployment failure troubleshooting
- In-container application debugging
Workflow Steps
1. Confirm the Target
- Obtain the problem description, confirm the profile and troubleshooting direction
- Output: profile name + problem category
2. Context-Aware Environment Check
- Read local project files to infer dependencies and dynamically generate check items
- Basic checks:
uptime,df -h,free -m,top -bn1 | head -20 - Execute additional checks according to the rule table
- Output: environment status overview
3. Log Analysis
- Locate logs:
journalctl -u <service> --since "1h ago",/var/log/ - Search keywords:
grep -i "error\|fatal\|exception" <log> | tail -50 - Containers:
docker logs <container> --tail 200
Token Optimization Strategies:
-
Log analysis: first use grep to search for error keywords, then expand context once the problem is found
-
Large log files: only read tail -50, do not read the full content
-
Environment checks: output a summary, do not paste complete command results
-
Output: error message summary
4. In-Depth Troubleshooting
- Execute targeted commands based on clues, verifying one hypothesis at a time
- Check configuration files, environment variables, dependency versions
- Output: root cause or most likely cause
5. Summary Report
- Output findings (symptoms, root cause, impact) and remediation recommendations
- Output: structured troubleshooting report
Context-Aware Rule Table
| Detected dependency | Additional check command |
|---|---|
| PyTorch / TensorFlow | nvidia-smi, GPU memory usage |
| Huawei CANN / MindSpore | npu-smi info, NPU status |
| Docker / docker-compose | docker ps -a, docker stats --no-stream |
| Database connection configuration | Connectivity test, active connection count |
Common Troubleshooting Command Quick Reference
| Scenario | Command |
|---|---|
| Process | ps aux | grep <app>, systemctl status <svc> |
| Resources | df -h, free -m, top -bn1 | head -20 |
| Logs | tail -100 <log>, journalctl -u <svc> --since "1h ago" |
| Network | ss -tlnp, curl -sv localhost:<port> |
| Containers | docker logs <c> --tail 100, docker stats --no-stream |
| GPU | nvidia-smi, npu-smi info |
In-Container Debugging
profile configurationcontainerfield,ssh-exec.shcommands are automatically routed into the container. Note:
- Tools inside the container may be missing; prefer basic commands (
cat,ls,env) - When host information is needed, use a profile without container
Token Constraints
- Log analysis: first grep for error keywords, then expand context as needed
- Environment checks: output a summary rather than complete command results
- In-depth troubleshooting: verify one hypothesis at a time, do not execute commands in batches
- Repeated information: do not restate known content