I think ppid might refer to the parent id, which will always be 1 for a service, so use
check process chat with pidfile /var/run/chat.pid
start program = "/etc/init.d/chat start"
stop program = "/etc/init.d/chat stop"
if changed pid then exec /sbin/reboot
instead. i tested this with some local service, and it works for me, restarting the service causes the server to reboot. (whether this is a good idea generally is another matter... ;-)
from the man page....
Monit can test the process identification number (pid) of a process
for changes. This test is implicit and Monit will send a alert in the
case of failure by default.
The syntax for the pid statement is: IF CHANGED PID [ CYCLES
] THEN action action is a choice of " ALERT ", " RESTART ", " START ",
" STOP ", " EXEC ", " MONITOR " or " UNMONITOR ".
This test is useful to detect possible process restarts which has
occurred in the timeframe between two Monit testing cycles. In the
case that the restart was fast and the process provides expected
service (i.e. all tests succeeded) you will be notified that the
process was replaced.
For example sshd daemon can restart very quickly, thus if someone
changes its configuration and do sshd restart outside of Monit's
control you will be notified that the process was replaced by a new
instance (or you can optionally do some other action such as
preventively stop sshd).
Another example is a MySQL Cluster which has its own watchdog with
process restart ability. You can use Monit for redundant monitoring.
check process sshd with pidfile /var/run/sshd.pid
if changed pid then exec "/my/script"
Monit can test the process parent process identification number (ppid)
of a process for changes. This test is implicit and Monit will send
alert in the case of failure by default.
The syntax for the ppid statement is: IF CHANGED PPID [
CYCLES ] THEN action action is a choice of " ALERT ", " RESTART ", "
START ", " STOP ", " EXEC ", " MONITOR " or " UNMONITOR ".
This test is useful for detecting changes of a process parent.
check process myproc with pidfile /var/run/myproc.pid
if changed ppid then exec "/my/script"