obtener monit para alertar primero y reiniciar más tarde
Me gustaría manejar un tipo de acción en cadena en monit.
compruebe si hay un proceso y avise de inmediato.reiniciar el proceso después de un número de ciclos.Mis intentos (hasta ahora):
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
No alerta y se mantiene en estado "en ejecución" al fallar el PID, pero se reinicia después de los 3 ciclos.
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
No hay alerta de niños <1 pero reinicia después de 5.
monit.log
[CEST Aug 1 15:09:30] error : 'myprocess' process is not running
resumen de monit
Process 'myprocess' Running
Aquí está la parte 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
Entonces, la pregunta: ¿es posible enviar una alerta y cambiar el estado a 'no ejecutándose' dentro de 1 ciclo y reiniciar después de 3?