1

I'm trying to configure Monit to monitor my pidfile. I had no problem except for one. this is what I configured:

check process chat with pidfile /var/run/chat.pid
start program = "/etc/init.d/chat start"
start program = "/etc/init.d/chat stop"

this is the process I have when I start chat with /etc/init.d/chat:

ps -ef | grep chat
root     17659     1  0 19:23 pts/2    00:00:00 /usr/bin/php -q /usr/statistic/chatManager
root     17662 17659  0 19:23 pts/2    00:00:00 /usr/bin/php -q /usr/statistic/chatManager

this is what I see in the monit log file:

when I start the process:

[GMT Mar 21 19:23:51] info     : 'chat' process is running with pid 17659

when I stop the process:

**[GMT Mar 21 19:23:11] error    : monit: Start or stop method not defined -- process chat**

any suggestions? thanks!! E.

aseq
  • 4,550
  • 1
  • 22
  • 46
edotan
  • 1,786
  • 12
  • 37
  • 57

2 Answers2

1

Try something like this:

check process chat with pidfile /var/run/chat.pid
start program = "/etc/init.d/chat start"
start program = "/etc/init.d/chat stop"
if failed host 192.0.2.10 port XX then restart
if 5 restarts within 5 cycles then timeout

The IP has to be changed of course, as well as the port.

aseq
  • 4,550
  • 1
  • 22
  • 46
0

You need

stop program = "/etc/init.d/chat stop"

instead of

start program = "/etc/init.d/chat stop"

You wrote start program for both, the start and the stop program.

DerekC
  • 106
  • 5