forked from RPD123-byte/event-driven-microservices-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmonitor-edmp.sh
More file actions
executable file
·72 lines (62 loc) · 1.91 KB
/
monitor-edmp.sh
File metadata and controls
executable file
·72 lines (62 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
# EDMP Platform Monitoring Script
# Run this on the EC2 instance to check platform status
echo "EDMP Platform Status:"
echo "===================="
# Check Docker daemon
if ! sudo systemctl is-active --quiet docker; then
echo "❌ Docker service is not running"
exit 1
else
echo "✅ Docker service is running"
fi
# Check if project directory exists
if [ ! -d "$HOME/edmp-platform" ]; then
echo "❌ Project directory not found. Platform may not be deployed."
exit 1
fi
cd "$HOME/edmp-platform"
# Check if docker-compose file exists
if [ ! -f docker-compose-dev.yml ]; then
echo "❌ docker-compose-dev.yml not found in project directory."
exit 1
fi
# Check running containers
echo ""
echo "Running containers:"
docker-compose -f docker-compose-dev.yml ps
# Check system resources
echo ""
echo "System Resources:"
echo "CPU Usage: $(top -bn1 | grep "Cpu(s)" | awk '{print $2}' | cut -d'%' -f1)%"
echo "Memory Usage: $(free -m | awk '/^Mem:/{printf "%.1f%%\n", $3/$2*100}')"
echo "Disk Usage: $(df -h / | awk '/\//{print $5}')"
# Check service endpoints
PUBLIC_IP=$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4)
echo ""
echo "Service Health Check:"
services=(
"Jenkins:8080"
"Nexus:8081"
"SonarQube:9000"
"Kafka Manager:9001"
"Monitoring:10001"
"Registry:5000"
)
for service in "${services[@]}"; do
name=$(echo $service | cut -d':' -f1)
port=$(echo $service | cut -d':' -f2)
if nc -z localhost $port 2>/dev/null; then
echo "✅ $name (port $port) is responding"
else
echo "❌ $name (port $port) is not responding"
fi
done
echo ""
echo "Service URLs:"
echo "Jenkins: http://$PUBLIC_IP:8080"
echo "Nexus: http://$PUBLIC_IP:8081"
echo "SonarQube: http://$PUBLIC_IP:9000"
echo "Kafka Manager: http://$PUBLIC_IP:9001"
echo "Monitoring: http://$PUBLIC_IP:10001"
echo "Registry: http://$PUBLIC_IP:5000"