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
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."""
logger.debug("Running command: %s", " ".join(cmd))
try:

View File

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