Holen Sie sich monit alert ersten und später neu starten

Ich würde, wie zu behandeln, eine Art Ketten-Aktion in monit.

  • überprüfen, ob ein Prozess und alarmieren sofort.
  • Neustart-Prozess nach einer Zahl von Zyklen.

Meine versuche (bisher):

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

Nicht aufmerksam und hält sich im Zustand "running" auf fehlerhaften PID neu gestartet, aber nach der 3-Zyklen.

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

Keine Warnung für Kinder < 1 ist, sondern neu starten afer 5.

monit.melden Sie

[CEST Aug  1 15:09:30] error    : 'myprocess' process is not running

monit summary

Process 'myprocess'            Running

Hier tritt monit -v Teil:

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

Also die Frage: ist es möglich, einen Alarm senden, und ändern Sie den status auf 'nicht laufen' innerhalb von 1 Zyklus und starten Sie nach 3?

  • Wenn Sie sagen, "nicht-Alarm" meinst du, Sie haben setup-Globale/lokale E-Mail-Benachrichtigungen für Monit und es nicht senden Sie Sie entsprechend?
  • monit ist richtig eingestellt. alle Benachrichtigungen und E-Mails sind in Ordnung. Wie ich schon schrieb, monit nicht alert an alle und hält Sie in Zustand "running" auf fehlerhaften PID neu gestartet, aber nach der 3-Zyklen.
InformationsquelleAutor questioner | 2014-08-01
Schreibe einen Kommentar