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"