From 07b07c908797378e83699edba95b18def50ec9c5 Mon Sep 17 00:00:00 2001 From: Maksim Totmin Date: Thu, 9 Apr 2026 10:27:26 +0700 Subject: [PATCH] =?UTF-8?q?fix:=20=D0=BF=D1=80=D0=B0=D0=B2=D0=B0=20=D0=B4?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D1=83=D0=BF=D0=B0=20=D0=B4=D0=BB=D1=8F=20zab?= =?UTF-8?q?bix-agent=20=D0=BD=D0=B0=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20?= =?UTF-8?q?=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - atomic_write: chmod 644 на файлы (было 600 от mkstemp) - install.sh: chmod 755 на /var/lib/airflow-monitor - problems.count: grep вместо python3 (не везде доступен) Co-Authored-By: Claude Opus 4.6 (1M context) --- airflow_monitor/actions.py | 1 + build.sh | 2 ++ zabbix/airflow-monitor.conf | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/airflow_monitor/actions.py b/airflow_monitor/actions.py index d383e7f..5e07d9a 100644 --- a/airflow_monitor/actions.py +++ b/airflow_monitor/actions.py @@ -53,6 +53,7 @@ class DataExporter: ) with os.fdopen(fd, "w", encoding="utf-8") as f: f.write(content) + os.chmod(tmp_path, 0o644) os.replace(tmp_path, str(path)) logger.debug( "File written: %s (%d bytes)", diff --git a/build.sh b/build.sh index 2be497e..9032814 100755 --- a/build.sh +++ b/build.sh @@ -333,6 +333,8 @@ for dir in "$STATE_DIR" "$LOG_DIR"; do else echo " Exists: $dir" fi + # Ensure zabbix agent can read data files + sudo chmod 755 "$dir" done # --- Step 6: Install systemd service --- diff --git a/zabbix/airflow-monitor.conf b/zabbix/airflow-monitor.conf index cfd0b6f..16bc0be 100644 --- a/zabbix/airflow-monitor.conf +++ b/zabbix/airflow-monitor.conf @@ -17,7 +17,7 @@ UserParameter=airflow.dag.problems,cat /var/lib/airflow-monitor/problems.json 2> # Количество проблемных DAG-ов (для простых триггеров) # Zabbix item: type=Zabbix agent, key=airflow.dag.problems.count, type of info=Numeric (unsigned) -UserParameter=airflow.dag.problems.count,python3 -c "import json,sys; print(len(json.load(open('/var/lib/airflow-monitor/problems.json'))))" 2>/dev/null || echo 0 +UserParameter=airflow.dag.problems.count,grep -o '"dag_id"' /var/lib/airflow-monitor/problems.json 2>/dev/null | wc -l # Heartbeat — epoch timestamp последнего успешного цикла # Zabbix item: type=Zabbix agent, key=airflow.monitor.heartbeat, type of info=Numeric (unsigned)