You can use the connection test within 'check process' context as well, you just need to add the hostname to the port test otherwise it defaults to localhost:
check process apache with pidfile /var/run/apache2.pid every 2 cycles start program = "/etc/init.d/apache2 start" with timeout 60 seconds stop program = "/etc/init.d/apache2 stop" if failed host this.host.net port 80 and protocol http and request "/login" with timeout 15 seconds for 4 cycles then restart if 3 restarts within 10 cycles then timeout
=> this will test both the process itself and its tcp port + will be wait for the process to start in case of restart.
Regards, Martin
On Apr 15, 2011, at 11:33 PM, Jeb Wilkins wrote: Hi, I'm using check host because I'm getting rare hangs where apache still is running but isn't responding to http requests. After the start command runs apache is still down, its not responding to requests until another cycle restarts it again. Thanks, Jeb
On 15 Apr 2011 21:15, "Martin Pala" <address@hidden> wrote:
Based on the config it seems that the monitored apache runs on the same host (otherwise the start+stop won't be able to do anything with it) => it will be better to switch to "check process" - Monit will be able to check whether the process was started and will wait for the start to finish - the "check host" is remote check which has no control of the remote process, it will call the start script but won't wait for the process to start so you'll see the result during next cycle.
Regards,
Martin
On Apr 13, 2011, at 12:12 PM, Jeb Wilkins wrote:
> I've got the following monit script on an Ubu... > --
> To unsubscribe:
> http://lists.nongnu.org/mailman/listinfo/monit-general
--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general
-- To unsubscribe: http://lists.nongnu.org/mailman/listinfo/monit-general
|