feat(hub): Loki (config+datasource), panel de logs en node detail, stat nodos caídos + overview compacto, loki_url en deploy_agent

This commit is contained in:
Egutierrez
2026-06-07 13:22:00 +02:00
parent e87069d366
commit a099488a9d
5 changed files with 111 additions and 47 deletions
+5 -2
View File
@@ -19,6 +19,7 @@ HOST="${2:?uso: deploy_agent.sh <node> <ssh_host> [arch]}"
ARCH="${3:-amd64}"
HUB="https://metrics-dxaqj3ina6eqd5pjt85wkrrj.organic-machine.com/api/v1/import/prometheus"
LOKI="https://logs-wmaxecsjcfnocz81d5luca92.organic-machine.com/loki/api/v1/push"
PW="$(pass show fleet/ingest-pass | head -1)"
BIN="$(cd "$(dirname "$0")/.." && pwd)/apps/metrics_agent/dist/metrics_agent_${ARCH}"
@@ -28,7 +29,7 @@ echo ">> copiando binario a $HOST"
scp -q -o BatchMode=yes "$BIN" "$HOST:/tmp/metrics_agent"
echo ">> instalando servicio en $NODE ($HOST)"
ssh -o BatchMode=yes "$HOST" "NODE='$NODE' PW='$PW' HUB='$HUB' bash -s" <<'OUTER'
ssh -o BatchMode=yes "$HOST" "NODE='$NODE' PW='$PW' HUB='$HUB' LOKI='$LOKI' bash -s" <<'OUTER'
set -e
sudo -n mkdir -p /opt/fleet-agent /etc/fleet-agent
sudo -n mv /tmp/metrics_agent /opt/fleet-agent/metrics_agent
@@ -37,6 +38,7 @@ sudo -n tee /etc/fleet-agent/agent.json >/dev/null <<JSON
{
"node": "${NODE}",
"hub_url": "${HUB}",
"loki_url": "${LOKI}",
"user": "fleet",
"pass": "${PW}",
"interval_sec": 15
@@ -60,7 +62,8 @@ NoNewPrivileges=true
WantedBy=multi-user.target
UNIT
sudo -n systemctl daemon-reload
sudo -n systemctl enable --now fleet-agent
sudo -n systemctl enable fleet-agent >/dev/null 2>&1
sudo -n systemctl restart fleet-agent
sleep 3
echo -n "status: "; systemctl is-active fleet-agent
OUTER