MAILTO = ppc@localhost
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

* * * * * root mkdir -p /var/log/yandex/directadmin; chown -R ppc: /var/log/yandex/directadmin/

# mysql heartbeat writer
* * * * * ppc switchman -c /etc/directadmin-switchman.conf -g ppcback --lockname mysqlGenerateHeartbeat -- timeout 60 mysqlGenerateHeartbeat.py --no-fork -c /etc/yandex-direct/db-config.json --log-file /var/log/yandex/directadmin/mysqlGenerateHeartbeat.log.$(date +\%Y\%m\%d)

# juggler-digest в чат
0 12,18 * * * ppc switchman -c /etc/directadmin-switchman.conf -g ppcback --lockname jmn.directadmin_TV -- check-working-to-juggler "yd_herald.mon.directadmin" direct-chat-bot.py -t telegram -c /etc/direct-chat-bot/telegram.yaml --one-time-reply -m "/mon directadmin_TV,direct-apps-health,direct-resources" --chat-id Direct.Monitoring --sleep 10 2>&1 | ts >> /var/log/yandex/directadmin/juggler-monitoring-notifier.da-tv.log.$(date +\%Y\%m\%d)
# juggler-digest для app-duty - прод
*/10 10-21 * * * ppc switchman -c /etc/directadmin-switchman.conf -g ppcback --lockname jmn.appduty_TV -- check-working-to-juggler "yd_herald.mon.appduty" direct-chat-bot.py -t telegram -c /etc/direct-chat-bot/telegram.yaml --one-time-reply -m "/mon_title direct-appduty-tv,direct-apps-health,direct-subsystems-health,direct-baking-systems-health,direct-resources" --chat-id Direct.AppDuty.Monitoring --sleep 10 2>&1 | ts >> /var/log/yandex/directadmin/juggler-monitoring-notifier.da-tv.log.$(date +\%Y\%m\%d)
# juggler-digest для app-duty - не прод
*/10 10-21 * * 1-5 ppc switchman -c /etc/directadmin-switchman.conf -g ppcback --lockname jmn.appduty_TV_np -- check-working-to-juggler "yd_herald.mon.appduty" direct-chat-bot.py -t telegram -c /etc/direct-chat-bot/telegram.yaml --one-time-reply -m "/mon_title direct-appduty-tv_np,direct-resources" --chat-id Direct.NP.Monitoring --sleep 10 2>&1 | ts >> /var/log/yandex/directadmin/juggler-monitoring-notifier.da-tv.log.$(date +\%Y\%m\%d)

*/30 * * * * ppc switchman -c /etc/directadmin-switchman.conf -g ppcback --lockname jmn.directadmin.calls -- check-working-to-juggler "yd_herald.mon.directadmin.calls" direct-chat-bot.py -t telegram -c /etc/direct-chat-bot/telegram.yaml --one-time-reply -m "/mon directadmin.calls crit quiet" --chat-id Direct.Monitoring.Calls --sleep 10 2>&1 | ts >> /var/log/yandex/directadmin/juggler-monitoring-notifier.da-calls.log.$(date +\%Y\%m\%d)

# version-consistency-monitor
5,25,45 * * * * ppc switchman -c /etc/directadmin-switchman.conf -g ppcback --lockname version-consistency-monitor -- version-consistency-monitor --queue DIRECTALERTS >> /var/log/yandex/directadmin/version-consistency-monitor.log.$(date +\%Y\%m\%d) 2>&1

# графики лимитов и рекомендаций по утилизации gencfg групп в резервации директа
# более не актуально, оставлю тут как пример использования
##*/15 * * * * ppc switchman -c /etc/directadmin-switchman.conf -g ppcback --lockname dt-resmon-gencfg -- dt-resmon-gencfg --apply >> /var/log/yandex/directadmin/dt-resmon-gencfg.log.$(date +\%Y\%m\%d) 2>&1

# проверки condutor_vs_zk и zookeeper_vs_deb
* * * * * ppc switchman -c /etc/directadmin-switchman.conf -g ppcback --lockname dt-hosts-monitoring --delay 5 -- timeout 45 dt-hosts-monitoring >> /var/log/yandex/directadmin/dt-hosts-monitoring.log.$(date +\%Y\%m\%d) 2>&1

