fix: увеличил таймаут docker ps до 60с, добавил zabbix_agentd в список сервисов

- discovery таймаут 15с → 60с (на серверах с множеством контейнеров docker ps медленный)
- install.sh/setup.sh ищет zabbix_agentd, zabbix-agent, zabbix-agent2
This commit is contained in:
Maksim Totmin 2026-04-08 18:28:05 +07:00
parent ee3c7cfa2c
commit ecad66cd2c
3 changed files with 24 additions and 17 deletions

View File

@ -71,7 +71,7 @@ def discover_airflow() -> dict:
return result return result
def _run_cmd(cmd: list[str], timeout: int = 15) -> str: def _run_cmd(cmd: list[str], timeout: int = 60) -> str:
"""Run a shell command and return stdout. Raises DiscoveryError on failure.""" """Run a shell command and return stdout. Raises DiscoveryError on failure."""
logger.debug("Running command: %s", " ".join(cmd)) logger.debug("Running command: %s", " ".join(cmd))
try: try:

View File

@ -366,14 +366,18 @@ if [ -f "$ZABBIX_CONF_SRC" ]; then
sudo cp "$ZABBIX_CONF_SRC" "$ZABBIX_CONF_DST" sudo cp "$ZABBIX_CONF_SRC" "$ZABBIX_CONF_DST"
sudo chmod 644 "$ZABBIX_CONF_DST" sudo chmod 644 "$ZABBIX_CONF_DST"
echo " Installed: $ZABBIX_CONF_DST" echo " Installed: $ZABBIX_CONF_DST"
if systemctl is-active zabbix-agent >/dev/null 2>&1; then # Try common zabbix agent service names
sudo systemctl restart zabbix-agent local restarted=false
echo " Restarted: zabbix-agent" for svc in zabbix_agentd zabbix-agent zabbix-agent2; do
elif systemctl is-active zabbix-agent2 >/dev/null 2>&1; then if systemctl is-active "$svc" >/dev/null 2>&1; then
sudo systemctl restart zabbix-agent2 sudo systemctl restart "$svc"
echo " Restarted: zabbix-agent2" echo " Restarted: $svc"
else restarted=true
echo " WARNING: zabbix-agent not running, restart manually" break
fi
done
if [ "$restarted" = false ]; then
echo " WARNING: zabbix agent not found, restart manually"
fi fi
else else
echo " WARNING: /etc/zabbix/zabbix_agentd.conf.d/ not found" echo " WARNING: /etc/zabbix/zabbix_agentd.conf.d/ not found"

View File

@ -89,14 +89,17 @@ if [ -f "$ZABBIX_CONF_SRC" ]; then
sudo chmod 644 "$ZABBIX_CONF_DST" sudo chmod 644 "$ZABBIX_CONF_DST"
echo " Installed: $ZABBIX_CONF_DST" echo " Installed: $ZABBIX_CONF_DST"
# Restart zabbix agent to pick up new UserParameters # Restart zabbix agent to pick up new UserParameters
if systemctl is-active zabbix-agent >/dev/null 2>&1; then local restarted=false
sudo systemctl restart zabbix-agent for svc in zabbix_agentd zabbix-agent zabbix-agent2; do
echo " Restarted: zabbix-agent" if systemctl is-active "$svc" >/dev/null 2>&1; then
elif systemctl is-active zabbix-agent2 >/dev/null 2>&1; then sudo systemctl restart "$svc"
sudo systemctl restart zabbix-agent2 echo " Restarted: $svc"
echo " Restarted: zabbix-agent2" restarted=true
else break
echo " WARNING: zabbix-agent not running, restart it manually" fi
done
if [ "$restarted" = false ]; then
echo " WARNING: zabbix agent not found, restart manually"
fi fi
else else
echo " WARNING: /etc/zabbix/zabbix_agentd.conf.d/ not found" echo " WARNING: /etc/zabbix/zabbix_agentd.conf.d/ not found"