AirflowDAGMonitor/zabbix/airflow-monitor.conf
Maksim Totmin 07b07c9087 fix: права доступа для zabbix-agent на файлы данных
- 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) <noreply@anthropic.com>
2026-04-09 10:27:26 +07:00

33 lines
2.2 KiB
Plaintext

# =============================================================================
# Zabbix Agent UserParameter — Airflow DAG Monitor
#
# Устанавливается в /etc/zabbix/zabbix_agentd.conf.d/airflow-monitor.conf
# Zabbix agent читает файлы, записанные сервисом airflow-monitor,
# и передаёт данные на Zabbix Server/Proxy через стандартный канал агента.
#
# Файлы данных:
# /var/lib/airflow-monitor/problems.json — JSON массив проблемных DAG-ов
# /var/lib/airflow-monitor/heartbeat — epoch timestamp последнего цикла
# /var/lib/airflow-monitor/status.json — статус монитора (JSON)
# =============================================================================
# Список проблемных DAG-ов (JSON text)
# Zabbix item: type=Zabbix agent, key=airflow.dag.problems, type of info=Text
UserParameter=airflow.dag.problems,cat /var/lib/airflow-monitor/problems.json 2>/dev/null || echo '[]'
# Количество проблемных DAG-ов (для простых триггеров)
# Zabbix item: type=Zabbix agent, key=airflow.dag.problems.count, type of info=Numeric (unsigned)
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)
UserParameter=airflow.monitor.heartbeat,cat /var/lib/airflow-monitor/heartbeat 2>/dev/null || echo 0
# Статус монитора (JSON: cycle_count, dag_count, issue_count, cycle_time)
# Zabbix item: type=Zabbix agent, key=airflow.monitor.status, type of info=Text
UserParameter=airflow.monitor.status,cat /var/lib/airflow-monitor/status.json 2>/dev/null || echo '{}'
# Проверка что сервис запущен (1 = работает, 0 = остановлен)
# Zabbix item: type=Zabbix agent, key=airflow.monitor.alive, type of info=Numeric (unsigned)
UserParameter=airflow.monitor.alive,systemctl is-active airflow-monitor >/dev/null 2>&1 && echo 1 || echo 0