получите монитор, чтобы предупредить сначала и перезапустить позже
Я хотел бы справиться с неким цепным действием в monit.
проверить процесс и немедленно предупредить.перезапустите процесс после нескольких циклов.Мои попытки (пока):
check process myprocess with pidfile /run/my.pid
start program = "/path/to/binary start" with timeout 60 seconds
stop program = "/path/to/binary stop" with timeout 60 seconds
if not exist for 3 cycles then restart
if not exist then alert
if 3 restarts within 3 cycles then timeout
Не предупреждает и сохраняет состояние «работает» при сбое PID, но перезапускается после 3 циклов.
check process myprocess with pidfile /run/my.pid
start program = "/path/to/binary start" with timeout 60 seconds
stop program = "/path/to/binary stop" with timeout 60 seconds
if not exist for 3 cycles then restart
if children < 1 for 1 cycles then alert
if 3 restarts within 3 cycles then timeout
Нет оповещения о детях <1, но перезапустите после 5.
monit.log
[CEST Aug 1 15:09:30] error : 'myprocess' process is not running
Мониторинг резюме
Process 'myprocess' Running
Вот часть mont -v:
Existence = if does not exist 3 times within 3 cycle(s) then restart else
if succeeded 1 times within 1 cycle(s) then alert
Pid = if changed 1 times within 1 cycle(s) then alert
Ppid = if changed 1 times within 1 cycle(s) then alert
Children = if less than 1 1 times within 1 cycle(s) then alert else if
succeeded 1 times within 1 cycle(s) then alert
Timeout = If restarted 3 times within 3 cycle(s) then unmonitor
Таким образом, вопрос: можно ли отправить предупреждение и изменить статус на «не работает» в течение 1 цикла и перезапустить после 3?