Server Management
Server management principles for production operations.
Learn to THINK, not memorize commands.
1. Process Management Principles
Tool Selection
| Scenario |
Tool |
| Node.js app |
PM2 (clustering, reload) |
| Any app |
systemd (Linux native) |
| Containers |
Docker/Podman |
| Orchestration |
Kubernetes, Docker Swarm |
Process Management Goals
| Goal |
What It Means |
| Restart on crash |
Auto-recovery |
| Zero-downtime reload |
No service interruption |
| Clustering |
Use all CPU cores |
| Persistence |
Survive server reboot |
2. Monitoring Principles
What to Monitor
| Category |
Key Metrics |
| Availability |
Uptime, health checks |
| Performance |
Response time, throughput |
| Errors |
Error rate, types |
| Resources |
CPU, memory, disk |
Alert Severity Strategy
| Level |
Response |
| Critical |
Immediate action |
| Warning |
Investigate soon |
| Info |
Review daily |
Monitoring Tool Selection
| Need |
Options |
| Simple/Free |
PM2 metrics, htop |
| Full observability |
Grafana, Datadog |
| Error tracking |
Sentry |
| Uptime |
UptimeRobot, Pingdom |
3. Log Management Principles
Log Strategy
| Log Type |
Purpose |
| Application logs |
Debug, audit |
| Access logs |
Traffic analysis |
| Error logs |
Issue detection |
Log Principles
- Rotate logs to prevent disk fill
- Structured logging (JSON) for parsing
- Appropriate levels (error/warn/info/debug)
- No sensitive data in logs
4. Scaling Decisions
When to Scale
| Symptom |
Solution |
| High CPU |
Add instances (horizontal) |
| High memory |
Increase RAM or fix leak |
| Slow response |
Profile first, then scale |
| Traffic spikes |
Auto-scaling |
Scaling Strategy
| Type |
When to Use |
| Vertical |
Quick fix, single instance |
| Horizontal |
Sustainable, distributed |
| Auto |
Variable traffic |
5. Health Check Principles
What Constitutes Healthy
| Check |
Meaning |
| HTTP 200 |
Service responding |
| Database connected |
Data accessible |
| Dependencies OK |
External services reachable |
| Resources OK |
CPU/memory not exhausted |
Health Check Implementation
- Simple: Just return 200
- Deep: Check all dependencies
- Choose based on load balancer needs
6. Security Principles
| Area |
Principle |
| Access |
SSH keys only, no passwords |
| Firewall |
Only needed ports open |
| Updates |
Regular security patches |
| Secrets |
Environment vars, not files |
| Audit |
Log access and changes |
7. Troubleshooting Priority
When something's wrong:
- Check if running (process status)
- Check logs (error messages)
- Check resources (disk, memory, CPU)
- Check network (ports, DNS)
- Check dependencies (database, APIs)
8. Anti-Patterns
| ❌ Don't |
✅ Do |
| Run as root |
Use non-root user |
| Ignore logs |
Set up log rotation |
| Skip monitoring |
Monitor from day one |
| Manual restarts |
Auto-restart config |
| No backups |
Regular backup schedule |
Remember: A well-managed server is boring. That's the goal.
AGI Framework Integration
Qdrant Memory Integration
Before executing complex tasks with this skill:
python3 execution/memory_manager.py auto --query "<task summary>"
Decision Tree:
- Cache hit? Use cached response directly — no need to re-process.
- Memory match? Inject
context_chunks into your reasoning.
- No match? Proceed normally, then store results:
python3 execution/memory_manager.py store \
--content "Description of what was decided/solved" \
--type decision \
--tags server-management <relevant-tags>
Note: Storing automatically updates both Vector (Qdrant) and Keyword (BM25) indices.
Agent Team Collaboration
- Strategy: This skill communicates via the shared memory system.
- Orchestration: Invoked by
orchestrator via intelligent routing.
- Context Sharing: Always read previous agent outputs from memory before starting.
Local LLM Support
When available, use local Ollama models for embedding and lightweight inference:
- Embeddings:
nomic-embed-text via Qdrant memory system
- Lightweight analysis: Local models reduce API costs for repetitive patterns
1---2name: server-management3description: Server management principles and decision-making. Process management, monitoring strategy, and scaling decisions. Teaches thinking, not commands.4allowed-tools: Read, Write, Edit, Glob, Grep, Bash5---67# Server Management89> Server management principles for production operations.10> **Learn to THINK, not memorize commands.**1112---1314## 1. Process Management Principles1516### Tool Selection1718| Scenario | Tool |19|----------|------|20| **Node.js app** | PM2 (clustering, reload) |21| **Any app** | systemd (Linux native) |22| **Containers** | Docker/Podman |23| **Orchestration** | Kubernetes, Docker Swarm |2425### Process Management Goals2627| Goal | What It Means |28|------|---------------|29| **Restart on crash** | Auto-recovery |30| **Zero-downtime reload** | No service interruption |31| **Clustering** | Use all CPU cores |32| **Persistence** | Survive server reboot |3334---3536## 2. Monitoring Principles3738### What to Monitor3940| Category | Key Metrics |41|----------|-------------|42| **Availability** | Uptime, health checks |43| **Performance** | Response time, throughput |44| **Errors** | Error rate, types |45| **Resources** | CPU, memory, disk |4647### Alert Severity Strategy4849| Level | Response |50|-------|----------|51| **Critical** | Immediate action |52| **Warning** | Investigate soon |53| **Info** | Review daily |5455### Monitoring Tool Selection5657| Need | Options |58|------|---------|59| Simple/Free | PM2 metrics, htop |60| Full observability | Grafana, Datadog |61| Error tracking | Sentry |62| Uptime | UptimeRobot, Pingdom |6364---6566## 3. Log Management Principles6768### Log Strategy6970| Log Type | Purpose |71|----------|---------|72| **Application logs** | Debug, audit |73| **Access logs** | Traffic analysis |74| **Error logs** | Issue detection |7576### Log Principles77781. **Rotate logs** to prevent disk fill792. **Structured logging** (JSON) for parsing803. **Appropriate levels** (error/warn/info/debug)814. **No sensitive data** in logs8283---8485## 4. Scaling Decisions8687### When to Scale8889| Symptom | Solution |90|---------|----------|91| High CPU | Add instances (horizontal) |92| High memory | Increase RAM or fix leak |93| Slow response | Profile first, then scale |94| Traffic spikes | Auto-scaling |9596### Scaling Strategy9798| Type | When to Use |99|------|-------------|100| **Vertical** | Quick fix, single instance |101| **Horizontal** | Sustainable, distributed |102| **Auto** | Variable traffic |103104---105106## 5. Health Check Principles107108### What Constitutes Healthy109110| Check | Meaning |111|-------|---------|112| **HTTP 200** | Service responding |113| **Database connected** | Data accessible |114| **Dependencies OK** | External services reachable |115| **Resources OK** | CPU/memory not exhausted |116117### Health Check Implementation118119- Simple: Just return 200120- Deep: Check all dependencies121- Choose based on load balancer needs122123---124125## 6. Security Principles126127| Area | Principle |128|------|-----------|129| **Access** | SSH keys only, no passwords |130| **Firewall** | Only needed ports open |131| **Updates** | Regular security patches |132| **Secrets** | Environment vars, not files |133| **Audit** | Log access and changes |134135---136137## 7. Troubleshooting Priority138139When something's wrong:1401411. **Check if running** (process status)1422. **Check logs** (error messages)1433. **Check resources** (disk, memory, CPU)1444. **Check network** (ports, DNS)1455. **Check dependencies** (database, APIs)146147---148149## 8. Anti-Patterns150151| ❌ Don't | ✅ Do |152|----------|-------|153| Run as root | Use non-root user |154| Ignore logs | Set up log rotation |155| Skip monitoring | Monitor from day one |156| Manual restarts | Auto-restart config |157| No backups | Regular backup schedule |158159---160161> **Remember:** A well-managed server is boring. That's the goal.162163## AGI Framework Integration164165### Qdrant Memory Integration166167Before executing complex tasks with this skill:168```bash169python3 execution/memory_manager.py auto --query "<task summary>"170```171172**Decision Tree:**173- **Cache hit?** Use cached response directly — no need to re-process.174- **Memory match?** Inject `context_chunks` into your reasoning.175- **No match?** Proceed normally, then store results:176177```bash178python3 execution/memory_manager.py store \179 --content "Description of what was decided/solved" \180 --type decision \181 --tags server-management <relevant-tags>182```183184> **Note:** Storing automatically updates both Vector (Qdrant) and Keyword (BM25) indices.185186### Agent Team Collaboration187188- **Strategy**: This skill communicates via the shared memory system.189- **Orchestration**: Invoked by `orchestrator` via intelligent routing.190- **Context Sharing**: Always read previous agent outputs from memory before starting.191192### Local LLM Support193194When available, use local Ollama models for embedding and lightweight inference:195- Embeddings: `nomic-embed-text` via Qdrant memory system196- Lightweight analysis: Local models reduce API costs for repetitive patterns