Hi,
it is possible the start/stop program failed because of some missing
environment variable - monit purges the environment when executing the program
for security reasons and sets only basic PATH variable. Monit doesn't log the
output from the start/stop script by default, you can capture the output by
wrapping the program like this:
start program = "/bin/bash -c '/etc/init.d/httpd start >>/tmp/httpd.output
2>&1'"
Regards,
Martin
On Dec 3, 2011, at 1:42 PM, Harish Chouhan wrote:
> Hello,
>
> I have installed monit and everything is running great, except httpd and
> sshd. My monitoring code is as below. The monitoring starts well when I start
> Monit for the first time. However if I restart or stop this from the web
> based control of Monit, I get “Execution failed” message.
>
> ## HTTPD monit config
>
> check process apache with pidfile /usr/local/apache/logs/httpd.pid
> group apache
> start program = "/etc/init.d/httpd start"
> stop program = "/etc/init.d/httpd -k stop"
>
> if failed host localhost port 80 protocol http then alert
> if failed host localhost port 80 protocol http then restart
>
> if cpu > 60% for 2 cycles then alert
> if cpu > 80% for 5 cycles then restart
> if children > 250 then restart
>
> ## SSHD monit config
>
> check process sshd with pidfile /var/run/sshd.pid
> start program "/etc/init.d/sshd start"
> stop program "/etc/init.d/sshd stop"
> if failed port 2511 protocol ssh then restart
> if 5 restarts within 5 cycles then timeout
>
>
> My log files also do not give clear details about this error.
>
> [IST Dec 3 18:11:05] info : 'apache' trying to restart
> [IST Dec 3 18:11:05] info : 'apache' stop: /etc/init.d/httpd
>
> Can anyone else?
>
>
> Regards,
> Harish
>
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general