I am seeing that when sshd needs to be restarted by monit. It is really successful in starting the process but for whatever reason, start command fails to generate a pid file in /var/run/. As the result monit finds process non existent and attempts so to start it again and again.
Here is my config. I attempted to output all information into a file, however the only information I see is sshd started OK.
check process sshd with pidfile "/var/run/sshd.pid" #start program = "/etc/init.d/sshd start" #stop program = "/etc/init.d/sshd stop" start program = "/bin/bash -c '/etc/init.d/sshd start >>/tmp/sshd.output 2>&1'" stop program = "/bin/bash -c '/etc/init.d/sshd stop >>/tmp/sshd.output 2>&1'" if failed port 22 protocol ssh then restart if 5 restarts within 5 cycles then timeout
I am not sure what causes ssh script to skip writing pid file.