# граф схемы репликации
* * * * * root mkdir -p /var/log/yandex/db-repl-status/; chown -R ppc: /var/log/yandex/db-repl-status/
* * * * * ppc switchman -c /etc/directadmin-switchman.conf -g ppcback --lockname db-repl-status --delay 5 -- timeout 45 db-repl-status >> /var/log/yandex/db-repl-status/stderrout.log.$(date +\%Y\%m\%d) 2>&1

# админские мониторинги - периодически применяем
*/10 * * * * ppc switchman -c /etc/directadmin-switchman.conf -g ppcback --lockname directadmin-make-juggler --delay 5 -- timeout 600 directadmin-make-juggler.py --svn-path arcadia.yandex.ru/arc/trunk/arcadia/direct/infra/direct-utils/directadmin-juggler/checks --svn-user robot-direct-arc-p --svn-key /etc/direct-tokens/ssh-rsa_robot-direct-arc-p --check-first --apply --token /etc/direct-tokens/juggler_api -v >> /var/log/yandex/directadmin/directadmin-make-juggler.log.$(date +\%Y\%m\%d) 2>&1

# мониторинг zk-sync
*/5 * * * * ppc switchman -c /etc/directadmin-switchman.conf -g ppcback --lockname zk-sync-consistency --delay 5 -- timeout 200 zk-sync-consistency --juggler >> /var/log/yandex/directadmin/zk-sync-consistency.log.$(date +\%Y\%m\%d) 2>&1

# парсим рассылку noc-windy
4,34 * * * * ppc switchman -c /etc/directadmin-switchman.conf -g ppcback --lockname noc-mails-reader --delay 5 -- timeout 300 noc-mails-reader >> /var/log/yandex/directadmin/noc-mails-reader.log.$(date +\%Y\%m\%d) 2>&1

# парсим даунтаймы дц из infra.yandex-team.ru
*/15 * * * * ppc switchman -c /etc/directadmin-switchman.conf -g ppcback --lockname dc-downtimes-parser --delay 5 -- timeout 300 dc-downtimes-parser >> /var/log/yandex/directadmin/dc-downtimes-parser.log.$(date +\%Y\%m\%d) 2>&1

# мониторинг даунтаймов хостов директа
* * * * * ppc switchman -c /etc/directadmin-switchman.conf -g ppcback --lockname downtime-db-notify --delay 5 -- timeout 40 downtime-db-notify >> /var/log/yandex/directadmin/downtime-db-notify.log.$(date +\%Y\%m\%d) 2>&1

# консистентность большой БД и Песочницы
22 */4 * * * ppc switchman -c /etc/directadmin-switchman.conf -g ppcback --lockname notify-db-structure-diff --delay 5 -- timeout 600 notify-db-structure-diff --env pr -st --juggler

# бэкапы соломона
*/30 * * * * ppc switchman -c /etc/directadmin-switchman.conf -g ppcback --lockname solomonerator --delay 5 -- timeout 600 solomonerator backup -t /etc/direct-tokens/solomon_robot-direct-slmn-p --arcadia-key /etc/direct-tokens/ssh-rsa_robot-direct-arc-p -u robot-direct-arc-p --do >> /var/log/yandex/directadmin/solomonerator_backup.log.$(date +\%Y\%m\%d) 2>&1

# дампы ресурсов Директа из abc
3 */4 * * * ppc switchman -c /etc/directadmin-switchman.conf -g ppcback --lockname dt-abc-resources-dump --delay 5 -- timeout 900 dt-abc-resources-dump -t /etc/direct-tokens/startrek --arcadia-key /etc/direct-tokens/ssh-rsa_robot-direct-arc-p -u robot-direct-arc-p --do >> /var/log/yandex/directadmin/abc-resources-dump.log.$(date +\%Y\%m\%d) 2>&1

* * * * * ppc switchman -c /etc/directadmin-switchman.conf -g ppcback --lockname checkMysqlClusterSettings --delay 5 -- timeout 50 checkMysqlClusterSettings -j >> /var/log/yandex/directadmin/checkMysqlClusterSettings.log.$(date +\%Y\%m\%d) 2>&1
