Monit restarting a process is a symptom, so alert on the restart

A process supervisor that quietly restarts a service is doing its job and hiding the problem, so a memory leak becomes a daily restart nobody knows about.

check process php-fpm with pidfile /run/php/php7.2-fpm.pid
  start program = "/bin/systemctl start php7.2-fpm"
  stop program  = "/bin/systemctl stop php7.2-fpm"
  if totalmem > 1200 MB for 3 cycles then restart
  if 3 restarts within 10 cycles then alert

set mailserver localhost
set alert [email protected]

The second condition is the one that matters — the first keeps the site up and the second tells somebody it has been keeping the site up. Three restarts in ten cycles is a service that is not healthy, and without the alert it looks identical to a service that has never restarted. Monit’s value over systemd’s own restart handling is exactly this: conditions on memory and response time rather than only on the process having died.