Files
dyolink/infrastructure/scripts/logs.sh

32 lines
893 B
Bash
Raw Permalink Normal View History

#!/bin/bash
# Colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
echo "=== Dyolink Health Monitor ==="
echo "Time: $(date)"
echo ""
# Check containers
echo "Container Status:"
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Health}}" | grep dyolink
# Check resources
echo -e "\nResource Usage:"
docker stats --no-stream --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}" | grep dyolink
# Check disk
DISK=$(df -h / | awk 'NR==2 {print $5}' | tr -d '%')
if [ $DISK -gt 80 ]; then
echo -e "\n${RED}⚠ WARNING: Disk usage at ${DISK}%${NC}"
else
echo -e "\n${GREEN}✓ Disk usage: ${DISK}%${NC}"
fi
# Check API
echo -e "\nAPI Health:"
curl -s -o /dev/null -w "Backend API: %{http_code}\n" http://localhost:3001/api/health || echo "Backend API: DOWN"
curl -s -o /dev/null -w "Frontend: %{http_code}\n" http://localhost:3002 || echo "Frontend: DOWN"