Improve Acronis agent registration and port detection
Fixed Issues: - Registration check now uses correct config file (user.config) - Parses actual registration XML to verify cloud connection - Shows registration URL and environment Port Monitoring: - Now detects actual Acronis listening ports via netstat - Shows real local ports (9850 for MMS, dynamic ports for aakore) - Identifies which service owns each port - Tests actual cloud connectivity with timeout Changes: - Registration verified from /var/lib/Acronis/.../user.config - Port 9850 (localhost): MMS management service - Dynamic ports: aakore agent core - Added cloud connectivity test to registration URL 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -132,17 +132,21 @@ echo ""
|
|||||||
|
|
||||||
# Check agent registration status
|
# Check agent registration status
|
||||||
echo -e "${BOLD}Agent Registration:${NC}"
|
echo -e "${BOLD}Agent Registration:${NC}"
|
||||||
if [ -f "/etc/Acronis/Global.config" ]; then
|
if [ -f "/var/lib/Acronis/BackupAndRecovery/MMS/user.config" ]; then
|
||||||
if grep -q "CloudUrl" "/etc/Acronis/Global.config" 2>/dev/null; then
|
# Check for registration info in user.config
|
||||||
echo -e " ${GREEN}✓${NC} Agent is registered with Acronis Cloud"
|
if grep -q "<registration>" "/var/lib/Acronis/BackupAndRecovery/MMS/user.config" 2>/dev/null; then
|
||||||
|
reg_address=$(grep -oP '<address>\K[^<]+' /var/lib/Acronis/BackupAndRecovery/MMS/user.config 2>/dev/null)
|
||||||
|
reg_env=$(grep -oP '<environment>\K[^<]+' /var/lib/Acronis/BackupAndRecovery/MMS/user.config 2>/dev/null)
|
||||||
|
|
||||||
# Extract cloud URL if possible
|
if [ -n "$reg_address" ]; then
|
||||||
cloud_url=$(grep -oP 'CloudUrl[>="].*?https://[^"<]+' /etc/Acronis/Global.config 2>/dev/null | grep -oP 'https://[^"<]+' | head -1)
|
echo -e " ${GREEN}✓${NC} Agent is registered with Acronis Cloud"
|
||||||
if [ -n "$cloud_url" ]; then
|
echo -e " URL: ${reg_address}"
|
||||||
echo -e " URL: ${cloud_url}"
|
[ -n "$reg_env" ] && echo -e " Environment: ${reg_env}"
|
||||||
|
else
|
||||||
|
echo -e " ${YELLOW}⚠${NC} Registration incomplete"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -e " ${YELLOW}⚠${NC} Agent may not be registered"
|
echo -e " ${YELLOW}⚠${NC} Agent not registered"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -e " ${YELLOW}⚠${NC} Configuration file not found"
|
echo -e " ${YELLOW}⚠${NC} Configuration file not found"
|
||||||
@@ -152,29 +156,42 @@ echo ""
|
|||||||
|
|
||||||
# Check active ports
|
# Check active ports
|
||||||
echo -e "${BOLD}Network Connectivity:${NC}"
|
echo -e "${BOLD}Network Connectivity:${NC}"
|
||||||
echo -e "Active Acronis ports:"
|
|
||||||
|
|
||||||
declare -a PORTS=(
|
# Check for actual Acronis listening ports
|
||||||
"80:HTTP"
|
acronis_ports=$(netstat -tlnp 2>/dev/null | grep -E "(acronis|mms|aakore)" | awk '{print $4 " " $7}' | sort -u)
|
||||||
"443:HTTPS/Cloud"
|
|
||||||
"5060:Agent Management"
|
|
||||||
"7770:Backup Traffic"
|
|
||||||
"7800:Backup Gateway"
|
|
||||||
"8443:Web Console"
|
|
||||||
"44445:Agent Communication"
|
|
||||||
)
|
|
||||||
|
|
||||||
ports_found=false
|
if [ -n "$acronis_ports" ]; then
|
||||||
for port_entry in "${PORTS[@]}"; do
|
echo "Active Acronis services:"
|
||||||
IFS=':' read -r port port_desc <<< "$port_entry"
|
echo "$acronis_ports" | while read -r addr process; do
|
||||||
if netstat -tuln 2>/dev/null | grep -q ":${port}\s"; then
|
port=$(echo "$addr" | grep -oP ':\K[0-9]+$')
|
||||||
echo -e " ${GREEN}✓${NC} Port ${port} (${port_desc})"
|
if echo "$addr" | grep -q "127.0.0.1\|::1"; then
|
||||||
ports_found=true
|
# Local-only port
|
||||||
|
if [ "$port" = "9850" ]; then
|
||||||
|
echo -e " ${GREEN}✓${NC} Port $port (localhost) - MMS Service"
|
||||||
|
else
|
||||||
|
echo -e " ${GREEN}✓${NC} Port $port (localhost) - $(basename "$process" | cut -d/ -f2)"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e " ${GREEN}✓${NC} Port $port - $(basename "$process" | cut -d/ -f2)"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
else
|
||||||
|
echo -e " ${YELLOW}⚠${NC} No Acronis ports detected"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$ports_found" = false ]; then
|
echo ""
|
||||||
echo -e " ${DIM}No Acronis ports currently listening${NC}"
|
|
||||||
|
# Check outbound connectivity to cloud (port 443)
|
||||||
|
if command -v curl >/dev/null 2>&1; then
|
||||||
|
reg_url=$(grep -oP '<address>\K[^<]+' /var/lib/Acronis/BackupAndRecovery/MMS/user.config 2>/dev/null)
|
||||||
|
if [ -n "$reg_url" ]; then
|
||||||
|
echo -n "Testing cloud connectivity... "
|
||||||
|
if timeout 5 curl -s -o /dev/null -w "%{http_code}" "$reg_url" 2>/dev/null | grep -q "^[2-4]"; then
|
||||||
|
echo -e "${GREEN}✓${NC} Connected"
|
||||||
|
else
|
||||||
|
echo -e "${YELLOW}⚠${NC} Cannot reach cloud (may be firewall/network issue)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
Reference in New Issue
Block a user