fix: use correct server URL instead of localhost

AgentService now replaces 'localhost' in the server URL with
sysadmin.lan before sending to the remote agent. Also added
URL/hostname debug output to the agent startup log.
This commit is contained in:
2026-06-11 20:26:37 -04:00
parent cc0a0c0644
commit 4d3a7e4d65
2 changed files with 14 additions and 3 deletions

View File

@@ -82,12 +82,20 @@ EOF
echo "$code"
}
echo "ServerManager Agent started (interval: ${INTERVAL}s)"
echo "ServerManager Agent started"
echo " Server: $SERVER_URL/api/metrics/push"
echo " Interval: ${INTERVAL}s"
echo " Host: $(hostname)"
sleep 2
while true; do
collect_metrics
http_code=$(push_metrics)
echo "[$(date)] HTTP $http_code"
if [ "$http_code" = "200" ]; then
true
elif [ "$http_code" = "0" ]; then
echo " curl failed — check SERVER_URL=$SERVER_URL"
fi
sleep "$INTERVAL"
done
AGENTSCRIPT