From ecad66cd2c00c1242cc08f55d3f0c2f58c81ac2d Mon Sep 17 00:00:00 2001 From: Maksim Totmin Date: Wed, 8 Apr 2026 18:28:05 +0700 Subject: [PATCH] =?UTF-8?q?fix:=20=D1=83=D0=B2=D0=B5=D0=BB=D0=B8=D1=87?= =?UTF-8?q?=D0=B8=D0=BB=20=D1=82=D0=B0=D0=B9=D0=BC=D0=B0=D1=83=D1=82=20doc?= =?UTF-8?q?ker=20ps=20=D0=B4=D0=BE=2060=D1=81,=20=D0=B4=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=B8=D0=BB=20zabbix=5Fagentd=20=D0=B2=20=D1=81=D0=BF?= =?UTF-8?q?=D0=B8=D1=81=D0=BE=D0=BA=20=D1=81=D0=B5=D1=80=D0=B2=D0=B8=D1=81?= =?UTF-8?q?=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - discovery таймаут 15с → 60с (на серверах с множеством контейнеров docker ps медленный) - install.sh/setup.sh ищет zabbix_agentd, zabbix-agent, zabbix-agent2 --- airflow_monitor/discovery.py | 2 +- build.sh | 20 ++++++++++++-------- setup.sh | 19 +++++++++++-------- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/airflow_monitor/discovery.py b/airflow_monitor/discovery.py index 3dc59f1..6c9a0c2 100644 --- a/airflow_monitor/discovery.py +++ b/airflow_monitor/discovery.py @@ -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: diff --git a/build.sh b/build.sh index 4aad502..e524f86 100755 --- a/build.sh +++ b/build.sh @@ -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" diff --git a/setup.sh b/setup.sh index 2f0b7f5..9076416 100755 --- a/setup.sh +++ b/setup.sh @@ -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"