Loading...
Loading...
Discovers, tests, and manages remote SSH infrastructure hosts and Docker services across 5 hosts (infra.local, deus, homeassistant, pi4-motor, armitage). Use when checking infrastructure status, verifying service connectivity, managing Docker containers, troubleshooting remote services, or before using remote resources (MongoDB, Langfuse, OTLP, Neo4j). Triggers on "check infrastructure", "connect to infra/deus/ha", "test MongoDB on infra", "view Docker services", "verify connectivity", "troubleshoot remote service", "what services are running", or when remote connections fail.
npx skill4agent add dawiddutoit/custom-claude infra-manage-ssh-services# List all hosts and their status
ping -c 1 -W 1 infra.local && echo "✅ infra.local (primary)" || echo "❌ infra.local"
ping -c 1 -W 1 192.168.68.135 && echo "✅ deus (development)" || echo "❌ deus"
ping -c 1 -W 1 homeassistant.local && echo "✅ homeassistant.local" || echo "❌ homeassistant.local"# View all running Docker services on infra.local
ssh infra "docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}'"
# Quick MongoDB health check (MongoDB 4.4 uses 'mongo' not 'mongosh')
ssh infra "docker exec local-infra-mongodb-1 mongo off --quiet --eval 'db.runCommand({ping: 1})'" 2>/dev/null# Verify MongoDB is accessible
nc -z infra.local 27017 && echo "✅ MongoDB port open" || echo "❌ MongoDB unreachable"# Option 1: Use the connect function (recommended)
connect infra
# Option 2: Use the SSH alias from ~/.ssh/config
ssh infra
# Option 3: Use the full hostname
ssh dawiddutoit@infra.localinfra.localdawiddutoit~/.ssh/id_ed25519connect infra --setup
# This copies your SSH public key to infra.local for passwordless authenticationconnect deus # or: ssh deus # or: ssh dawiddutoit@192.168.68.135
connect ha # or: ssh ha # or: ssh root@homeassistant.local
connect motor # or: ssh motor # or: ssh dawiddutoit@pi4-motor.local
connect armitage # or: ssh unit@armitage.local# Execute single command
ssh infra "docker ps"
# Execute multiple commands
ssh infra "cd ~/projects/local-infra && docker compose ps"
# Chain commands
ssh infra "docker ps -f name=mongodb && docker logs --tail 10 local-infra-mongodb-1"connect# View available hosts
connect
# Output: Hosts: infra, armitage, deus, ha, motor| Host | Connection | Status | Primary Services |
|---|---|---|---|
| infra.local | | ✅ Online | MongoDB, Langfuse, OTLP, Jaeger, Neo4j, Infinity, PostgreSQL, Redis, MinIO, Mosquitto, Caddy |
| deus | | ✅ Online | None detected (development machine) |
| homeassistant.local | | ✅ Online | Home Assistant (port 8123) |
| pi4-motor.local | | ❌ Offline | Motor control (Raspberry Pi 4) |
| armitage.local | | ❌ Offline | Neo4j, Infinity Embeddings (WSL2 PC) |
# Quick network ping test
ping -c 1 -W 1 infra.local
# Test specific port availability
nc -z infra.local 27017 # MongoDB
nc -z infra.local 3000 # Langfuse
nc -z infra.local 4317 # OTLP Collector
nc -z infra.local 7687 # Neo4j (if not in restart loop)# View all Docker containers on infra.local
ssh infra "docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}'"
# Count running services
ssh infra "docker ps --format '{{.Names}}' | wc -l"
# Check specific service
ssh infra "docker ps -f name=mongodb"# Test basic SSH connection
ssh infra "echo 'Connection OK'"
# If SSH fails, check SSH agent
ssh-add -l
# Copy SSH key if needed (first-time setup)
connect infra --setup# MongoDB health check
ssh infra "docker inspect --format='{{.State.Health.Status}}' local-infra-mongodb-1"
ssh infra "docker exec local-infra-mongodb-1 mongo off --quiet --eval 'db.runCommand({ping: 1})'"
# Langfuse health check (HTTP)
curl -s -o /dev/null -w "%{http_code}" http://infra.local:3000
# OTLP Collector health check
ssh infra "docker inspect --format='{{.State.Status}}' local-infra-otel-collector-1"
# View container logs for errors
ssh infra "docker logs --tail 50 local-infra-mongodb-1"# Test from application environment
cd ~/projects/play/nomnom
python -c "from motor.motor_asyncio import AsyncIOMotorClient; import asyncio; asyncio.run(AsyncIOMotorClient('mongodb://infra.local:27017').admin.command('ping'))" && echo "✅ MongoDB reachable"# Check web UI accessibility
curl -I http://infra.local:3000 | grep "HTTP"# Restart single service
ssh infra "cd ~/projects/local-infra && docker compose restart mongodb"
# Restart all services
ssh infra "cd ~/projects/local-infra && docker compose restart"
# Stop service
ssh infra "cd ~/projects/local-infra && docker compose stop mongodb"
# Start service
ssh infra "cd ~/projects/local-infra && docker compose up -d mongodb"
# View Docker Compose configuration
ssh infra "cd ~/projects/local-infra && docker compose config"# Follow logs in real-time
ssh infra "docker logs -f local-infra-mongodb-1"
# View last 100 lines
ssh infra "docker logs --tail 100 local-infra-langfuse-web-1"
# View logs for all services
ssh infra "cd ~/projects/local-infra && docker compose logs -f"
# Check resource usage
ssh infra "docker stats --no-stream"# Push file to infra.local
syncpi push ~/path/to/file
# Pull file from infra.local
syncpi pull ~/path/to/file
# Sync zsh configuration
syncpi zsh push
syncpi zsh pull/Users/dawiddutoit/.claude/artifacts/2026-01-01/infrastructure/SSH_INFRASTRUCTURE_GUIDE.mdMONGODB_URL=mongodb://infra.local:27017
MONGODB_DATABASE=off# Verify OTLP Collector is running
ssh infra "docker ps -f name=otel-collector -q" | grep -q . || echo "⚠️ OTLP Collector offline"
# Then use skills:
# - observability-analyze-logs
# - observability-analyze-session-logs# Verify Home Assistant is accessible
curl -s -H "Authorization: Bearer $HA_LONG_LIVED_TOKEN" http://192.168.68.123:8123/api/ | grep -q "message" && echo "✅ HA API accessible"
# Then use skills:
# - ha-dashboard-create
# - ha-custom-cards
# - ha-mushroom-cards# Add to pre-start checks
if ! nc -z infra.local 27017; then
echo "❌ QUALITY GATE FAILED: MongoDB unreachable"
echo "Run: ssh infra 'cd ~/projects/local-infra && docker compose restart mongodb'"
exit 1
fi| Metric | Before Skill | After Skill | Improvement |
|---|---|---|---|
| Discovery Time | 5-10 min (manual SSH, guessing) | 30 sec (automated checks) | 10-20x faster |
| Troubleshooting Time | 10-30 min (trial and error) | 2-5 min (systematic workflow) | 5-6x faster |
| Connection Failures | 30-40% (no verification) | <5% (proactive health checks) | 6-8x reduction |
| Service Availability Awareness | Unknown until failure | Real-time status | Proactive visibility |
| Documentation Access | Search files, guess locations | Single skill reference | Immediate context |
~/.ssh/configconnect <host> --setupconnect~/.zshrcsyncpi# Check all hosts
bash /Users/dawiddutoit/.claude/skills/infra-manage-ssh-services/scripts/health_check.sh
# Check specific host
bash /Users/dawiddutoit/.claude/skills/infra-manage-ssh-services/scripts/health_check.sh infra
# Verbose output
bash /Users/dawiddutoit/.claude/skills/infra-manage-ssh-services/scripts/health_check.sh --verboseconnect <host> --setupdocker inspectnc -zcd ~/projects/local-infra~/.ssh/config~/.zshrc~/projects/play/nomnom/.env/Users/dawiddutoit/.claude/artifacts/2026-01-01/infrastructure/SSH_INFRASTRUCTURE_GUIDE.md/Users/dawiddutoit/projects/play/nomnom/CLAUDE.md~/.claude/CLAUDE.md~/.claude/CLAUDE.md