Files
mikrotik-monitor/stack.yml
T

72 lines
3.7 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
version: "3.9"
# ═══════════════════════════════════════════════════════════════════
# MikroTik Monitor — Portainer Stack
#
# Перед деплоем:
# 1. Соберите образ на сервере (см. README) и запомните его имя
# 2. Заполните все переменные окружения ниже
# 3. В Portainer: Stacks → Add Stack → вставьте этот файл → Deploy
# ═══════════════════════════════════════════════════════════════════
services:
mikrotik-monitor:
# ── Образ ──────────────────────────────────────────────────────
# Соберите локально: docker build -t mikrotik-monitor:latest .
# Или укажите адрес своего реестра:
# registry.example.com/mikrotik-monitor:latest
image: mikrotik-monitor:latest
container_name: mikrotik-monitor
restart: unless-stopped
hostname: mikrotik-monitor
# ── Переменные окружения ────────────────────────────────────────
environment:
# MikroTik
- MIKROTIK_HOST=192.168.88.1 # ← IP вашего роутера
- MIKROTIK_PORT=8728 # API-порт (8728 plain / 8729 SSL)
- MIKROTIK_USER=monitor # ← логин
- MIKROTIK_PASSWORD=your_password # ← пароль
# Telegram
- TELEGRAM_BOT_TOKEN=123456:AABBcc # ← токен от @BotFather
- TELEGRAM_CHAT_ID=-1001234567890 # ← ID чата/группы
# Имя address-list из /ip firewall address-list на MikroTik
- ADDRESS_LIST_NAME=monitor
# Параметры мониторинга
- CHECK_INTERVAL=60 # интервал между проверками (сек)
- PING_COUNT=3 # кол-во пинг-пакетов
- PING_TIMEOUT_MS=1000 # таймаут пинга (мс)
- FAILURE_THRESHOLD=2 # провалов подряд → уведомление DOWN
# Временная зона
- TZ=Europe/Moscow
# ── Тома ───────────────────────────────────────────────────────
volumes:
- /etc/localtime:/etc/localtime:ro
# ── Логирование ─────────────────────────────────────────────────
logging:
driver: json-file
options:
max-size: "10m"
max-file: "5"
# ── Healthcheck ─────────────────────────────────────────────────
# Контейнер помечается healthy, если процесс monitor.py жив
healthcheck:
test: ["CMD-SHELL", "pgrep -f monitor.py || exit 1"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
# ── Метки для Portainer ─────────────────────────────────────────
labels:
- "com.docker.compose.project=mikrotik-monitor"
- "description=MikroTik IP monitoring with Telegram alerts"